MiniTest for Post in Controller
<p>Comments_controller_test.rb</p>

<pre><code>require 'test_helper'

class CommentsControllerTest &lt; ActionController::TestCase
  test "should create a comment" do

    assert_difference('Comment.count') do
      post :create, comment: {user_id: 1, job_id: 1, content: "This is a comment"}
    end

  end
end
</code></pre>

<p>Comments_controller.rb</p>

<pre><code>class CommentsController &lt; ApplicationController

def create
    @comment = Comment.new(comment_params)

    if @comment.save
        render :json =&gt; {:status =&gt; 'success', :entry =&gt; @comment}
    else
        render :json =&gt; {:status =&gt; 'error'}
    end
end

  def comment_params
    params.require(:comment).permit(:job_id, :user_id, :content)
  end
end
</code></pre>

<p>Comments table: </p>

<pre><code>class CreateComments &lt; ActiveRecord::Migration
  def change
    create_table :comments do |t|
      t.string :user_id
      t.string :job_id
      t.string :content

      t.timestamps null: false
    end
  end
end
</code></pre>

<p>When I run this, I get: </p>

<pre><code>Finished in 0.162164s, 110.9987 runs/s, 117.1653 assertions/s.

1) Failure:
CommentsControllerTest#test_should_create_a_comment       

"Comment.count" didn't change by 1.
Expected: 4
Actual: 3
</code></pre>

<p>Any ideas why this isn't being created? Creating a comment works on the actual application, but for some reason it isn't passing in the test</p>

<p>Note: I have 3 comments created in the fixture (that's how it's getting a count of 3).</p>