title: How to complete the rspec put controller test from scaffold
body: <p>I'm using scaffolding to generate rspec controller tests. By default, it creates the test as:</p>
  
  <pre><code>  let(:valid_attributes) {
      skip("Add a hash of attributes valid for your model")
    }
  
    describe "PUT update" do
      describe "with valid params" do
        let(:new_attributes) {
          skip("Add a hash of attributes valid for your model")
        }
  
        it "updates the requested doctor" do
          company = Company.create! valid_attributes
          put :update, {:id =&gt; company.to_param, :company =&gt; new_attributes}, valid_session
          company.reload
          skip("Add assertions for updated state")
        end
  </code></pre>
  
  <p>Using FactoryGirl, I've filled this in with:</p>
  
  <pre><code>  let(:valid_attributes) { FactoryGirl.build(:company).attributes.symbolize_keys }
  
    describe "PUT update" do
      describe "with valid params" do
        let(:new_attributes) { FactoryGirl.build(:company, name: 'New Name').attributes.symbolize_keys }
  
        it "updates the requested company", focus: true do
          company = Company.create! valid_attributes
          put :update, {:id =&gt; company.to_param, :company =&gt; new_attributes}, valid_session
          company.reload
          expect(assigns(:company).attributes.symbolize_keys[:name]).to eq(new_attributes[:name])
  </code></pre>
  
  <p>This works, but it seems like I should be able to test all attributes, instead of just testing the changed name. I tried changing the last line to:</p>
  
  <pre><code>class Hash
    def delete_mutable_attributes
      self.delete_if { |k, v| %w[id created_at updated_at].member?(k) }
    end
  end
  
    expect(assigns(:company).attributes.delete_mutable_attributes.symbolize_keys).to eq(new_attributes)
  </code></pre>
  
  <p>That almost worked, but I'm getting the following error from rspec having to do with BigDecimal fields:</p>
  
  <pre><code>   -:latitude =&gt; #&lt;BigDecimal:7fe376b430c8,'0.8137713195 830835E2',27(27)&gt;,
     -:longitude =&gt; #&lt;BigDecimal:7fe376b43078,'-0.1270954650 1027958E3',27(27)&gt;,
     +:latitude =&gt; #&lt;BigDecimal:7fe3767eadb8,'0.8137713195 830835E2',27(27)&gt;,
     +:longitude =&gt; #&lt;BigDecimal:7fe3767ead40,'-0.1270954650 1027958E3',27(27)&gt;,
  </code></pre>
  
  <p>Using rspec, factory_girl, and scaffolding is incredibly common, so my questions are:</p>
  
  <p>What is a good example of an rspec and factory_girl test for a PUT update with valid params?
  Is it necessary to use <code>attributes.symbolize_keys</code> and to delete the mutable keys? How can I get those BigDecimal objects to evaluate as <code>eq</code>?</p>