Skip to content

Running in project with rspec #3

Closed

Description

@kivanio

It needs to clarify at README that in projects with rspec, the gem 'singed' needs to be at same group as rspecgem in your Gemfile.

Otherwise you get this:

bundle exec singed -- bin/rails runner 'User.all.to_a'
You can remove `require 'dalli/cas/client'` as this code has been rolled into the standard 'dalli/client'.
bundler: failed to load command: singed (/Users/kivanio/.rbenv/versions/3.2.1/bin/singed)
/Users/kivanio/.rbenv/versions/3.2.1/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|
     ^^^^^^^^^^

Activity

  1. Overload119 commented on Mar 21, 2023

    @Overload119

    It'd be nice to remove the dependency on rspec completely.

  2. technicalpickles commented on Mar 21, 2023

    @technicalpickles
    Collaborator

    How are you including singed in your project? I'm confused how singed/rspec is loaded because singed only requires it if RSpec is defined:

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

    We could remove that line, and add an explicit configuration step to rspec, ie require 'singed/rspec'.

  3. Overload119 commented on Mar 21, 2023

    @Overload119

    Ah, I think this is because I have rspec-rails required but not rspec

    [3] pry(main)> defined?(RSpec)
    => "constant"
    [4] pry(main)> RSpec.configure
    NoMethodError: undefined method `configure' for RSpec:Module
    from (pry):3:in `__pry__'
    [5] pry(main)> Object.const_source_location('RSpec')
    => ["/Users/amirsharif/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rspec-rails-6.0.1/lib/rspec/rails/feature_check.rb",
     1]
    [6] pry(main)>
    

    I removed this from my Gemfile and it works. Perhaps we check for the configure via respond_to or just do nothing.

  4. kivanio commented on Mar 22, 2023

    @kivanio
    Author

    Same here
    I only require rspec-rails at my Rails app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions