diff --git a/lib/wrong/adapters/rspec.rb b/lib/wrong/adapters/rspec.rb index 1be3869..8b15726 100644 --- a/lib/wrong/adapters/rspec.rb +++ b/lib/wrong/adapters/rspec.rb @@ -6,7 +6,20 @@ if RSpec.const_defined? :Rails require 'rails/version' - if Rails::VERSION::MAJOR == 3 + case Rails::VERSION::STRING + when /^4\.[12]/ + # RSpec 2 plus Rails 4.1/4.2 + module RSpec::Rails::MinitestAssertionAdapter::ClassMethods + def define_assertion_delegators_with_removed + define_assertion_delegators_without_removed + class_eval do + remove_method :assert + end + end + alias_method_chain :define_assertion_delegators, :removed + end + + when /^4\.0/, /^3\./ # RSpec 2 plus Rails 3 module RSpec::Rails::TestUnitAssertionAdapter included do @@ -16,6 +29,8 @@ module RSpec::Rails::TestUnitAssertionAdapter end end end + else + raise "Wrong's RSpec adapter can't be applied to your Rails version #{Rails::VERSION::STRING}" end end