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

diff-lcs has changed its format in 1.4 #421

Merged
merged 4 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ matrix:
include:
- rvm: jruby-1.7
env: JRUBY_OPTS='--dev --1.8'
- rvm: 2.7.1
env: DIFF_LCS_VERSION="~> 1.3.0"
allow_failures:
- rvm: jruby-head
- rvm: ruby-head
Expand Down
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ else
gem 'rake', '>= 12.3.3'
end

if ENV['DIFF_LCS_VERSION']
gem 'diff-lcs', ENV['DIFF_LCS_VERSION']
else
gem 'diff-lcs', '~> 1.4', '>= 1.4.3'
end

if RUBY_VERSION < '2.2.0' && !!(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/)
gem "childprocess", "< 1.0.0"
elsif RUBY_VERSION < '2.3.0'
Expand Down
1 change: 1 addition & 0 deletions lib/rspec/support/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'rspec/support/spec/in_sub_process'

RSpec::Support.require_rspec_support "spec/deprecation_helpers"
RSpec::Support.require_rspec_support "spec/diff_helpers"
RSpec::Support.require_rspec_support "spec/with_isolated_stderr"
RSpec::Support.require_rspec_support "spec/stderr_splitter"
RSpec::Support.require_rspec_support "spec/formatting_support"
Expand Down
29 changes: 29 additions & 0 deletions lib/rspec/support/spec/diff_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'diff/lcs'

module RSpec
module Support
module Spec
module DiffHelpers
# In the updated version of diff-lcs several diff headers change format slightly
# compensate for this and change minimum version in RSpec 4
if ::Diff::LCS::VERSION.to_f < 1.4
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

def removing_two_line_header
"-1,3 +1,5"
end
end
end
end
end
end
Loading