Comments (7)
Hi,
I'm not familiar with RubyMine - could you explain a little bit more how this breaks, or (even better) what the desired behavior would be?
-- Gabe
from shoulda-matchers.
RM is detecting the presence of minitest, I assume by seeing if the class constant is defined, and when it does, it disables the TestUnit integration. Since assertion_error is requiring minitest/unit, it causes the constant to be defined. Ideally, shoulda should not require a dependency unless it uses it. In assertion_error, its checking for ruby 1.9 to determine if it should use minitest over testunit, which is a flawed assumption (people can and do use testunit with 1.9). It seems dangerous that one could end up with both minitest and testunit loaded, especially since they play in the same namespace.
Perhaps you could test for presence of testunit as the conditional? E.g.
module Shoulda
module Matchers
if defined?(Test::Unit::AssertionFailedError)
AssertionError = Test::Unit::AssertionFailedError
elsif Gem.ruby_version >= Gem::Version.new("1.9")
require 'minitest/unit'
AssertionError = MiniTest::Assertion
else
raise "No unit test library available"
end
end
end
from shoulda-matchers.
Ah, I see. Thanks for the explanation. That looks like a lovely fix.
-- Gabe
from shoulda-matchers.
I run into this issue which caused our team to waste a lot of time by not being able to run individual tests (test-unit can run individual test with RubyMine, minitest can't) as well as me making the guys at JetBrains to waste time tracking why that was happening when I reported it (http://youtrack.jetbrains.com/issue/RUBY-10602?replyTo=27-343557). I also re-reported the issue here: #118.
Will that patch be included? Do you need a clean pull request to do it? (I can give it a try)
from shoulda-matchers.
I created a fork with a branch with @wr0ngway's code... so far everything seems to be working fine for me: https://github.com/watu/shoulda-matchers/tree/do_not_load_minitest
from shoulda-matchers.
@pupeno - I'd be glad to merge this in if you create a pull.
from shoulda-matchers.
@gabebw I'm glad you are, here it is: #119 :)
from shoulda-matchers.
Related Issues (20)
- Can't be used without Rails and with ActiveModel but not ActiveRecord? HOT 1
- Extend ActiveModel matchers to support arrays attributes HOT 2
- Order of multiple `conditions` qualifier in `have_many` - v5.3.0 HOT 4
- The library doesn't work with frozen-string-literals enabled globally. HOT 1
- Shoulda Matchers ActiveRecord Validate Uniqueness HOT 1
- validation_inclusion_of is returning ArgumentError HOT 1
- Minitest: is there a recommended way to use `shoulda-matchers` without using `shoulda-context` ? HOT 2
- Uniqueness matcher does not account for custom error messages HOT 2
- wrong constant name dummy value on rails 7 HOT 5
- rspec spec/unit fails with ruby 3.3.0dev
- Wrong error with matcher HOT 16
- Cannot validate numericality with dynamic values HOT 2
- Ruby-tests-explorer and shoulda integration HOT 1
- Add `query_constraints` qualifier to the association matcher.
- Numericality matcher not working as expected on 6.0.0 HOT 3
- Should implicit default values have valid expectations? HOT 4
- RangeError: cannot get the first element of beginless range
- polymorph uniq check fails with 6.2 HOT 7
- Sin
- Sinmime
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shoulda-matchers.