title: How do we print response body in rspec
body: <p>I am trying to write an rspec file for my meetings_controller.rb so as to check if the values returned from my database are correct.</p>
  <p>When I go to localhost:3000/meeting.json, this is the result of my data from the database</p>
  <p><a href="https://i.stack.imgur.com/7hVF1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7hVF1.png" alt="enter image description here" /></a></p>
  <p>my rspec file is trying to check if the correct values are returned.</p>
  <p>I created a folder called controller under specs (after I have installed rspec)and have the file meeting_controller_spec.rb</p>
  <pre><code>require 'rails_helper'
  
  # Change this ArticlesController to your project
  RSpec.describe MeetingsController, type: :controller do
  
      describe &quot;GET #index&quot; do
          # check index
          it &quot;returns a success response&quot; do
              get :index
              puts response.body
              expect(response).to have_http_status(:ok)
              
          end
  
      end
  end
  </code></pre>
  <p>I tried to print the response body but nothing is returning. Is there a way to do this?</p>
  <pre><code>(base) adam-a01:reservation adrianlee$ rspec
  
  .
  
  Finished in 0.0892 seconds (files took 12.15 seconds to load)
  1 example, 0 failures
  </code></pre>
  <p>Btw this is my meeting_controller.rb</p>
  <pre><code>class MeetingsController &lt; ApplicationController
    before_action :set_meeting, only: [:show, :edit, :update, :destroy]
  
    # GET /meetings
    # GET /meetings.json
    def index
      @meetings = Meeting.all
      @meeting = Meeting.new
  
    end
  end
  </code></pre>
  <p>Update: I also tried this method as suggested below but it didnt work still</p>
  <pre><code># Change this ArticlesController to your project
  RSpec.describe MeetingsController, type: :controller do
  
      describe &quot;GET #index&quot; do
          # check index
          it &quot;returns a success response&quot; do
              get :index
              raise response.body 
              expect(response).to have_http_status(:ok)
              
          end
  
      end
  end
  </code></pre>
  <p>This is the error raised
  Failures:</p>
  <pre><code>  1) MeetingsController GET #index returns a success response
       Failure/Error: raise response.body
       RuntimeError:
       # ./spec/controllers/meeting_controller_spec.rb:10:in `block (3 levels) in &lt;top (required)&gt;'
  </code></pre>