【问题标题】:Expected response to be a <:success>, but was <301>预期响应为 <:success>,但为 <301>
【发布时间】:2012-07-26 17:57:51
【问题描述】:

我有没有测试的应用程序,现在我正在尝试添加它们(minitest-rails),但是出了点问题。 我正在输入rails generate controller test test 我有:

require "minitest_helper"
class TestControllerTest < MiniTest::Rails::ActionController::TestCase
  test "should get test" do
    get :test
    assert_response :success
  end
end

现在我正在输入 rake testExpected response to be a &lt;success&gt;, but was &lt;301&gt; 发生错误。 问题出在哪里?

已编辑: 我的控制器代码:

class TestController < ApplicationController
  def test
  end
end

【问题讨论】:

  • @apneadiving 但为什么会发生任何重定向?

标签: ruby-on-rails ruby ruby-on-rails-3 testing minitest


【解决方案1】:

我已经解决了!刚刚删除了force_ssl 并在生产配置中添加了config.force_ssl = true

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多