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

conflicts with minitest in Rails 4 and rspec_rails #36

Open
jjb opened this issue Oct 11, 2013 · 6 comments
Open

conflicts with minitest in Rails 4 and rspec_rails #36

jjb opened this issue Oct 11, 2013 · 6 comments

Comments

@jjb
Copy link

jjb commented Oct 11, 2013

In Rails 4 with rspec_rails, my assert method is from minitest, not from wrong.

Here's an app demonstrating the problem: https://github.com/jjb/rails_4_rspec_rails_wrong

Here's the relevant commit: jjb/rails_4_rspec_rails_wrong@c59d8f4

I tried putting require 'wrong/adapters/minitest' above and below the rspec require in spec_helper, it made no difference.

rspec_rails does all these handy matcher delegations, maybe that contributes to the problem?

I didn't try a pure-rspec experiment. Let me know if you are at a loss and I will try that.

@jjb
Copy link
Author

jjb commented Oct 11, 2013

@alexch ping

@alexch
Copy link
Collaborator

alexch commented Oct 11, 2013

Haven't taken the time to make Wrong work with Rails 4 yet... If you can submit a patch (in which all tests pass for all versions) I'd be much obliged. (Ask me if you need help understanding the test suite layout.)

Sent from my iPhone

On Oct 11, 2013, at 2:38 PM, John Bachir [email protected] wrote:

In Rails 4 with rspec_rails, my assert method is from minitest, not from wrong.

rspec_rails does (all these handy matcher delegations)[https://github.com/rspec/rspec-rails#matchers], maybe that contributes to the problem?


Reply to this email directly or view it on GitHub.

@jjb
Copy link
Author

jjb commented Oct 12, 2013

Okay, I'll work on a patch. Any ideas for what to explore first? Maybe rails or rspec-rails is somehow including minitest after wrong is included?

I've tried hacking rspec-rails and wrong to just observe the behavior changing and I've come up short. my goal is to make minitest be included in the class last (top of the stack below) so it has precedence, I haven't achieved this yet.

# [1] pry(#<RSpec::Core::ExampleGroup::Nested_1>)> self.class.ancestors
[RSpec::Core::ExampleGroup::Nested_1,
 RSpec::Core::ExampleGroup::Nested_1::LetDefinitions,
 RSpec::Core::ExampleGroup::Nested_1::NamedSubjectPreventSuper,
 FactoryGirl::Syntax::Methods,
 RSpec::Rails::Mocks,
 RSpec::Rails::FixtureSupport,
 ActiveRecord::TestFixtures,
 RSpec::Rails::TestUnitAssertionAdapter,
 RSpec::Rails::MiniTestLifecycleAdapter,
 RSpec::Rails::SetupAndTeardownAdapter,
 RSpec::Core::ExampleGroup,
 RSpec::Matchers,
 RSpec::Core::MockFrameworkAdapter,
 Wrong,
 Wrong::Helpers,
 Wrong::CloseTo,
 Wrong::Eventually,
 Wrong::Capturing,
 Wrong::Rescuing,
 Wrong::Assert,
 RSpec::Core::SharedExampleGroup,
 RSpec::Core::Pending,
 RSpec::Core::Extensions::InstanceEvalWithArgs,
 RSpec::Core::MemoizedHelpers,
 Object,
 Wrong::D,
 ActiveSupport::Dependencies::Loadable,
 JSON::Ext::Generator::GeneratorMethods::Object,
 PP::ObjectMixin,
 Kernel,
 BasicObject]

@jjb
Copy link
Author

jjb commented Oct 12, 2013

If you can explain why this does not make Wrong overwrite minitests' assert, it would help me understand.

require "spec_helper"
require 'wrong/adapters/rspec'

describe User do
  include Wrong

  it "wrong test", :focus do
    assert{1==2}
  end

@JonRowe
Copy link

JonRowe commented Oct 12, 2013

I suspect this may be partly the cause... /lib/wrong/adapters/rspec.rb#L9-L18

@jjb
Copy link
Author

jjb commented Oct 12, 2013

🤦 -- simply the number comparison. right under my nose.

i just changed it and wrong does now work in my environment.

i'll work on a pull request-- but it looks like i can't get the test suit to run in master. here's what happens: https://gist.github.com/jjb/6952117

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

No branches or pull requests

3 participants