Skip to content

Update rspec.rb - #7

Closed
Overload119 wants to merge 1 commit into
rubyatscale:mainfrom
Overload119:main
Closed

Update rspec.rb#7
Overload119 wants to merge 1 commit into
rubyatscale:mainfrom
Overload119:main

Conversation

@Overload119

@Overload119 Overload119 commented Mar 21, 2023

Copy link
Copy Markdown

Removes the dependency on RSpec.

@technicalpickles

Copy link
Copy Markdown
Collaborator

Are you seeing an error that this fixes? There is already a guard clause here:

require 'singed/rspec' if defined?(RSpec)

@Overload119

Copy link
Copy Markdown
Author

Yes, this is the error I'm seeing:

bundle exec rails c
/Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/singed-0.1.1/lib/singed/rspec.rb:3:in `<main>': undefined method `configure' for RSpec:Module (NoMethodError)

RSpec.configure do |config|
     ^^^^^^^^^^
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/singed-0.1.1/lib/singed.rb:56:in `<main>'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.2/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.2/lib/bundler/runtime.rb:55:in `each'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.2/lib/bundler/runtime.rb:55:in `block in require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.2/lib/bundler/runtime.rb:44:in `each'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.2/lib/bundler/runtime.rb:44:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bundler-2.4.2/lib/bundler.rb:195:in `require'
	from /Users/amirsharif/Projects/halo/config/application.rb:7:in `<main>'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4.3/lib/rails/command/actions.rb:22:in `require_application!'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4.3/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4.3/lib/rails/commands/console/console_command.rb:101:in `perform'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4.3/lib/rails/command/base.rb:87:in `perform'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4.3/lib/rails/command.rb:48:in `invoke'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/railties-7.0.4.3/lib/rails/commands.rb:18:in `<main>'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:4:in `<main>'

@Overload119

Copy link
Copy Markdown
Author

This is after adding this gem to development group.

@kivanio

kivanio commented Mar 22, 2023

Copy link
Copy Markdown

@Overload119 that was my original issue.
To make It works it needs to be at same group as rspec-rails
In general it is in test group.

I think we follow same steps:
1 - put at development because it does not need to run at CI or in test.
2 - It broken the load
3 - I put at test group with rspec-rails and then it works.

@technicalpickles

Copy link
Copy Markdown
Collaborator

Thanks, that is helpful. Think we might need some integration tests to make sure things can load correctly.

Another thought: update the guard clause to require 'singed/rspec' if defined?(RSpec) && RSpec.respond_to?(:configure)

@technicalpickles

Copy link
Copy Markdown
Collaborator

Looking more closely at the error, I don't believe the change in this PR would fix it:

Undefined method `configure' for RSpec:Module (NoMethodError)

It would need to check for configure on it as well. That is what I said in the last comment, but wanted to make sure to connect it to the error message you reported.

@technicalpickles

Copy link
Copy Markdown
Collaborator

Handling this slightly differently in #15

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

Successfully merging this pull request may close these issues.

3 participants