rspecを使用してRailsでコントローラーをテストしています。応答本文は、実際の応答ではなく、応答インスタンスの文字列にすぎません。私のテストは以下の通りです。
require 'spec_helper'
describe CampusesController do
render_views
before(:each) do
sign_in :auth_role, 'test@test.com', 'password'
end
it 'should retrieve all campuses as json' do
FactoryGirl.create(:basic_campus)
get 'index', :format => :json
ap response.body
end
end
response.bodyは、文字列「#<ActionDispatch :: Response:0x007f87d6ee8800>」です。実際のjson応答を取得するにはどうすればよいですか?ブラウザを使用すると、正常に動作します。