diff --git a/lib/rspec/support/spec/diff_helpers.rb b/lib/rspec/support/spec/diff_helpers.rb index 84e6fbf37..76ef10a67 100644 --- a/lib/rspec/support/spec/diff_helpers.rb +++ b/lib/rspec/support/spec/diff_helpers.rb @@ -10,15 +10,17 @@ module DiffHelpers 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 + end + if Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4" + def removing_two_line_header + "-1,3 +1" + end + else def removing_two_line_header "-1,3 +1,5" end diff --git a/spec/rspec/support/differ_spec.rb b/spec/rspec/support/differ_spec.rb index 0700a74a8..4fc1ca2a4 100644 --- a/spec/rspec/support/differ_spec.rb +++ b/spec/rspec/support/differ_spec.rb @@ -16,7 +16,7 @@ module Support expected = "foo\nzap\nbar\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nanother\nline\n" actual = "foo\nbar\nzap\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nline\n" - if Diff::LCS::VERSION.to_f < 1.4 + if Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4" expected_diff = dedent(<<-'EOD') | | @@ -40,7 +40,7 @@ module Support expected_diff = dedent(<<-'EOD') | | - |@@ -1,4 +1,6 @@ + |@@ -1,6 +1,6 @@ | foo |-zap | bar @@ -65,7 +65,7 @@ module Support expected = "foo\nzap\nbar\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nanother\nline\n" actual = "foo\nbar\nzap\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nline\n" - if Diff::LCS::VERSION.to_f < 1.4 + if Diff::LCS::VERSION.to_f < 1.4 || Diff::LCS::VERSION >= "1.4.4" expected_diff = dedent(<<-'EOS') | |