Note that there are some explanatory texts on larger screens.

plurals
  1. PORails Can't find route in Functional Test
    text
    copied!<p>Rails version 3.0.4 and Ruby 1.9.2</p> <p>I'm using the devise gem, and have my application set up so that a user must sign in to perform any action. While writing my functional tests, I found that all of the test threw the same error.</p> <pre><code>`method_missing': undefined method `new_user_session_path' </code></pre> <p>This is strange as, if I <code>rake routes</code> I can see</p> <pre><code>new_user_session GET /devise/login(.:format) {:action=&gt;"new", :controller=&gt;"devise/sessions"} </code></pre> <p>I can also confirm that when I run the application, all of the <code>link_to</code>s work, when using that path.</p> <p>Is there something special I have to do for a certain controller's test to see other routes?</p> <p>routes.rb</p> <pre><code>Nge::Application.routes.draw do resources :companies resources :users devise_for :users, :path =&gt; "devise", :path_names =&gt; { :sign_in =&gt; 'login', :sign_out =&gt; 'logout', :password =&gt; 'secret', :confirmation =&gt; 'verification', :unlock =&gt; 'unblock', :registration =&gt; 'register', :sign_up =&gt; 'cmon_let_me_in' } ... end </code></pre> <p>test/functional/companies_controller_test.rb</p> <pre><code>require 'test_helper' class CompaniesControllerTest &lt; ActionController::TestCase context "When a user is NOT signed in" do [:index, :new].each do |action| context "and GET ##{action.to_s}" do setup {get action} should set_the_flash.to(/must sign-up/) should redirect_to(new_user_session_path) end end ... end end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload