I want to call the method ''url_for'' in my functional test. e.g. assert_select "a[href=?]", url_for(:action => :new), :text => ''Neue Seite'' The book I am reading suggests doing this: class PagesControllerTest < ActionController::TestCase def setup def self.url_for(options, *parameters_for_method_reference) options.merge! :only_path => true @controller.url_for(options, *parameters_for_method_reference) end end ... end Why is it necessary to define ''url_for'' within the definition of the ''setup'' method? Why is it necessary to define ''url_for'' using self? All of my tests run just fine if I define url_for as a normal instance method: class PagesControllerTest < ActionController::TestCase def url_for(options, *parameters_for_method_reference) options.merge! :only_path => true @controller.url_for(options, *parameters_for_method_reference) end def test_create_link_in_index get :index assert_select "a[href=?]", url_for(:action => :new), :text => ''Neue Seite'' end ... end Thanks in advance. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.