title: rails request spec post syntax
body: <p>I can't seem to get my head over how to make post requests for testing a url in request spec tests, here's the test code </p>
  
  <pre><code>RSpec.describe "Certifications", type: :request do
    describe "denies public access" do
  
      it "for new certification form" do
          get new_certification_path
          expect(response).to redirect_to new_user_session_path
      end
  
      it "for creating certification" do
          certification_attributes = FactoryGirl.attributes_for :certification 
  
          expect {
              post "/certifications", { certification: certification_attributes }
          }.to_not change(Certification, :count)
  
          expect(response).to redirect_to new_user_session_path
      end
    end
  end
  </code></pre>
  
  <p>Which gives the error </p>
  
  <pre><code>  1) Certifications denies public access for creating certification
       Failure/Error: post "/certifications", { certification: certification_attributes }
  
   ArgumentError:
     unknown keyword: certification
  </code></pre>
  
  <p>I've tried the <code>:certifications =&gt; certification_attributes</code>, basically can't get my head over on how to pass params. </p>
  
  <p>The controller under test is, adding only relevant methods to this post. </p>
  
  <pre><code>class CertificationsController &lt; ApplicationController
    skip_before_action :authenticate_user!, if: :skip_user_authentication
    before_action :set_certification, only: [:show, :edit, :update, :destroy]
  
    # GET /certifications
    # GET /certifications.json
    def index
      @certifications = Certification.all
    end
  
    # GET /certifications/1
    # GET /certifications/1.json
    def show
    end
  
    # GET /certifications/new
    def new
      @certification = Certification.new
    end
  
    # POST /certifications
    # POST /certifications.json
    def create
      @certification = Certification.new(certification_params)
  
      respond_to do |format|
        if @certification.save
          format.html { redirect_to @certification, notice: 'Certification was successfully created.' }
          format.json { render :show, status: :created, location: @certification }
        else
          format.html { render :new }
          format.json { render json: @certification.errors, status: :unprocessable_entity }
        end
      end
    end
  
    protected
      def skip_user_authentication
          request.format.json? &amp;&amp; (action_name.eql?('show') || (action_name.eql?('index'))) 
      end 
  end
  </code></pre>
  
  <p>I am trying to assert the behaviour of allowing all methods except <code>certifications.json</code> or <code>certifications/1.json</code> to not require authentication, there are other tests which access these URLs and they pass. The part of ensuring it does not allow any other request is where I am stuck. I am using Devise with Omnitauth Google OAuth2 for authentication in this application.</p>
  
  <p>certification_attributes </p>
  
  <pre><code>{
   :name=&gt;"Foundation Certification", 
   :description=&gt;"Foundation Certification", 
   :terms=&gt;"Foundation Certification", 
   :seo_meta_keywords=&gt;["laaa", "lalala certifications"],
   :seo_meta_description=&gt;"Foundation Certifications"
  }
  </code></pre>