Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Make eq and eql matchers diffable and clean up when to/not diff
- Loading branch information
1 parent
04eeba1
commit e7303e9
Showing
7 changed files
with
125 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
Feature: diffing | ||
|
||
When appropriate, failure messages will automatically include a diff. | ||
|
||
Scenario: diff for a multiline string | ||
Given a file named "example_spec.rb" with: | ||
""" | ||
describe "a multiline string" do | ||
it "is like another string" do | ||
expected = <<-EXPECTED | ||
this is the | ||
expected | ||
string | ||
EXPECTED | ||
actual = <<-ACTUAL | ||
this is the | ||
actual | ||
string | ||
ACTUAL | ||
actual.should eq(expected) | ||
end | ||
end | ||
""" | ||
When I run "rspec example_spec.rb" | ||
Then the output should contain: | ||
""" | ||
Diff: | ||
@@ -1,4 +1,4 @@ | ||
this is the | ||
- expected | ||
+ actual | ||
string | ||
# ./example_spec.rb:13 | ||
""" | ||
|
||
Scenario: no diff for a single line strings | ||
Given a file named "example_spec.rb" with: | ||
""" | ||
describe "a single line string" do | ||
it "is like another string" do | ||
expected = "this string" | ||
actual = "that string" | ||
actual.should eq(expected) | ||
end | ||
end | ||
""" | ||
When I run "rspec example_spec.rb" | ||
Then the output should not contain "Diff:" | ||
|
||
Scenario: no diff for numbers | ||
Given a file named "example_spec.rb" with: | ||
""" | ||
describe "a number" do | ||
it "is like another number" do | ||
1.should eq(2) | ||
end | ||
end | ||
""" | ||
When I run "rspec example_spec.rb" | ||
Then the output should not contain "Diff:" |
This file contains 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 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 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 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 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 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