在控制器我有这样的:Ruby on Rails的测试
def output
if params[:find]
result
elsif params[:print_db]
print_db
end
end
并且测试不希望在PARAMS进入[:找]状态。
测试控制器:
test "should get 5 5 1 for view with 5 5 1 3 3" do
get :output, {str: "5 5 1 3 3 5"}, :params => 'find'
assert_equal assigns[:result], "5, 5, 1"
end
请帮帮我!
您需要发送一个'find'参数,例如'find:true'或其他东西。把pry/etc放在你的控制器中,然后看看你的参数。 –