In the rspec test for my controller the response’s body is always a string representation of an ActiveDispatch::Response instance.
=> #<ActionController::TestResponse:0x00000007863010
...
@body=["#<ActionDispatch::Response:0x00000007530d70>"],...
The controller spec in question:
it 'should not allow invalid email' do
json = { :format => 'json', :patron_profile => { :email => 'bogusemail.com', :password => 'password' } }
post :create, json
response.status.should eq(302)
response.body.to_json.should be_json_eql(%({ 'error' : 'error message'}))
end
What could cause the response.body to be the ActionDispatch string shown above?
Issue 2074 on Devise‘s Github account seems to be what is causing this issue.
As of Nov 4, 2012 a workaround is to use the git master branch of Devise in your Gemfile.