Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant JSON::PRETTY_STATE_PROTOTYPE (NameError) #458

Closed
thiagotrentin opened this issue Dec 22, 2020 · 4 comments
Closed

Comments

@thiagotrentin
Copy link

thiagotrentin commented Dec 22, 2020

I'm getting this error when try to run my Cucumber tests that uses Json as dependency after upgrating to version 2.5.

uninitialized constant JSON::PRETTY_STATE_PROTOTYPE (NameError)
/usr/local/bundle/gems/multi_json-1.15.0/lib/multi_json/adapters/json_common.rb:18:in `dump'
/usr/local/bundle/gems/multi_json-1.15.0/lib/multi_json/adapter.rb:25:in `dump'
/usr/local/bundle/gems/multi_json-1.15.0/lib/multi_json.rb:139:in `dump'
/usr/local/bundle/gems/cucumber-3.2.0/lib/cucumber/formatter/json.rb:77:in `on_test_run_finished'
/usr/local/bundle/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:34:in `block in broadcast'
/usr/local/bundle/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:34:in `each'
/usr/local/bundle/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:34:in `broadcast'
/usr/local/bundle/gems/cucumber-core-3.2.1/lib/cucumber/core/event_bus.rb:40:in `method_missing'
/usr/local/bundle/gems/cucumber-3.2.0/lib/cucumber/configuration.rb:33:in `notify'
/usr/local/bundle/gems/cucumber-3.2.0/lib/cucumber/runtime.rb:76:in `run!'
/usr/local/bundle/gems/cucumber-3.2.0/lib/cucumber/cli/main.rb:34:in `execute!'
/usr/local/bundle/gems/cucumber-3.2.0/bin/cucumber:9:in `<top (required)>'
/usr/local/bundle/bin/cucumber:23:in `load'
/usr/local/bundle/bin/cucumber:23:in `<main>'

Could you help me with this issue?

@hsbt
Copy link
Member

hsbt commented Dec 22, 2020

Thanks for your report.

Can you try the following patch with your local env?

diff --git lib/json/common.rb lib/json/common.rb
index 3e390f2d6b..ea46896fcc 100644
--- lib/json/common.rb
+++ lib/json/common.rb
@@ -72,6 +72,8 @@ def generator=(generator) # :nodoc:
       self.state = generator::State
       const_set :State, self.state
       const_set :SAFE_STATE_PROTOTYPE, State.new # for JRuby
+      const_set :FAST_STATE_PROTOTYPE, create_fast_state
+      const_set :PRETTY_STATE_PROTOTYPE, create_pretty_state
     ensure
       $VERBOSE = old
     end

@thiagotrentin
Copy link
Author

Can you try the following patch with your local env?

it works! 👏

Thanks for your help!

@hsbt
Copy link
Member

hsbt commented Dec 22, 2020

Great. I will release 2.5.1 with the above patch.

@hsbt
Copy link
Member

hsbt commented Dec 22, 2020

Just released json-2.5.1.

@hsbt hsbt closed this as completed Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants