title: Meaning for attributes_for in FactoryGirl and Rspec Testing
body: <p>Looking through a tutorial on controller testing the author gives an example of an rspec test testing a controller action. My question is, why did they use the method <code>attributes_for</code> over <code>build</code>? There is no clear explanation why <code>attributes_for</code> is used besides that it returns a hash of values.</p>
  
  <pre><code>it "redirects to the home page upon save" do
    post :create, contact: Factory.attributes_for(:contact)
    response.should redirect_to root_url
  end
  </code></pre>
  
  <p>The tutorial link is found here: <a href="http://everydayrails.com/2012/04/07/testing-series-rspec-controllers.html" rel="noreferrer">http://everydayrails.com/2012/04/07/testing-series-rspec-controllers.html</a> The example is found at the beginning topic section <code>Controller testing basics</code></p>