Hi all, I'm trying to create a custom matcher that will visit a given
path and check it's authenticated.
Here's what I have so far (using rspec-rails and capybara):

matcher :require_authentication do
  match do |path|
    visit path
    #page.current_path.should == sign_in_path
    page.current_path.should == '/sign_in'
  end
end

The above version works, but when using the commented out line I get:

  NameError:
       undefined local variable or method `sign_in_path' for
#<RSpec::Matchers::Matcher:0xbbd68ec>

sign_in_path is one of the routes in my application and works fine
inside a describe/it block.
I don't understand why the matcher recognises visit() but not
sign_in_path.

any ideas?
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to