Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


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

emerleite opened this Issue · 9 comments

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 referenced this issue from a commit in emerleite/jasmine-gem
@emerleite emerleite require 'json' on top solves Issue #70 94c1803

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.


Same error:!/hackatron/sveglia/jobs/991356

Here's project code:

What solution would you suggest?


Here's my solution: hackatron/sveglia@cd60364


This is now fixed on the prerelease version:

gem "jasmine", "1.2.0.rc3"

In this commit: 5bc6dec


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 referenced this issue from a commit in blake-education/jasmine-gem
JamesFerguson Re-fix issue #70 - uninitialized constant Jasmine::SeleniumDriver::JSON aa8ebde

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.)


Closing, re-open if you have problems.

@ragaskar ragaskar closed this

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

@machu machu referenced this issue from a commit in tdiary/tdiary-core
@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
Something went wrong with that request. Please try again.