codegram/spinach-rails — Issue #4: spinach --generate get "undefined method `World' for main:Object (NoMethodError)"
Author: lgs
Created: 2011-11-02 09:38:26+00:00
State: open

I'm trying spinach on a previous cucumber/rspec env, getting the following error:

lsoave@ubuntu:~/rails/github/gitwatcher$ spinach --generate
/home/lsoave/rails/github/gitwatcher/features/support/paths.rb:42:in `': undefined method `World' for main:Object (NoMethodError)
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/gems/spinach-0.1.5.3/lib/spinach/runner.rb:78:in `require'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/gems/spinach-0.1.5.3/lib/spinach/runner.rb:78:in `block in require_dependencies'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/gems/spinach-0.1.5.3/lib/spinach/runner.rb:77:in `each'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/gems/spinach-0.1.5.3/lib/spinach/runner.rb:77:in `require_dependencies'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/gems/spinach-0.1.5.3/lib/spinach/runner.rb:56:in `run'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/gems/spinach-0.1.5.3/lib/spinach/cli.rb:29:in `run'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/gems/spinach-0.1.5.3/bin/spinach:12:in `'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/bin/spinach:19:in `load'
from /home/lsoave/.rvm/gems/ruby-1.9.2-p290@rails-3.0.10/bin/spinach:19:in `

'
lsoave@ubuntu:~/rails/github/gitwatcher$

my features/support/env.rb config file, looks like following:

lsoave@ubuntu:~/rails/github/gitwatcher$ grep -v ^# features/support/env.rb

ENV["RAILS_ENV"] ||= 'test'
require_relative("../../config/environment")
require 'spinach-rails'

ActionController::Base.allow_rescue = false

begin
DatabaseCleaner.orm = 'mongoid'
DatabaseCleaner.strategy = :truncation
Spinach.hooks.before_scenario do
DatabaseCleaner.start
end
Spinach.hooks.after_scenario do
DatabaseCleaner.clean
end
rescue NameError
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
end

Capybara.server_port = 3001
Capybara.app_host = "http://localhost:3001"
Capybara.server do |app, port|
#require 'rack/handler/mongrel'
require 'rack/handler/thin'
Rack::Handler::Mongrel.run(app, :Port => port)
end

lsoave@ubuntu:~/rails/github/gitwatcher$

and my Gemfile looks like :

lsoave@ubuntu:~/rails/github/gitwatcher$ grep test Gemfile
gem "rspec-rails", ">= 2.6.1", :group => [:development, :test]
gem "database_cleaner", ">= 0.6.7", :group => :test
gem "mongoid-rspec", ">= 1.4.4", :group => :test
gem "factory_girl_rails", ">= 1.2.0", :group => :test
gem "cucumber-rails", '1.0.5', :group => :test
gem "capybara", ">= 1.1.1", :group => :test
gem "launchy", ">= 2.0.5", :group => :test
gem 'spinach-rails', :group => :test
group :development, :test do
lsoave@ubuntu:~/rails/github/gitwatcher$