I am stuck with a problem when testing my controllers with RSpec - the response.body call always returns an empty string. In browser everything renders correctly, and cucumber f
As I worked with a similar problem (that led me to this question), it occurred to me that there are different ways to skin the same cat. In other words, rather than checking for the body text, you might be able to check the content of the flash.
response.body.should =~ /Invalid email or password/
might be an equivalent check to:
flash[:alert].should == "Invalid email or password"
To me the latter seems a bit more flexible as it will run either way, but it may not be appropriate in all cases.
Cheers,
John