title: Testing Rails API controller POST with RSpec
body: <p>As the title suggests I'm just trying to test the create action in my API controller with RSpec. The controller looks something like: </p>
  
  <pre><code>module Api
    module V1
      class BathroomController &lt; ApplicationController
        skip_before_action :verify_authenticity_token, only: [:create]`
  
        def create
          bathroom = Bathroom.new(bathroom_params)
          bathroom.user = current_user
          if bathroom.save
            render json: { status: 'SUCCESS', message: 'Saved new bathroom', bathrooms: bathroom }, status: :ok
          end
        end
  
        private
        def bathroom_params
          params.require(:bathroom).permit(:establishment, :address, :city, :state, :zip, :gender, :key_needed, :toilet_quantity)
        end
  
      end
    end
  end
  </code></pre>
  
  <p>Right now this is doing exactly what it should which is great. The test however...not so much. Here's what I have for the test portion: </p>
  
  <pre><code>describe "POST #create" do
    let!(:bath) {{
      establishment: "Fake Place",
      address: "123 Main St",
      city: "Cityton",
      state: "NY",
      zip: "11111",
      gender: "Unisex",
      key_needed: false,
      toilet_quantity: 1
    }}
    let!(:params) { {bathroom: bath} }
    it "receives bathroom data and creates a new bathroom" do
      post :create, params: params
  
      bathroom = Bathroom.last
      expect(bathroom.establishment).to eq "Fake Place"
    end
  end
  </code></pre>
  
  <p>I'm sure there's more than one thing wrong here but I'm having trouble finding much information about the right way to go about testing this. Any insight or suggestions would be greatly appreciated.</p>