I am trying out Cucumber for the first time and I've come accross an issue. I am try to use RyanB's nifty authentication generator, but it seems I can't use the helper methods when running my Cucumber features.
Part of my feature giving me problems:
when I am on the new book page # features/step_definitions/web_steps.rb:18
undefined local variable or method `current_user' for #<Cucumber::Rails::World:0x13a3b2a> (NameError)
./features/support/paths.rb:15:in `path_to'
./features/step_definitions/web_steps.rb:19:in `/^(?:|I )am on (.+)$/'
features/user_story.feature:30:in `When I am on the new book page'
support/paths.rb :
when /the new book page/
user_path(current_user)+'/books/new'
routes.rb :
resources :users do
resources :books
end
The piece of code that is giving me my authentication helper methods (like current_user) is inside my lib/ folder. I've tried:
require "#{Rails.root}/lib/authentication"
In my env.rb, but that doesn't seem to do anything. So what should I be doing here instead? I feel there should be a simple solution to this, but it's just going over my head.
Extra Info
gem env :
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.9.2 (2010-03-04 patchlevel -1) [i386-darwin9.8.0]
- INSTALLATION DIRECTORY: /Users/ekoslow/.rvm/gems/ruby-1.9.2-head%rails3beta
- RUBY EXECUTABLE: /Users/ekoslow/.rvm/rubies/ruby-1.9.2-head/bin/ruby
- EXECUTABLE DIRECTORY: /Users/ekoslow/.rvm/gems/ruby-1.9.2-head%rails3beta/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-9
- GEM PATHS:
- /Users/ekoslow/.rvm/gems/ruby-1.9.2-head%rails3beta
- /Users/ekoslow/.rvm/gems/ruby-1.9.2-head%global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- :sources => ["http://gems.rubyforge.org", "http://gems.github.com"]
- REMOTE SOURCES:
- http://gems.rubyforge.org
- http://gems.github.com
And I'm running Rails 3.0.0.beta, but I don't think that has to do with anything in this case.