Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4.1/Rspec-rails 2.99 broken #41

Open
zealot128 opened this issue Dec 30, 2013 · 1 comment · May be fixed by #42
Open

Rails 4.1/Rspec-rails 2.99 broken #41

zealot128 opened this issue Dec 30, 2013 · 1 comment · May be fixed by #42

Comments

@zealot128
Copy link

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.

@zealot128 zealot128 linked a pull request Jan 6, 2014 that will close this issue
@topherhunt
Copy link

+1, @zealot128 thanks for sharing this workaround - it's a lifesaver. For anyone who stumbles on this, it looks like a fix is in the works: #42 and will be merged in as soon as the maintainer has time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants