title: Why does my Rails controller test not route?
body: <p>Why doesn't my test case work and why does it complain about a route not found? It works in the browser.</p>
  <h3>Code</h3>
  <pre><code>class UsersController &lt; ApplicationController
    def deposit
  </code></pre>
  <h3>Routes</h3>
  <pre><code>resources :users do
    post 'deposit', to: :deposit
  </code></pre>
  <h3>Test Case</h3>
  <pre><code>class UsersControllerTest &lt; ActionController::TestCase
    test &quot;deposit&quot; do
      post :deposit, {id: 1} 
  </code></pre>
  <h3>Log</h3>
  <blockquote>
  <p>UsersControllerTest#test_deposit:
  ActionController::UrlGenerationError: No route matches {:id=&gt;&quot;1&quot;, :controller=&gt;&quot;users&quot;, :action=&gt;&quot;deposit&quot;}</p>
  </blockquote>
  <h3>Version</h3>
  <p>Rails 4.0.0</p>
  <h3>Realated</h3>
  <p>I saw this, but it did not help when I used '1'. <a href="https://stackoverflow.com/questions/7434764/rails-routes-issue-with-controller-testing">Rails routes issue with controller testing</a></p>
  <p>I saw this, but I already added :id and it still won't work. <a href="https://stackoverflow.com/questions/17605118/testing-rails-4-controller">Testing Rails 4 Controller</a></p>