title: In Rails and minitest, how do I name my parameters when simulating a POST create request for my model?
body: <p>I'm using Rails 5 and minitest.  How do I submit parameters in minitest to simulate a POST request where my model gets created?  I have this test</p>
  
  <pre><code>  test "do create" do
      person = people(:one)
      score = 10
      post ratings_url, params: {rating[person_id]: person.id, rating[score]: score}
  
      # Verify we got the proper response
      assert_response :success
    end
  </code></pre>
  
  <p>but the above results in the error</p>
  
  <pre><code>localhost:myapp davea$ rails test test/controllers/ratings_controller_test.rb
  Running via Spring preloader in process 30344
  /Users/davea/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require': /Users/davea/Documents/workspace/myapp/test/controllers/ratings_controller_test.rb:14: syntax error, unexpected ':', expecting =&gt; (SyntaxError)
  url, params: {rating[person_id]: person.id, rating[score]: score
  </code></pre>
  
  <p>The only reason I named the POST parameters "rating[person_id]" and "rating[score]" is because that's what they are named when the form is rendered in Rails as HTML.</p>
  
  <p><b>Edit:</b> In response to the answer given, I tried this in my test</p>
  
  <pre><code>post ratings_url, params: { rating: { person_id: person.id, score: score} }
  </code></pre>
  
  <p>and the controller looks like</p>
  
  <pre><code>def save(params)
    rating = Rating.new(rating_params)
    rating.user = current_user
    respond_to do |format|
  </code></pre>
  
  <p>and the error I got was</p>
  
  <pre><code>Error:
  RatingsControllerTest#test_do_create:
  ActionController::UnknownFormat: ActionController::UnknownFormat
  </code></pre>
  
  <p>Complaining about the line</p>
  
  <pre><code>respond_to do |format|
  </code></pre>