Skip to content

Commit

Permalink
update dependency for higher version of Diff:LCS
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Nov 15, 2013
1 parent c2397f9 commit 46a56bf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
8 changes: 1 addition & 7 deletions lib/rspec/expectations/diff_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ def add_to_output(output, string)
end

def add_old_hunk_to_hunk(hunk, oldhunk)
if hunk.respond_to?(:merge)
# diff-lcs 1.2.x
hunk.merge(oldhunk)
else
# diff-lcs 1.1.3
hunk.unshift(oldhunk)
end
hunk.merge(oldhunk)
end

def format
Expand Down
2 changes: 1 addition & 1 deletion rspec-expectations.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Gem::Specification.new do |s|
# pin to major/minor ignoring patch
s.add_runtime_dependency "rspec-support", "~> #{RSpec::Expectations::Version::STRING.split('.')[0..1].concat(['0']).join('.')}"
end
s.add_runtime_dependency 'diff-lcs', '>= 1.1.3', '< 2.0'
s.add_runtime_dependency 'diff-lcs', '>= 1.2.0', '< 2.0'

s.add_development_dependency 'rake', '~> 10.0.0'
s.add_development_dependency 'cucumber', '~> 1.1.9'
Expand Down
8 changes: 1 addition & 7 deletions spec/rspec/expectations/diff_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module Expectations

end
if RUBY_VERSION.to_f > 1.9
it 'copes with encoded strings', :pending => (Diff::LCS::VERSION < '1.2.2') do
it 'copes with encoded strings' do
@expected="Tu avec carté {count} itém has".encode('UTF-16LE')
@actual="Tu avec carte {count} item has".encode('UTF-16LE')
expect(subject).to eql(<<-EOD.encode('UTF-16LE'))
Expand All @@ -47,12 +47,6 @@ module Expectations
EOD
end

it 'copes with encoded strings', :pending => (Diff::LCS::VERSION >= '1.2.2') do
@expected="Tu avec carté {count} itém has".encode('UTF-16LE')
@actual="Tu avec carte {count} item has".encode('UTF-16LE')
expect(subject).to eql 'Could not produce a diff because of the encoding of the string (UTF-16LE)'
end

it 'handles differently encoded strings that are compatible' do
@expected = "강인철".encode('UTF-8')
@actual = "abc".encode('us-ascii')
Expand Down

0 comments on commit 46a56bf

Please sign in to comment.