0

I have a route in my routes.rb file:

map.connect 'login', :controller => 'users', :action => 'login'

and I have a partial being rendered in a view as:

login_path

This view gets called in the functional test of the controller.

However, in the functional test I get the error:

ActionView::TemplateError: undefined local variable or method `login_path' for #<ActionView::Base:0x4762c90>

1) What's the best way of mocking it for the test?

2) Does this indicate a design flaw?

1 Answer 1

1

map.connect will add an unnamed route. What you probably want in your routes.rb is:

map.login 'login', :controller => 'users', :action => 'login'

That will create the named routes login_path and login_url for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.