Open jjb opened 11 years ago
@alexch ping
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 notifications@github.com 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.
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]
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
I suspect this may be partly the cause... /lib/wrong/adapters/rspec.rb#L9-L18
:facepalm: -- 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
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: https://github.com/jjb/rails_4_rspec_rails_wrong/commit/c59d8f45388dd267f291151d51445770188a7a5a
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.