我需要写一个测试来检查注册页面的标题是否正确。我被困在两个我可以做测试的地方:
在users_controller_test.rb内部使用:
class UsersControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_select "title", "Signup"
end
end在site_layout_test.rb内部使用:
class SiteLayoutTest < ActionDispatch::IntegrationTest
test "layout links" do
get signup_path
assert_select "title", "Signup"
end
end这其中哪一个是测试的正确地点?
发布于 2014-10-27 00:45:07
如果注册链接在布局中,那么将其放在SiteLayoutTest中。如果它只出现在UsersController提供的页面上,那么将其放在UsersControllerTest中。
https://stackoverflow.com/questions/26575861
复制相似问题