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

Commit 3d6fc82

Browse files
committed
Merge pull request #200 from enthuseinc/feature/support_diff-lcs_1.2.x
Add support for diff-lcs 1.2.x while maintaining backwards compatibility with 1.1.3
2 parents b468a19 + feba881 commit 3d6fc82

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/rspec/expectations/differ.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ def diff_as_string(data_new, data_old)
2525
# diff includes lines of context. Otherwise, we might print
2626
# redundant lines.
2727
if (context_lines > 0) and hunk.overlaps?(oldhunk)
28-
hunk.unshift(oldhunk)
28+
if hunk.respond_to?(:merge)
29+
# diff-lcs 1.2.x
30+
hunk.merge(oldhunk)
31+
else
32+
# diff-lcs 1.1.3
33+
hunk.unshift(oldhunk)
34+
end
2935
else
3036
output << oldhunk.diff(format)
3137
end

rspec-expectations.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121
s.rdoc_options = ["--charset=UTF-8"]
2222
s.require_path = "lib"
2323

24-
s.add_runtime_dependency 'diff-lcs', '~> 1.1.3'
24+
s.add_runtime_dependency 'diff-lcs', '>= 1.1.3'
2525

2626
s.add_development_dependency 'rake', '~> 10.0.0'
2727
s.add_development_dependency 'cucumber', '~> 1.1.9'

0 commit comments

Comments
 (0)