title: POST :create rspec controller testing error, wrong number of arguments 2 for 0
body: <p>I'm trying to test my Post_comments#create action in the controller specs with rspec and I keep getting this error message:</p>
  
  <pre><code> Failure/Error: post :create, :post_id =&gt; post.to_param, :post_comment =&gt; attributes_for(:post_comment, comment: "New")
  
   ArgumentError:
     wrong number of arguments (2 for 0)
   # ./spec/controllers/post_comments_controller_spec.rb:95:in `block (4 levels) in &lt;top (required)&gt;'
  </code></pre>
  
  <p>My Post Comments controller:</p>
  
  <pre><code> class PostCommentsController &lt; ApplicationController
  
    before_action :find_todo_list
  
    def index
      @post_comment = @post.post_comments.all
    end
  
    def show
      @post_comment = @post.post_comments.find(params[:id])
    end
  
    def new
      @post_comment = @post.post_comments.new
    end
  
    def edit
      @post_comment = @post.post_comments.find(params[:id])
    end
  
    def create
      @post_comment = @post.post_comments.new(post_comment_params)
      if 
        @post_comment.save
        redirect_to post_post_comments_path
        flash[:success] = "Comment added successfully!"
      else
        flash.now[:error] = "Comment could not be saved"
        render 'new'
      end
    end
  
    def update
      @post_comment = @post.post_comments.find(params[:id])
      if
        @post_comment.update(post_comment_params)
        redirect_to post_post_comment_path
        flash[:success] = "Comment successfully updated"
      else
        flash.now[:error] = "Comment could not be updated"
        render 'edit'
      end
    end
  
    def destroy
      @post_comment = @post.post_comments.find(params[:id])
      @post_comment.destroy
  
      redirect_to post_post_comments_path
      flash[:success] = "The comment was successfully deleted"
    end
  end
  
  private
  
    def find_todo_list
      @post = Post.find_by(params[:post_id])
    end
  
    def post_comment_params
      params.require(:post_comment).permit(:comment)
    end
  </code></pre>
  
  <p>My controller spec that keeps failing:</p>
  
  <pre><code> describe "POST #create" do
  context "flash messages" do
    let(:post) {create(:post)}
  
    it "sets flash success" do
      post :create, :post_id =&gt; post.to_param, :post_comment =&gt; attributes_for(:post_comment, comment: "New")
      expect(flash[:success]).to eq("Comment added successfully!")
    end
  end
  </code></pre>
  
  <p>end</p>
  
  <p>I'm using factory girl so here is my factory for post comments, which has a belongs_to association with a post...duh</p>
  
  <pre><code>  factory :post_comment do
      comment "Post comment"
      post
    end
  </code></pre>
  
  <p>Any help would really help me out, thanks!</p>