This repository was archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 753
Avoid be_falsey and be_truthy #2736
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d020a8c
Define correct predicates such that config.xxx? returns true/false
marcandre e961660
Avoid be_truthy / be_falsey
marcandre 2616deb
Increase the default formatted output's length
pirj 0e2a20d
Skip defining the reader
pirj 685117c
Adjust method names
pirj 6f46e39
Simplify the expectation
pirj 841df69
Typo fix
marcandre 4f05d41
Restore trivial example
marcandre e7df10c
Use define_method instead of class_eval
marcandre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -296,16 +296,16 @@ | |
end | ||
|
||
describe "--fail-fast" do | ||
it "defaults to false" do | ||
expect(parse_options[:fail_fast]).to be_falsey | ||
it "defaults to nil" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These concern me as they represent a change in how we document them, if they are wrong I almost want to fix them rather than the specs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't check the implementation, but I find it perfect that the setting is |
||
expect(parse_options[:fail_fast]).to be(nil) | ||
end | ||
|
||
it "sets fail_fast on config" do | ||
expect(parse_options("--fail-fast")[:fail_fast]).to be_truthy | ||
it "sets fail_fast to 1 on config" do | ||
expect(parse_options("--fail-fast")[:fail_fast]).to be(1) | ||
end | ||
|
||
it "sets fail_fast on config" do | ||
expect(parse_options("--no-fail-fast")[:fail_fast]).to be_falsey | ||
it "sets fail_fast to false on config" do | ||
expect(parse_options("--no-fail-fast")[:fail_fast]).to be(false) | ||
end | ||
end | ||
|
||
|
@@ -322,12 +322,12 @@ | |
end | ||
|
||
describe "--dry-run" do | ||
it "defaults to false" do | ||
expect(parse_options[:dry_run]).to be_falsey | ||
it "defaults to nil" do | ||
expect(parse_options[:dry_run]).to be(nil) | ||
end | ||
|
||
it "sets dry_run on config" do | ||
expect(parse_options("--dry-run")[:dry_run]).to be_truthy | ||
expect(parse_options("--dry-run")[:dry_run]).to be(true) | ||
end | ||
end | ||
|
||
|
@@ -464,7 +464,7 @@ def expect_parsing_to_fail_mentioning_source(source, options=[]) | |
|
||
expect(options[:requires]).to eq(["some_file"]) | ||
expect(options[:full_description]).to eq([/foo\ bar/]) | ||
expect(options[:drb]).to be_truthy | ||
expect(options[:drb]).to be(true) | ||
expect(options[:formatters]).to eq([['global']]) | ||
end | ||
end | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is part of the documentation, not a copy of another spec so should be restored.
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 removed it thinking that:
be_falsey
should not be encouragedcustom_setting
, only that we can alwaysexpect(nil).to be_falsey