Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber rake task fails, blames JSON parser

I have a small Rails 4.0.0 / Ruby 2.0.0-p247 app for which I'd like to write some tests. When I run

rake cucumber:all

I get the following error:

/Users/me/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -S bundle exec cucumber  --profile default
/Users/me/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/json/common.rb:155:in `parse': uninitialized constant JSON::Parser (NameError)
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/multi_json-1.7.8/lib/multi_json/adapters/json_common.rb:16:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/multi_json-1.7.8/lib/multi_json/adapter.rb:19:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/multi_json-1.7.8/lib/multi_json.rb:118:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:14:in `<class:I18n>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:6:in `<module:Gherkin>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/i18n.rb:5:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/lexer/i18n_lexer.rb:2:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin/lexer/i18n_lexer.rb:2:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin.rb:1:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/gherkin-2.12.0/lib/gherkin.rb:1:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/lib/cucumber/cli/main.rb:2:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/lib/cucumber/cli/main.rb:2:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/bin/cucumber:11:in `require'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/gems/cucumber-1.3.5/bin/cucumber:11:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/cucumber:23:in `load'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/cucumber:23:in `<main>'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/me/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'

I've run bundle install, bundle update, gem cleanup, etc., to no avail. This same Rails app runs fine on a different machine (Mac OS X 10.8.4), but mine (Mac OS X 10.8.2) does not work. Any ideas?

like image 631
thusson Avatar asked Oct 04 '22 08:10

thusson


1 Answers

I have exactly the same error. The reason is here:

https://github.com/intridea/multi_json/issues/131

Since they have a bug fix, All you need to do is updating multi_json to 1.7.9

--edited Please do NOT change Gemfile.lock, check comments for detail

like image 97
Race Avatar answered Oct 19 '22 04:10

Race