Testing controller without integrate views

Hello,

I’m new to RSpec and I’m having some trouble testing controllers.
After a lot of testing without coming any closer to a solution, I
figured I should try describing the problem here. Any help will be
appreciated. :slight_smile:

I’m testing controllers and view separately, but something strange
seems to be happening. When I omit integrate_views, all controllers
return a 200 OK status even if the view doesn’t actually exist. That’s
seems to be OK because even so RSpec seems to be using some internal
information and find the correct status.

But, for some reason, some actions are not following this pattern. The
status is incorrect even if the template doesn’t exist. That’s messing
with the tests, because things like response.should be_success and
response.render_template(“controller/template”). So, if I implement
the test to expect a failure, it doesn’t actual fail and I’m unsure
about the tests now.

And if I use integrate_views, the tests fail correctly with the right
status code.

Has anybody seem anything like that? What are the best practices when
not using integrate_views?

Thanks for all the help,

Ronaldo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs