jdliss / shoulda-callback-matchers

Test existence of your Rails callbacks without having to call them
MIT License
134 stars 18 forks source link

undefined method `define' for RSpec::Matchers:Module (NoMethodError) #21

Open jackerman09 opened 8 years ago

jackerman09 commented 8 years ago

I just added this gem, and I am now unable to run any tests or start my spork server.

Gemfile:

group :development, :test do
  gem 'rspec-rails'
  gem 'factory_girl_rails'
  gem 'dotenv-rails'
  # requiring spork first b/c of issue with rspec seen here: https://github.com/sporkrb/spork-rails/issues/26
  gem 'spork', github: 'sporkrb/spork'
  gem 'spork-rails'
end

group :test do
  gem 'guard-rspec', require: false
  gem 'shoulda-matchers'
  gem 'cucumber-rails', require: false
  gem 'database_cleaner'
  gem 'selenium-webdriver'
  gem 'capybara'
  gem 'launchy'
  gem 'simplecov', :require => false, :group => :test
  gem 'shoulda-callback-matchers', '~> 1.1.1'
end

Error:

$ spork
Using RSpec, Rails
Preloading Rails environment
Loading Spork.prefork block...
undefined method `define' for RSpec::Matchers:Module (NoMethodError)
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/aasm-4.9.0/lib/aasm/rspec/allow_event.rb:1:in `<top (required)>'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/aasm-4.9.0/lib/aasm/rspec.rb:3:in `block in <top (required)>'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/aasm-4.9.0/lib/aasm/rspec.rb:2:in `each'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/aasm-4.9.0/lib/aasm/rspec.rb:2:in `<top (required)>'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/Users/JAckerman/Documents/webdev/parkme3.1/spec/spec_helper.rb:14:in `block in <top (required)>'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork.rb:24:in `prefork'
/Users/JAckerman/Documents/webdev/parkme3.1/spec/spec_helper.rb:6:in `<top (required)>'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork/test_framework.rb:138:in `block (2 levels) in preload'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/gems/spork-rails-4.0.0/lib/spork/app_framework/rails.rb:8:in `preload'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork/test_framework.rb:134:in `block in preload'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork.rb:62:in `exec_prefork'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork/test_framework.rb:120:in `preload'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork/run_strategy/forking.rb:25:in `preload'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork/runner.rb:75:in `run'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/lib/spork/runner.rb:10:in `run'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bundler/gems/spork-224df492657e/bin/spork:10:in `<top (required)>'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bin/spork:23:in `load'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bin/spork:23:in `<main>'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `eval'
/Users/JAckerman/.rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `<main>'

Any help would be appreciated, and please let me know if there is any additional information I should share, thanks!

beatrichartz commented 8 years ago

Did you have any luck fixing this? If not, I'd need the RSpec & Rails version you're running.

Also, you could try to add this before your prefork:

require 'rspec/expectations'

It seems like the include call this library does when loading calls define on RSpec::Matchers, which seems not yet to have been loaded.

jackerman09 commented 8 years ago

No luck yet, I will try your suggestions and report back, thanks On May 7, 2016 9:15 AM, "Beat" notifications@github.com wrote:

Did you have any luck fixing this? If not, I'd need the RSpec & Rails version you're running.

Also, you could try to add this before your prefork:

require 'rspec/core'require 'rspec/expectations'require 'rspec/mocks'

It seems like the include call this library does when loading calls define on RSpec::Matchers, which seems not yet to have been loaded.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/beatrichartz/shoulda-callback-matchers/issues/21#issuecomment-217634336