开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