This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +31
-10
lines changed Expand file tree Collapse file tree 3 files changed +31
-10
lines changed Original file line number Diff line number Diff line change 2
2
require 'rspec/support/spec/in_sub_process'
3
3
4
4
RSpec ::Support . require_rspec_support "spec/deprecation_helpers"
5
+ RSpec ::Support . require_rspec_support "spec/diff_helpers"
5
6
RSpec ::Support . require_rspec_support "spec/with_isolated_stderr"
6
7
RSpec ::Support . require_rspec_support "spec/stderr_splitter"
7
8
RSpec ::Support . require_rspec_support "spec/formatting_support"
Original file line number Diff line number Diff line change
1
+ require 'diff/lcs'
2
+
3
+ module RSpec
4
+ module Support
5
+ module Spec
6
+ module DiffHelpers
7
+ # In the updated version of diff-lcs several diff headers change format slightly
8
+ # compensate for this and change minimum version in RSpec 4
9
+ if ::Diff ::LCS ::VERSION . to_f < 1.4
10
+ def one_line_header ( line_number = 2 )
11
+ "-1,#{ line_number } +1,#{ line_number } "
12
+ end
13
+
14
+ def removing_two_line_header
15
+ "-1,3 +1"
16
+ end
17
+ else
18
+ def one_line_header ( _ = 2 )
19
+ "-1 +1"
20
+ end
21
+
22
+ def removing_two_line_header
23
+ "-1,3 +1,5"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
Original file line number Diff line number Diff line change 7
7
module RSpec
8
8
module Support
9
9
RSpec . describe Differ do
10
-
11
- # In the updated version of diff-lcs several diff headers change format slightly
12
- # compensate for this and change minimum version in RSpec 4
13
- if Diff ::LCS ::VERSION . to_f < 1.4
14
- one_line_header = "-1,2 +1,2"
15
- removing_two_line_header = "-1,3 +1"
16
- else
17
- one_line_header = "-1 +1"
18
- removing_two_line_header = "-1,3 +1,5"
19
- end
10
+ include Spec ::DiffHelpers
20
11
21
12
describe '#diff' do
22
13
let ( :differ ) { RSpec ::Support ::Differ . new }
You can’t perform that action at this time.
0 commit comments