我的测试收到弃用警告,但我不明白我应该如何重构我的测试以符合未来的 Rails 版本。我从多个测试中得到了这个,所以附上了 hight_voltage 静态页面存在的最简单的示例测试。
这是我的测试>
describe HighVoltage::PagesController, '#show' do
%w(about conditions).each do |page|
context "on GET to /pages/#{page}" do
before do
get :show, id: page
end
it { should respond_with(:success) }
it { should render_template(page) }
end
end
end
这是弃用警告。
*DEPRECATION WARNING: ActionController::TestCase HTTP request methods will accept only
keyword arguments in future Rails versions.
Examples:
get :show, params: { id: 1 }, session: { user_id: 1 }
process :update, method: :post, params: { id: 1 }
(called from block (4 levels) in <top (required)> at /Users/kimmo/Documents/care-city/spec/controllers/pages_controller_spec.rb:5)
DEPRECATION WARNING: ActionController::TestCase HTTP request methods will accept only
keyword arguments in future Rails versions.