Question

Help please:

I want to user shoulda with minitest.

This is the exception I get:

NoMethodError: undefined method `run_teardown_hooks' for #<#<Class:0x007fd42ed95490>:0x007fd42ed00c78>
/Users/boti/.rvm/gems/ruby-1.9.2-p180@search_server/gems/mocha-0.10.5/lib/mocha/integration/mini_test/version_230_to_262.rb:39:in `run'
/Users/boti/.rvm/gems/ruby-1.9.2-p180@search_server/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run'
/Users/boti/.rvm/gems/ruby-1.9.2-p180@search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:425:in `_run__1339649173504478165__setup__555511959301366683__callbacks'
/Users/boti/.rvm/gems/ruby-1.9.2-p180@search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/boti/.rvm/gems/ruby-1.9.2-p180@search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
/Users/boti/.rvm/gems/ruby-1.9.2-p180@search_server/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/boti/.rvm/gems/ruby-1.9.2-p180@search_server/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb:35:in `run'

This is me gemfile:

gem 'minitest'
gem 'minitest-should_syntax'
gem 'miniskirt'
gem 'rack-livereload'
gem 'guard'
gem 'guard-minitest'
gem 'guard-bundler'
gem 'guard-livereload'

gem 'annotate', ">=2.5.0"
gem 'guard-annotate'
gem "rb-fsevent"
gem 'database_cleaner'
gem "minitest-rails-shoulda"

gem 'sqlite3', :require => 'sqlite3'

This is my test_helper:

ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/should_syntax'
require 'factories/factories'

class ActionController::TestCase
  include Devise::TestHelpers
end
Was it helpful?

Solution

In your Gemfile, specify gem 'shoulda-matchers', '1.4.1' and then run bundle update shoulda-matchers

Explanation

shoulda-matchers 1.4.2 introduced a dependency on bourne, which is dependent on a version of mocha that is broken by minitest because run_setup_hooks and run_teardown_hooks have been removed from minitest.

Here's a bug report for shoulda-matchers that explains what's going on: https://github.com/thoughtbot/shoulda-matchers/issues/235

If you are affected by this problem, take a moment to +1 the bug report, so that it gets a little love.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top