Rails cucumber undefined method `config' for nil:NilClass (NoMethodError) - ruby-on-rails

I have just upgraded to ruby 1.9.3-p125 (from 1.9.3-p0). All tests were working before the upgrade. Now I get the following error when running rake features
Using the default profile...
undefined method `config' for nil:NilClass (NoMethodError)
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-rails-1.3.0/lib/cucumber/rails.rb:17:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `rescue in block in require'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/bundler-1.1.3/lib/bundler/runtime.rb:62:in `block in require'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
/home/map7/pais/config/application.rb:7:in `<top (required)>'
/home/map7/pais/config/environment.rb:2:in `require'
/home/map7/pais/config/environment.rb:2:in `<top (required)>'
/home/map7/pais/features/support/env.rb:8:in `require'
/home/map7/pais/features/support/env.rb:8:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/bin/cucumber:19:in `load'
/home/map7/.rvm/gems/ruby-1.9.3-p194#rails3.2/bin/cucumber:19:in `<main>'
rake aborted!
Command failed with status (1): [/home/map7/.rvm/rubies/ruby-1.9.3-p194/bin...]
Tasks: TOP => features => cucumber => cucumber:ok
(See full trace by running task with --trace)
I traced this back to the rails.rb file line 17 as mentioned in the error:
if !Rails.application.config.cache_classes
warn "WARNING: You have set Rails' config.cache_classes to false (most likely in config/environments/cucumber.rb). This setting is known to cause problems with database transactions. Set config.cache_classes to true if you want to use transactions. For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165."
end
So it looks like it cannot find Rails.application when within cucumber.
If I go into the console 'rails c' and type Rails.application.config it does return the Configuration object.
I've tried upgrading my cucumber-rails gem to 1.3.0 and cucumber 1.1.9.

This is likely a load order issue with the cucumber-rails gem. If you update your Gemfile not to load it immediately it'll be required later on in the process:
gem "cucumber-rails", "1.3.0", :require => false

Related

Error while installing gem in Ruby on Rails project

I created a simple web project in ROR - postgresql as a DB
C:\Sites\nested>ruby -v
ruby 1.9.3p484 (2013-11-22) [i386-mingw32]
C:\Sites\nested>rails -v
Rails 4.0.2
When I try to add an automatic foreign key either by command line
C:\Sites\nested>gem install automatic_foreign_key
or edit the gem file by adding
# create automatic foreign key
gem "automatic_foreign_key", "~> 1.3.0"
I got the following error when running the server
C:\Sites\nested>rails s
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.2/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method': undefined method `to_sql' for class `ActiveRecord::ConnectionAdapters::Tab leDefinition' (NameError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/core_ext/module/aliasing.rb:32:in `alias_method_chain'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core/active_record/connection_adapters/table_definition.rb:9:in `block in included'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core/active_record/connection_adapters/table_definition.rb:6:in `class_eval'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core/active_record/connection_adapters/table_definition.rb:6:in `included'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core.rb:32:in `include'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/redhillonrails_core-.2.0/lib/redhillonrails_core.rb:32:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:229:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:229:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-.0.2/lib/active_support/dependencies.rb:229:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/automatic_foreign_key-.3.0/lib/automatic_foreign_key.rb:5:in `rescue in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/automatic_foreign_key-.3.0/lib/automatic_foreign_key.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:72:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:70:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:70:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:59:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler/runtime.rb:59:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.3.5/lib/bundler.rb:132:in require'
from C:/Sites/nested/config/application.rb:7:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:74:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:71:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-.0.2/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
FYI this is your error:
`alias_method': undefined method `to_sql' for class `ActiveRecord::ConnectionAdapters::Tab leDefinition' (NameError)
Looks like the gem is creating an alias_method for .to_sql. Alias method basicaly calls a method by another name, so you can use it in different contexts
We use alias_method :name, :title a lot, because we standardize our validations, meaning we need to keep the same method names each time
Error
The actual error is caused by your class not having the to_sql method. I've never encountered this, so I looked it up:
Seems the issue is caued by Rails 4. As for a solution, I would suggest that since automatic_foreign_key hasn't been updated since 2011, it's going to be incompatible with Rails 4
If we take that idea as the problem, maybe you could detail how you want it to work & we could create a work-around?
try this
C:\Sites\nested>gem install --local automatic_foreign_key
and also bundle install --local in your project terminal and then edit gem "automatic_foreign_key", "~> 1.3.0" in your gem file

Rails Error: `method_missing': undefined method `register_middleware'

