uninitialized constant Jasmine::SeleniumDriver::JSON (NameError) #70

Closed
emerleite opened this Issue Jan 3, 2012 · 9 comments

Comments

Projects
None yet
7 participants

When I run rake jasmine:ci it raises the following stack trace:

selenium_driver.rb:48:in `eval_js': uninitialized constant Jasmine::SeleniumDriver::JSON (NameError)
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/jasmine-1.2.0.rc2/lib/jasmine/config.rb:60:in `eval_js'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/jasmine-1.2.0.rc2/lib/jasmine/spec_builder.rb:155:in `eval_js'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/jasmine-1.2.0.rc2/lib/jasmine/spec_builder.rb:56:in `load_suite_info'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/jasmine-1.2.0.rc2/lib/jasmine/spec_builder.rb:18:in `start'
  from /Users/emerson/projetos/catalogo/spec/javascripts/support/jasmine_runner.rb:18:in `<top (required)>'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `block in load_spec_files'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
  from /Users/emerson/.rvm/gems/ruby-1.9.2-p290@catalogo/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `block in autorun'
rake aborted!

The browsers keeps open.

IIf I put require 'json' on top of this file it works.

@emerleite emerleite added a commit to emerleite/jasmine-gem that referenced this issue Jan 3, 2012

@emerleite emerleite require 'json' on top solves Issue #70 94c1803
Contributor

ragaskar commented Feb 13, 2012

Most people have this auto-loaded via Rails or their Gemfile. I mentioned this on the pull, but I think explicitly adding a require 'json' line caused pain to people using alternate versions of JSON.

potomak commented Apr 1, 2012

Same error: http://travis-ci.org/#!/hackatron/sveglia/jobs/991356

Here's project code: https://github.com/hackatron/sveglia

What solution would you suggest?

potomak commented Apr 1, 2012

Here's my solution: hackatron/sveglia@cd60364

zilkey commented Apr 9, 2012

This is now fixed on the prerelease version:

gem "jasmine", "1.2.0.rc3"

In this commit: 5bc6dec

daaain commented Oct 2, 2012

This issue still happens in my pure Ruby project, even with v1.2.1 and even if I install the gem from the master branch as of now :(

It seems the fix for this was removed in 8642ce5. lib/jasmine/config.rb doesn't require json on HEAD and when I bundle against HEAD I get the above error.

If I add require 'json' after require 'erb' in lib/jasmine/config.rb then the error goes away.

I'm seeing either this error or issue #94 when I try rake jasmine:ci on 1.2.0rc3, 1.2.0, 1.2.1 and HEAD so there's currently not a workable version of the gem available for me.

@JamesFerguson JamesFerguson pushed a commit to blake-education/jasmine-gem that referenced this issue Oct 19, 2012

JamesFerguson Re-fix issue #70 - uninitialized constant Jasmine::SeleniumDriver::JSON aa8ebde

@ragaskar ragaskar added a commit that referenced this issue Oct 19, 2012

@ragaskar ragaskar Merge pull request #112 from blake-education/master
Re-fix issue #70 - uninitialized constant Jasmine::SeleniumDriver::JSON
91c1306
Contributor

ragaskar commented Oct 19, 2012

We took James' pull, please check and see if you're still having problems (also keep an eye out for this in the future -- require 'json' has been a constant problem for us, because the JSON constant gets defined by about a billion different libraries, so specifically require-ing one has a high chance of breakage.)

Contributor

ragaskar commented Nov 27, 2012

Closing, re-open if you have problems.

ragaskar closed this Nov 27, 2012

mmb commented Dec 17, 2012

We are experiencing this issue in 1.3.1, but not in 1.3.0. Regression?

@machu machu added a commit to tdiary/tdiary-core that referenced this issue Jan 12, 2013

@machu machu avoid NameError in rake jasmine:ci (see: jasmine/jasmine-gem#70) fb98fb5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment