title: Writing test for destroy action but getting No route matches {:action=>"destroy", :controller=>"addresses"}
body: <p>I am trying to write an rspec test for my destroy action of my <code>addresses_controller</code>. I am running into an issue where it cannot find my route even though I clearly see it in my <code>rake routes</code>.</p>
  
  <p>I am getting the following error:</p>
  
  <pre><code>Failure/Error: delete action, params
  ActionController::UrlGenerationError:
  No route matches {:action=&gt;"destroy", :controller=&gt;"addresses"}
  </code></pre>
  
  <p><strong>Here is my test:</strong></p>
  
  <pre><code>describe '#destroy' do
    let (:old_address) { FactoryGirl.create(:address, addressable: user) }
  
    let(:action) { :destroy }
    let(:params) {   }
    let(:referer) { '/' }
  
  
    before do
      request.env['HTTP_REFERER'] = referer
      login_user user, request
    end
  
    it 'redirects back' do
      delete action, params
      expect(response).to redirect_to(referer)
    end
  
  end
  </code></pre>
  
  <p><strong>rake routes:</strong></p>
  
  <pre><code>DELETE /addresses/:id(.:format)                   addresses#destroy
  </code></pre>
  
  <p><strong>addresses_controller.rb:</strong></p>
  
  <pre><code>def destroy
    address = Address.find_by_id(params[:id])
    if address.present? &amp;&amp; address.destroy
      flash[:notice] = "Address deleted."
    end
    redirect_to :back
  end
  </code></pre>
  
  <p><strong>Why is it not detecting my routes when I can manually trigger it and it appears in my rake routes?</strong></p>