Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit ce965c1

Browse files
authored
Merge pull request #423 from rspec/fix-diff-lcs-144
Fix diff-lcs 1.4.4
2 parents 64a14e2 + fce6ef3 commit ce965c1

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/rspec/support/spec/diff_helpers.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ module DiffHelpers
1010
def one_line_header(line_number=2)
1111
"-1,#{line_number} +1,#{line_number}"
1212
end
13-
14-
def removing_two_line_header
15-
"-1,3 +1"
16-
end
1713
else
1814
def one_line_header(_=2)
1915
"-1 +1"
2016
end
17+
end
2118

19+
if Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4"
20+
def removing_two_line_header
21+
"-1,3 +1"
22+
end
23+
else
2224
def removing_two_line_header
2325
"-1,3 +1,5"
2426
end

spec/rspec/support/differ_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module Support
1616
expected = "foo\nzap\nbar\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nanother\nline\n"
1717
actual = "foo\nbar\nzap\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nline\n"
1818

19-
if Diff::LCS::VERSION.to_f < 1.4
19+
if Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4"
2020
expected_diff = dedent(<<-'EOD')
2121
|
2222
|
@@ -40,7 +40,7 @@ module Support
4040
expected_diff = dedent(<<-'EOD')
4141
|
4242
|
43-
|@@ -1,4 +1,6 @@
43+
|@@ -1,6 +1,6 @@
4444
| foo
4545
|-zap
4646
| bar
@@ -65,7 +65,7 @@ module Support
6565
expected = "foo\nzap\nbar\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nanother\nline\n"
6666
actual = "foo\nbar\nzap\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nline\n"
6767

68-
if Diff::LCS::VERSION.to_f < 1.4
68+
if Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4"
6969
expected_diff = dedent(<<-'EOS')
7070
|
7171
|

0 commit comments

Comments
 (0)