Rails Functional Tests - I can't assert a template from another controller's view in my functional test
If controller A's action redirects to 开发者_开发百科another controller B's action, can I check in A's functional test that B's action template is being rendered?
in controller As functional test i.e. assert_template 'controllerB/some_view'
I know that this should be done in controllers Bs tests but I'm wondering if it is technically possible?
I have tried this in my own project but it's failing so I wanted to know if its actually impossible to avoid wasting any time hunting down invisible bugs.
Rails functional tests do not follow redirects from one controller to another. To test this you need to use an integration test. The Rails Guide for testing can help you get started with integration tests
test "current/index should render others/action template" do
get :index
assert_response :success
assert_template "others/index"
end
精彩评论