On Rails, I'm trying to rake a new task I just created and it's giving me an undefined method error:
syck has been removed, psych is used instead
rake aborted!
NoMethodError: undefined method `register_middleware' for #<Faraday::Connection:0x007f8773f41288>
/Library/Ruby/Gems/2.0.0/gems/faraday-0.9.0/lib/faraday.rb:99:in `method_missing'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:41:in `build_conn'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:30:in `initialize'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `new'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `configure'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:86:in `<module:Balanced>'
/Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:11:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
/Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
/Users/Stephanie/Desktop/Pixiboard/config/application.rb:8:in `<top (required)>'
/Users/Stephanie/Desktop/Pixiboard/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
I also get a similar error when trying to run the command "rails console" (to see if there's anything wrong with my task):
syck has been removed, psych is used instead
/Library/Ruby/Gems/2.0.0/gems/faraday-0.9.0/lib/faraday.rb:99:in `method_missing': undefined method `register_middleware' for #<Faraday::Connection:0x007f986c506700> (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:41:in `build_conn'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced/client.rb:30:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `new'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:29:in `configure'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:86:in `<module:Balanced>'
from /Library/Ruby/Gems/2.0.0/gems/balanced-0.8.1/lib/balanced.rb:11:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /Users/Stephanie/Desktop/Pixiboard/config/application.rb:8:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:39:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Can anyone help me on what to do?
(I'm on Rails 3.2.12)
balanced-ruby is not yet compatible with faraday 0.9.0. See more balanced-ruby/issues/173
and try to use faraday 0.8.6 in your Gemfile:
gem 'faraday', '~> 0.8.6'

MInitest Rails 4.1.0rc1 issue

I loaded new rails onto my system and now when i runt the test i am getting the below exception. Please advise
~/railsprojects/my_blog (master) ∴ rake test
MiniTest::Unit::TestCase is now Minitest::Test. From /Users/pranavaswaroop/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/test/unit/testcase.rb:8:in `<module:Unit>'
rake aborted!
MiniTest v5.3.0 is out of date.
`gem install minitest` and add `gem 'minitest' to you test helper.
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/turn-0.9.6/lib/turn/minitest.rb:22:in `<top (required)>'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/turn-0.9.6/lib/turn.rb:13:in `require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/turn-0.9.6/lib/turn.rb:13:in `<top (required)>'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
/Users/pranavaswaroop/railsprojects/my_blog/config/application.rb:7:in `<top (required)>'
/Users/pranavaswaroop/railsprojects/my_blog/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
~/railsprojects/my_blog (master) ∴
I were using turn gem, problem solved by removing it.

Running RoR on Fedora, get: undefined local variable or method `ext_dir' for

I'm trying to install Catarse.me on a Fedora 19 machine, ready to be pushed to Heroku.
I've managed to successfully run bundle install. But when I try
rake db:migrate
I receive this error
[root#acer]$ rake db:migrate
rake aborted!
undefined local variable or method `ext_dir' for #<Gem::Specification:0x450c8ce RedCloth-4.2.9>
/home/user/rails/catarse/config/boot.rb:7:in `<top (required)>'
/home/user/rails/catarse/config/application.rb:1:in `<top (required)>'
/home/user/rails/catarse/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I've individually checked each of these files, and on the lines noted there's a call to
variablename = File.expand_path('../path/to/Gemfile', __FILE__)
CORRECTION The stack trace points to line 7 in book.rb
Bundler.setup
I've googled but the only relevant hit is this StackOverflow question but whose situation and answer is unrelated to my problem.
I'd appreciate the help.
Running rake db:migrate -- trace gives
rake aborted!
undefined local variable or method `ext_dir' for #<Gem::Specification:0x4700158 RedCloth-4.2.9>
/usr/local/share/ruby/site_ruby/rubygems/specification.rb:1887:in `method_missing'
/usr/share/gems/gems/bundler-1.3.1/lib/bundler/rubygems_ext.rb:42:in `load_paths'
/usr/share/gems/gems/bundler-1.3.1/lib/bundler/runtime.rb:37:in `block in setup'
/usr/share/gems/gems/bundler-1.3.1/lib/bundler/runtime.rb:19:in `setup'
/usr/share/gems/gems/bundler-1.3.1/lib/bundler.rb:120:in `setup'
/home/mei/rails/catarse/config/boot.rb:7:in `<top (required)>'
/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/mei/rails/catarse/config/application.rb:1:in `<top (required)>'
/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/share/ruby/site_ruby/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/mei/rails/catarse/Rakefile:4:in `<top (required)>'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/share/gems/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/usr/local/share/gems/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/bin/rake:23:in `load'
/bin/rake:23:in `<main>'
By your trace, it seems like it's a bundler issue,
running
gem update bundler
should fix it.

Tests are running on my Ubuntu pc, but not on my Mac OS X Lion 10.7.3, Ruby 1.9.3, Rails 3.2.1

I have project in Dropbox and two running laptops: one with Ubuntu and one with Mac OS X Lion 10.7.3. When I try to run either rspec or cucumber on ubuntu they are running well, but when I try to run tests on Mac I have the same errors in
config/application.rb:13: Bundler.require(*Rails.groups(:assets => %w(development test)))
For cucumber:
Using the default profile...
undefined method `gsub' for nil:NilClass (NoMethodError)
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:77:in `rescue in rescue in block in require'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:72:in `rescue in block in require'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:62:in `block in require'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:55:in `each'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:55:in `require'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler.rb:119:in `require'
/Users/sergey/Dropbox/rails_projects/payforapps/config/application.rb:13:in `<top (required)>'
/Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/sergey/Dropbox/rails_projects/payforapps/config/environment.rb:2:in `<top (required)>'
/Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/Users/sergey/Dropbox/rails_projects/payforapps/features/support/env.rb:11:in `block in <top (required)>'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/spork-0.9.0/lib/spork.rb:24:in `prefork'
/Users/sergey/Dropbox/rails_projects/payforapps/features/support/env.rb:6:in `<top (required)>'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/bin/cucumber:19:in `load'
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/bin/cucumber:19:in `<main>'
For rspec:
No DRb server is running. Running in local process instead ...
/Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:77:in `rescue in rescue in block in require': undefined method `gsub' for nil:NilClass (NoMethodError)
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:72:in `rescue in block in require'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:62:in `block in require'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:55:in `each'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler/runtime.rb:55:in `require'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#global/gems/bundler-1.1.1/lib/bundler.rb:119:in `require'
from /Users/sergey/Dropbox/rails_projects/payforapps/config/application.rb:13:in `<top (required)>'
from /Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sergey/Dropbox/rails_projects/payforapps/config/environment.rb:2:in `<top (required)>'
from /Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sergey/Dropbox/rails_projects/payforapps/spec/spec_helper.rb:10:in `block in <top (required)>'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/spork-0.9.0/lib/spork.rb:24:in `prefork'
from /Users/sergey/Dropbox/rails_projects/payforapps/spec/spec_helper.rb:4:in `<top (required)>'
from /Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sergey/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/sergey/Dropbox/rails_projects/payforapps/spec/controllers/static_pages_controller_spec.rb:1:in `<top (required)>'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `block in load_spec_files'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `map'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/configuration.rb:746:in `load_spec_files'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/command_line.rb:22:in `run'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:66:in `rescue in run'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:62:in `run'
from /Users/sergey/.rvm/gems/ruby-1.9.3-p125#payforapps321/gems/rspec-core-2.9.0/lib/rspec/core/runner.rb:10:in `block in autorun'
How can I fix it? Any help appreciated. Thank you.
The problem was in two gems in my Gemfile:
gem 'rb-inotify', '0.8.8'
gem 'libnotify', '0.5.9'
These gems are compatible only with Ubuntu as I understand.
UPD:
You should OS-specific gems to groups. Add all OS X specific gems to a darwin group in the Gemfile, and all Linux specific gems to a linux group:
# Gemfile
group :darwin do
gem 'rb-fsevent'
gem 'growl'
end
group :linux do
gem 'rb-inotify'
end
To require the appropriate gems in the right environment, add the following to config/application.rb:
platform = RUBY_PLATFORM.match(/(linux|darwin)/)[0].to_sym
Bundler.require(platform)
See https://github.com/bbatsov/rails-style-guide#bundler for more info about bundler here.
There was a problem with my gem .
update the bundler
Read the error properly, it will tell you which gem is the culprit.
Thing is that not all gems are compatible with OS .

Resources