title: how to test show method in rspec
body: <p>How do I format the following line to do a request to <code>/users/1</code>?</p>
  
  <p><code>get :show, {format: :json, id: @user1.id }</code></p>
  
  <p>I have tried every permutation and bracket arrangement</p>
  
  <p>Resulting error:  </p>
  
  <pre><code>NoMethodError:
             undefined method `json' for #&lt;UsersController
  </code></pre>
  
  <p>The entire spec file:</p>
  
  <p>describe UsersController, :type => :controller do 
      require 'database_cleaner'</p>
  
  <pre><code>DatabaseCleaner.strategy = :truncation
  
  describe "GET users" do
      before(:all) do 
          @user1 = FactoryGirl.create :user, name: "Yakov", default_pull_rate: 10, default_push_rate: 9 
          @user2 = FactoryGirl.create :user, name: "Smirnov", default_pull_rate: 15, default_push_rate: 1
          @user1.save
          @user2.save
  
          @player1 = FactoryGirl.create :player, user_id: 1
          @player1.save
      end
  
      it "returns all users" do 
          get :index, :format =&gt; :json
  
          expect(response.status).to eq 200
  
          body = JSON.parse(response.body)
          user_names = body.map { |u| u["name"] } 
  
          expect(user_names).to match_array(["Yakov", "Smirnov"])
  
      end
  
      it "returns player for a user" do 
  
          get :show, {format: :json, id: @user1.id }
  
          expect(response.status).to eq 200
      end
  
      DatabaseCleaner.clean
  
  end
  </code></pre>
  
  <p>end</p>
  
  <p>Controller:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
      include ActionController::MimeResponds
  
    def index
      @users = User.all
      respond_to do |format|
          format.json { render json: @users }
      end
    end
  
    def show
      @user = User.find(params[:id])
      respond_to do |format|
        format.json { render json @user } 
      end
    end
  
    def create
      @user = PowerUp.new(params[:user])
          @user.save!
    end
  end
  </code></pre>