Skip to content

Rails 4.1/Rspec-rails 2.99 broken #41

@zealot128

Description

@zealot128

Using Rails 4.1 (maybe also 4.0) and Rspec-rails 2.99, the assert method does not work.

ArgumentError:
       wrong number of arguments (0 for 1..2)

I used this fix:

if RSpec.const_defined? :Rails
  require 'rails/version'
  if Rails::VERSION::MAJOR == 4
    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
  end

in addition to the RAILS::VERSION::MAJOR == 3 part in https://github.com/sconover/wrong/blob/master/lib/wrong/adapters/rspec.rb#L7

Just changing the == 3 to >=3 did not work because:

gems/activesupport-4.1.0.beta1/lib/active_support/concern.rb:126:in `included': 
Cannot define multiple 'included' blocks for a Concern (ActiveSupport::Concern::MultipleIncludedBlocks)

This is, why I used the alias method chain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions