title: in rspec controller create post with current_user
body: <p>Models:</p>
  
  <pre class="lang-rb prettyprint-override"><code>class User &lt; ApplicationRecord
     has_many :posts
  end
  
  class Post &lt; ApplicationRecord
    belongs_to :user
  end
  </code></pre>
  
  <p>Controllers:</p>
  
  <pre><code>class PostsController &lt; ApplicationController
    def create
     @post = current_user.posts.creata(post_params)
    end
  
    def post_params
     params.require(:post).permit(:name,:user_id)
    end
  end
  
  RSpec.describe PostsController do
   describe "create post" do
    it "should create"
     user = create(:user)
     expect{
     post :create, params: { name: "new post", user_id: user.id }
     }.to change(Post,:count).by(1)
    end
   end
  </code></pre>
  
  <p>And this error:
  ActionController::ParameterMissing:
         param is missing or the value is empty: post</p>