This repository has been archived by the owner on Nov 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper to support other libraries expecting diffs
- Loading branch information
Showing
3 changed files
with
31 additions
and
10 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
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,29 @@ | ||
require 'diff/lcs' | ||
|
||
module RSpec | ||
module Support | ||
module Spec | ||
module DiffHelpers | ||
# In the updated version of diff-lcs several diff headers change format slightly | ||
# compensate for this and change minimum version in RSpec 4 | ||
if ::Diff::LCS::VERSION.to_f < 1.4 | ||
def one_line_header(line_number=2) | ||
"-1,#{line_number} +1,#{line_number}" | ||
end | ||
|
||
def removing_two_line_header | ||
"-1,3 +1" | ||
end | ||
else | ||
def one_line_header(_=2) | ||
"-1 +1" | ||
end | ||
|
||
def removing_two_line_header | ||
"-1,3 +1,5" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
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