Skip to content

Commit

Permalink
Merge pull request #200 from enthuseinc/feature/support_diff-lcs_1.2.x
Browse files Browse the repository at this point in the history
Add support for diff-lcs 1.2.x while maintaining backwards compatibility with 1.1.3
  • Loading branch information
myronmarston committed Jan 22, 2013
2 parents b468a19 + feba881 commit 3d6fc82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/rspec/expectations/differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ def diff_as_string(data_new, data_old)
# diff includes lines of context. Otherwise, we might print
# redundant lines.
if (context_lines > 0) and hunk.overlaps?(oldhunk)
hunk.unshift(oldhunk)
if hunk.respond_to?(:merge)
# diff-lcs 1.2.x
hunk.merge(oldhunk)
else
# diff-lcs 1.1.3
hunk.unshift(oldhunk)
end
else
output << oldhunk.diff(format)
end
Expand Down
2 changes: 1 addition & 1 deletion rspec-expectations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.require_path = "lib"

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

s.add_development_dependency 'rake', '~> 10.0.0'
s.add_development_dependency 'cucumber', '~> 1.1.9'
Expand Down

0 comments on commit 3d6fc82

Please sign in to comment.