-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Add specs for Coverage.supported?
#1039
Add specs for Coverage.supported?
#1039
Conversation
58b7876
to
ec86da2
Compare
Coverage.supported?(:foo).should == false | ||
Coverage.supported?(:bar).should == false | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: It's kind of feature discovering mechanism so it doesn't make sense to require in specs some specific result (true or false).
IMHO the only thing that could be checked is that this method:
- returns
true
orfalse
(for existing modes and arbitrary Symbols) - converts its argument to Symbol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it converts argument to Symbol? Isn't it raising an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I haven't checked. I meant handling of not Symbol arguments in general.
ec86da2
to
a8b0cef
Compare
Coverage.supported?(:methods).should == true | ||
Coverage.supported?(:eval).should == true | ||
Coverage.supported?(:all).should == false | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant something like this:
[true, false].should.include?(Coverage.supported?(:lines))
or
(Coverage.supported?(:lines) == true || Coverage.supported?(:lines) == false).should == true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For arbitrary Symbols that are not lines
, branches
, methods
nor eval
it should always return false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
335b794
to
fade356
Compare
library/coverage/supported_spec.rb
Outdated
[true, false].should.include?(Coverage.supported?(:branches)) | ||
[true, false].should.include?(Coverage.supported?(:methods)) | ||
[true, false].should.include?(Coverage.supported?(:eval)) | ||
Coverage.supported?(:all).should == false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I would move the last case into a separate it
, e.g. it returns false for not existing modes
, and use obviously not existing modes like :foo
, :bar
etc. :all
is too meaningful and looks like correct mode name.
fade356
to
e6a4441
Compare
Thank you! |
#1016
[Feature #19026]