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 URI::REGEXP #1079

Open
thomaswitt opened this issue Nov 7, 2024 · 2 comments
Open

Uninitialized constant URI::REGEXP #1079

thomaswitt opened this issue Nov 7, 2024 · 2 comments

Comments

@thomaswitt
Copy link

After upgrading to ruby 3.3.6 I get the following error when including webmock in the spec_helper for rspec:

An error occurred while loading spec_helper.
Failure/Error: require 'webmock/rspec'

NameError:
  uninitialized constant URI::REGEXP
# ./spec/spec_helper.rb:4:in `<top (required)>'
# ------------------
# --- Caused by: ---
# LoadError:
#   cannot load such file -- webmock/rspec
#   ./spec/spec_helper.rb:4:in `<top (required)>'
No examples found.
@thomaswitt
Copy link
Author

thomaswitt commented Nov 7, 2024

Seems to come from the dependency from webmock > em-http-request > cookiejar

igrigorik/em-http-request#365

$ irb
>> require 'webmock/rspec'
/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/uri-1.0.0/lib/uri/common.rb:53:in `const_missing': uninitialized constant URI::REGEXP (NameError)
Did you mean?  Regexp
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/cookiejar-0.3.4/lib/cookiejar/cookie_validation.rb:28:in `<module:PATTERN>'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/cookiejar-0.3.4/lib/cookiejar/cookie_validation.rb:27:in `<module:CookieValidation>'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/cookiejar-0.3.4/lib/cookiejar/cookie_validation.rb:25:in `<module:CookieJar>'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/cookiejar-0.3.4/lib/cookiejar/cookie_validation.rb:5:in `<top (required)>'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/cookiejar-0.3.4/lib/cookiejar/cookie.rb:3:in `<top (required)>'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/cookiejar-0.3.4/lib/cookiejar.rb:1:in `<top (required)>'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:1:in `<top (required)>'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/em-http-request-1.1.7/lib/em-http.rb:17:in `<top (required)>'
	... 20 levels...
<internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require': cannot load such file -- em-http-request (LoadError)
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/webmock-3.24.0/lib/webmock/http_lib_adapters/em_http_request_adapter.rb:6:in `<top (required)>'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/webmock-3.24.0/lib/webmock.rb:55:in `require_relative'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/webmock-3.24.0/lib/webmock.rb:55:in `<top (required)>'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/webmock-3.24.0/lib/webmock/rspec.rb:3:in `<top (required)>'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:141:in `require'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:141:in `rescue in require'
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:135:in `require'
	from (irb):1:in `<main>'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/workspace.rb:121:in `eval'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/workspace.rb:121:in `evaluate'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/context.rb:622:in `evaluate_expression'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/context.rb:590:in `evaluate'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1051:in `block (2 levels) in eval_input'
	... 13 levels...
<internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require': cannot load such file -- webmock/rspec (LoadError)
	from <internal:/Users/thomas/.rbenv/versions/3.3.6/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from (irb):1:in `<main>'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/workspace.rb:121:in `eval'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/workspace.rb:121:in `evaluate'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/context.rb:622:in `evaluate_expression'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/context.rb:590:in `evaluate'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1051:in `block (2 levels) in eval_input'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1363:in `signal_status'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1043:in `block in eval_input'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1122:in `block in each_top_level_statement'
	from <internal:kernel>:187:in `loop'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1119:in `each_top_level_statement'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1042:in `eval_input'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1023:in `block in run'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1022:in `catch'
	from /Users/thomas/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1022:in `run'

@thomaswitt
Copy link
Author

I found out that it works if the require 'webmock/rspec' - contrary to the documentation - is moved to spec/rails_helper.rb.

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

1 participant