cybrid_api_id_ruby 0.113.111 → 0.113.114
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +5 -5
- data/cybrid_api_id_ruby.gemspec +1 -1
- data/lib/cybrid_api_id_ruby/api/bank_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/customer_tokens_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/organization_applications_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api/users_idp_api.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_client.rb +1 -1
- data/lib/cybrid_api_id_ruby/api_error.rb +1 -1
- data/lib/cybrid_api_id_ruby/configuration.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_list_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_all_of_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/application_with_secret_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/customer_token_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/error_response_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_bank_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_customer_token_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_organization_application_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/post_user_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/user_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/models/user_list_idp_model.rb +1 -1
- data/lib/cybrid_api_id_ruby/version.rb +2 -2
- data/lib/cybrid_api_id_ruby.rb +1 -1
- data/spec/api/bank_applications_idp_api_spec.rb +1 -1
- data/spec/api/customer_tokens_idp_api_spec.rb +1 -1
- data/spec/api/organization_applications_idp_api_spec.rb +1 -1
- data/spec/api/users_idp_api_spec.rb +1 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/application_idp_model_spec.rb +1 -1
- data/spec/models/application_list_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_all_of_idp_model_spec.rb +1 -1
- data/spec/models/application_with_secret_idp_model_spec.rb +1 -1
- data/spec/models/customer_token_idp_model_spec.rb +1 -1
- data/spec/models/error_response_idp_model_spec.rb +1 -1
- data/spec/models/post_bank_application_idp_model_spec.rb +1 -1
- data/spec/models/post_customer_token_idp_model_spec.rb +1 -1
- data/spec/models/post_organization_application_idp_model_spec.rb +1 -1
- data/spec/models/post_user_idp_model_spec.rb +1 -1
- data/spec/models/user_idp_model_spec.rb +1 -1
- data/spec/models/user_list_idp_model_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/cache/diff-lcs-1.5.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.2/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/Contributing.md +2 -0
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/History.md +86 -55
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/License.md +6 -4
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/Rakefile +36 -27
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/bin/htmldiff +4 -4
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/array.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.1/lib/diff/lcs/backports.rb +9 -0
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/block.rb +4 -4
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/callbacks.rb +9 -7
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/change.rb +19 -19
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/htmldiff.rb +24 -16
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/hunk.rb +35 -30
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/internals.rb +17 -17
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/ldiff.rb +37 -35
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs.rb +57 -55
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff-lcs.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.1/spec/change_spec.rb +89 -0
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/diff_spec.rb +14 -14
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/hunk_spec.rb +19 -19
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.1/spec/issues_spec.rb +160 -0
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/lcs_spec.rb +11 -11
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/ldiff_spec.rb +13 -11
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/patch_spec.rb +84 -84
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.1/spec/sdiff_spec.rb +216 -0
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/spec_helper.rb +76 -74
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.1/spec/traverse_balanced_spec.rb +312 -0
- data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/traverse_sequences_spec.rb +31 -31
- data/vendor/bundle/ruby/3.2.0/specifications/{diff-lcs-1.5.0.gemspec → diff-lcs-1.5.1.gemspec} +7 -7
- metadata +63 -63
- data/vendor/bundle/ruby/3.2.0/cache/diff-lcs-1.5.0.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.0/lib/diff/lcs/backports.rb +0 -9
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.0/spec/change_spec.rb +0 -89
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.0/spec/issues_spec.rb +0 -154
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.0/spec/sdiff_spec.rb +0 -214
- data/vendor/bundle/ruby/3.2.0/gems/diff-lcs-1.5.0/spec/traverse_balanced_spec.rb +0 -310
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/.rspec +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/Code-of-Conduct.md +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/Manifest.txt +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/README.rdoc +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/bin/ldiff +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/docs/COPYING.txt +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/docs/artistic.txt +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/lib/diff/lcs/string.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/aX +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/bXaX +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ds1.csv +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ds2.csv +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff-c +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff-e +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff-f +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff-u +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef-c +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef-e +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef-f +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef-u +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef2 +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef2-c +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef2-d +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef2-e +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef2-f +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/ldiff/output.diff.chef2-u +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/new-chef +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/new-chef2 +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/old-chef +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{diff-lcs-1.5.0 → diff-lcs-1.5.1}/spec/fixtures/old-chef2 +0 -0
@@ -1,28 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
|
-
describe Diff::LCS,
|
5
|
+
describe Diff::LCS, ".diff" do
|
6
6
|
include Diff::LCS::SpecHelper::Matchers
|
7
7
|
|
8
|
-
it
|
8
|
+
it "correctly diffs seq1 to seq2" do
|
9
9
|
diff_s1_s2 = Diff::LCS.diff(seq1, seq2)
|
10
10
|
expect(change_diff(correct_forward_diff)).to eq(diff_s1_s2)
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
13
|
+
it "correctly diffs seq2 to seq1" do
|
14
14
|
diff_s2_s1 = Diff::LCS.diff(seq2, seq1)
|
15
15
|
expect(change_diff(correct_backward_diff)).to eq(diff_s2_s1)
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
18
|
+
it "correctly diffs against an empty sequence" do
|
19
19
|
diff = Diff::LCS.diff(word_sequence, [])
|
20
20
|
correct_diff = [
|
21
21
|
[
|
22
|
-
[
|
23
|
-
[
|
24
|
-
[
|
25
|
-
[
|
22
|
+
["-", 0, "abcd"],
|
23
|
+
["-", 1, "efgh"],
|
24
|
+
["-", 2, "ijkl"],
|
25
|
+
["-", 3, "mnopqrstuvwxyz"]
|
26
26
|
]
|
27
27
|
]
|
28
28
|
|
@@ -30,22 +30,22 @@ describe Diff::LCS, '.diff' do
|
|
30
30
|
|
31
31
|
diff = Diff::LCS.diff([], word_sequence)
|
32
32
|
correct_diff.each do |hunk|
|
33
|
-
hunk.each
|
33
|
+
hunk.each { |change| change[0] = "+" }
|
34
34
|
end
|
35
35
|
expect(change_diff(correct_diff)).to eq(diff)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "correctly diffs 'xx' and 'xaxb'" do
|
39
|
-
left =
|
40
|
-
right =
|
39
|
+
left = "xx"
|
40
|
+
right = "xaxb"
|
41
41
|
expect(Diff::LCS.patch(left, Diff::LCS.diff(left, right))).to eq(right)
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
44
|
+
it "returns an empty diff with (hello, hello)" do
|
45
45
|
expect(Diff::LCS.diff(hello, hello)).to be_empty
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it "returns an empty diff with (hello_ary, hello_ary)" do
|
49
49
|
expect(Diff::LCS.diff(hello_ary, hello_ary)).to be_empty
|
50
50
|
end
|
51
51
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
if String.method_defined?(:encoding)
|
6
|
-
require
|
6
|
+
require "diff/lcs/hunk"
|
7
7
|
|
8
8
|
describe Diff::LCS::Hunk do
|
9
|
-
let(:old_data) { [
|
10
|
-
let(:new_data) { [
|
11
|
-
let(:pieces)
|
12
|
-
let(:hunk)
|
9
|
+
let(:old_data) { ["Tu a un carté avec {count} itéms".encode("UTF-16LE")] }
|
10
|
+
let(:new_data) { ["Tu a un carte avec {count} items".encode("UTF-16LE")] }
|
11
|
+
let(:pieces) { Diff::LCS.diff old_data, new_data }
|
12
|
+
let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) }
|
13
13
|
|
14
|
-
it
|
15
|
-
expected = <<-EXPECTED.gsub(/^\s+/,
|
14
|
+
it "produces a unified diff from the two pieces" do
|
15
|
+
expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
|
16
16
|
@@ -1 +1 @@
|
17
17
|
-Tu a un carté avec {count} itéms
|
18
18
|
+Tu a un carte avec {count} items
|
@@ -21,8 +21,8 @@ if String.method_defined?(:encoding)
|
|
21
21
|
expect(hunk.diff(:unified)).to eq(expected)
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
25
|
-
expected = <<-EXPECTED.gsub(/^\s+/,
|
24
|
+
it "produces a unified diff from the two pieces (last entry)" do
|
25
|
+
expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
|
26
26
|
@@ -1 +1 @@
|
27
27
|
-Tu a un carté avec {count} itéms
|
28
28
|
+Tu a un carte avec {count} items
|
@@ -32,8 +32,8 @@ if String.method_defined?(:encoding)
|
|
32
32
|
expect(hunk.diff(:unified, true)).to eq(expected)
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
36
|
-
expected = <<-EXPECTED.gsub(/^\s+/,
|
35
|
+
it "produces a context diff from the two pieces" do
|
36
|
+
expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
|
37
37
|
***************
|
38
38
|
*** 1 ****
|
39
39
|
! Tu a un carté avec {count} itéms
|
@@ -44,8 +44,8 @@ if String.method_defined?(:encoding)
|
|
44
44
|
expect(hunk.diff(:context)).to eq(expected)
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
48
|
-
expected = <<-EXPECTED.gsub(/^ +/,
|
47
|
+
it "produces an old diff from the two pieces" do
|
48
|
+
expected = <<-EXPECTED.gsub(/^ +/, "").encode("UTF-16LE").chomp
|
49
49
|
1c1
|
50
50
|
< Tu a un carté avec {count} itéms
|
51
51
|
---
|
@@ -56,8 +56,8 @@ if String.method_defined?(:encoding)
|
|
56
56
|
expect(hunk.diff(:old)).to eq(expected)
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
60
|
-
expected = <<-EXPECTED.gsub(/^ +/,
|
59
|
+
it "produces a reverse ed diff from the two pieces" do
|
60
|
+
expected = <<-EXPECTED.gsub(/^ +/, "").encode("UTF-16LE").chomp
|
61
61
|
c1
|
62
62
|
Tu a un carte avec {count} items
|
63
63
|
.
|
@@ -67,11 +67,11 @@ if String.method_defined?(:encoding)
|
|
67
67
|
expect(hunk.diff(:reverse_ed)).to eq(expected)
|
68
68
|
end
|
69
69
|
|
70
|
-
context
|
70
|
+
context "with empty first data set" do
|
71
71
|
let(:old_data) { [] }
|
72
72
|
|
73
|
-
it
|
74
|
-
expected = <<-EXPECTED.gsub(/^\s+/,
|
73
|
+
it "produces a unified diff" do
|
74
|
+
expected = <<-EXPECTED.gsub(/^\s+/, "").encode("UTF-16LE").chomp
|
75
75
|
@@ -1 +1,2 @@
|
76
76
|
+Tu a un carte avec {count} items
|
77
77
|
EXPECTED
|
@@ -0,0 +1,160 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
require "diff/lcs/hunk"
|
5
|
+
|
6
|
+
describe "Diff::LCS Issues" do
|
7
|
+
include Diff::LCS::SpecHelper::Matchers
|
8
|
+
|
9
|
+
describe "issue #1" do
|
10
|
+
shared_examples "handles simple diffs" do |s1, s2, forward_diff|
|
11
|
+
before do
|
12
|
+
@diff_s1_s2 = Diff::LCS.diff(s1, s2)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "creates the correct diff" do
|
16
|
+
expect(change_diff(forward_diff)).to eq(@diff_s1_s2)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "creates the correct patch s1->s2" do
|
20
|
+
expect(Diff::LCS.patch(s1, @diff_s1_s2)).to eq(s2)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "creates the correct patch s2->s1" do
|
24
|
+
expect(Diff::LCS.patch(s2, @diff_s1_s2)).to eq(s1)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "string" do
|
29
|
+
it_has_behavior "handles simple diffs", "aX", "bXaX", [
|
30
|
+
[
|
31
|
+
["+", 0, "b"],
|
32
|
+
["+", 1, "X"]
|
33
|
+
]
|
34
|
+
]
|
35
|
+
it_has_behavior "handles simple diffs", "bXaX", "aX", [
|
36
|
+
[
|
37
|
+
["-", 0, "b"],
|
38
|
+
["-", 1, "X"]
|
39
|
+
]
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "array" do
|
44
|
+
it_has_behavior "handles simple diffs", %w[a X], %w[b X a X], [
|
45
|
+
[
|
46
|
+
["+", 0, "b"],
|
47
|
+
["+", 1, "X"]
|
48
|
+
]
|
49
|
+
]
|
50
|
+
it_has_behavior "handles simple diffs", %w[b X a X], %w[a X], [
|
51
|
+
[
|
52
|
+
["-", 0, "b"],
|
53
|
+
["-", 1, "X"]
|
54
|
+
]
|
55
|
+
]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "issue #57" do
|
60
|
+
it "should fail with a correct error" do
|
61
|
+
# standard:disable Style/HashSyntax
|
62
|
+
expect {
|
63
|
+
actual = {:category => "app.rack.request"}
|
64
|
+
expected = {:category => "rack.middleware", :title => "Anonymous Middleware"}
|
65
|
+
expect(actual).to eq(expected)
|
66
|
+
}.to raise_error(RSpec::Expectations::ExpectationNotMetError)
|
67
|
+
# standard:enable Style/HashSyntax
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "issue #60" do
|
72
|
+
it "should produce unified output with correct context" do
|
73
|
+
# standard:disable Layout/HeredocIndentation
|
74
|
+
old_data = <<-DATA_OLD.strip.split("\n").map(&:chomp)
|
75
|
+
{
|
76
|
+
"name": "x",
|
77
|
+
"description": "hi"
|
78
|
+
}
|
79
|
+
DATA_OLD
|
80
|
+
|
81
|
+
new_data = <<-DATA_NEW.strip.split("\n").map(&:chomp)
|
82
|
+
{
|
83
|
+
"name": "x",
|
84
|
+
"description": "lo"
|
85
|
+
}
|
86
|
+
DATA_NEW
|
87
|
+
|
88
|
+
diff = ::Diff::LCS.diff(old_data, new_data)
|
89
|
+
hunk = ::Diff::LCS::Hunk.new(old_data, new_data, diff.first, 3, 0)
|
90
|
+
|
91
|
+
expect(hunk.diff(:unified)).to eq(<<-EXPECTED.chomp)
|
92
|
+
@@ -1,5 +1,5 @@
|
93
|
+
{
|
94
|
+
"name": "x",
|
95
|
+
- "description": "hi"
|
96
|
+
+ "description": "lo"
|
97
|
+
}
|
98
|
+
EXPECTED
|
99
|
+
# standard:enable Layout/HeredocIndentation
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "issue #65" do
|
104
|
+
def diff_lines(old_lines, new_lines)
|
105
|
+
file_length_difference = 0
|
106
|
+
previous_hunk = nil
|
107
|
+
output = []
|
108
|
+
|
109
|
+
Diff::LCS.diff(old_lines, new_lines).each do |piece|
|
110
|
+
hunk = Diff::LCS::Hunk.new(old_lines, new_lines, piece, 3, file_length_difference)
|
111
|
+
file_length_difference = hunk.file_length_difference
|
112
|
+
maybe_contiguous_hunks = previous_hunk.nil? || hunk.merge(previous_hunk)
|
113
|
+
|
114
|
+
output << "#{previous_hunk.diff(:unified)}\n" unless maybe_contiguous_hunks
|
115
|
+
|
116
|
+
previous_hunk = hunk
|
117
|
+
end
|
118
|
+
output << "#{previous_hunk.diff(:unified, true)}\n" unless previous_hunk.nil?
|
119
|
+
output.join
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should not misplace the new chunk" do
|
123
|
+
old_data = [
|
124
|
+
"recipe[a::default]", "recipe[b::default]", "recipe[c::default]",
|
125
|
+
"recipe[d::default]", "recipe[e::default]", "recipe[f::default]",
|
126
|
+
"recipe[g::default]", "recipe[h::default]", "recipe[i::default]",
|
127
|
+
"recipe[j::default]", "recipe[k::default]", "recipe[l::default]",
|
128
|
+
"recipe[m::default]", "recipe[n::default]"
|
129
|
+
]
|
130
|
+
|
131
|
+
new_data = [
|
132
|
+
"recipe[a::default]", "recipe[c::default]", "recipe[d::default]",
|
133
|
+
"recipe[e::default]", "recipe[f::default]", "recipe[g::default]",
|
134
|
+
"recipe[h::default]", "recipe[i::default]", "recipe[j::default]",
|
135
|
+
"recipe[k::default]", "recipe[l::default]", "recipe[m::default]",
|
136
|
+
"recipe[n::default]", "recipe[o::new]", "recipe[p::new]",
|
137
|
+
"recipe[q::new]", "recipe[r::new]"
|
138
|
+
]
|
139
|
+
|
140
|
+
# standard:disable Layout/HeredocIndentation
|
141
|
+
expect(diff_lines(old_data, new_data)).to eq(<<-EODIFF)
|
142
|
+
@@ -1,5 +1,4 @@
|
143
|
+
recipe[a::default]
|
144
|
+
-recipe[b::default]
|
145
|
+
recipe[c::default]
|
146
|
+
recipe[d::default]
|
147
|
+
recipe[e::default]
|
148
|
+
@@ -12,3 +11,7 @@
|
149
|
+
recipe[l::default]
|
150
|
+
recipe[m::default]
|
151
|
+
recipe[n::default]
|
152
|
+
+recipe[o::new]
|
153
|
+
+recipe[p::new]
|
154
|
+
+recipe[q::new]
|
155
|
+
+recipe[r::new]
|
156
|
+
EODIFF
|
157
|
+
# standard:enable Layout/HeredocIndentation
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
|
-
describe Diff::LCS::Internals,
|
5
|
+
describe Diff::LCS::Internals, ".lcs" do
|
6
6
|
include Diff::LCS::SpecHelper::Matchers
|
7
7
|
|
8
|
-
it
|
8
|
+
it "returns a meaningful LCS array with (seq1, seq2)" do
|
9
9
|
res = Diff::LCS::Internals.lcs(seq1, seq2)
|
10
10
|
# The result of the LCS (less the +nil+ values) must be as long as the
|
11
11
|
# correct result.
|
@@ -20,37 +20,37 @@ describe Diff::LCS::Internals, '.lcs' do
|
|
20
20
|
expect(x_seq2).to eq(correct_lcs)
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
23
|
+
it "returns all indexes with (hello, hello)" do
|
24
24
|
expect(Diff::LCS::Internals.lcs(hello, hello)).to \
|
25
25
|
eq((0...hello.size).to_a)
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
28
|
+
it "returns all indexes with (hello_ary, hello_ary)" do
|
29
29
|
expect(Diff::LCS::Internals.lcs(hello_ary, hello_ary)).to \
|
30
30
|
eq((0...hello_ary.size).to_a)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe Diff::LCS,
|
34
|
+
describe Diff::LCS, ".LCS" do
|
35
35
|
include Diff::LCS::SpecHelper::Matchers
|
36
36
|
|
37
|
-
it
|
37
|
+
it "returns the correct compacted values from Diff::LCS.LCS" do
|
38
38
|
res = Diff::LCS.LCS(seq1, seq2)
|
39
39
|
expect(res).to eq(correct_lcs)
|
40
40
|
expect(res.compact).to eq(res)
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
43
|
+
it "is transitive" do
|
44
44
|
res = Diff::LCS.LCS(seq2, seq1)
|
45
45
|
expect(res).to eq(correct_lcs)
|
46
46
|
expect(res.compact).to eq(res)
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
50
|
-
expect(Diff::LCS.LCS(hello, hello)).to eq(hello.
|
49
|
+
it "returns %W(h e l l o) with (hello, hello)" do
|
50
|
+
expect(Diff::LCS.LCS(hello, hello)).to eq(hello.chars)
|
51
51
|
end
|
52
52
|
|
53
|
-
it
|
53
|
+
it "returns hello_ary with (hello_ary, hello_ary)" do
|
54
54
|
expect(Diff::LCS.LCS(hello_ary, hello_ary)).to eq(hello_ary)
|
55
55
|
end
|
56
56
|
end
|
@@ -1,29 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
|
-
RSpec.describe
|
5
|
+
RSpec.describe "bin/ldiff" do
|
6
6
|
include CaptureSubprocessIO
|
7
7
|
|
8
|
+
# standard:disable Style/HashSyntax
|
8
9
|
fixtures = [
|
9
|
-
{
|
10
|
-
{
|
11
|
-
{
|
12
|
-
].product([nil,
|
10
|
+
{:name => "output.diff", :left => "aX", :right => "bXaX"},
|
11
|
+
{:name => "output.diff.chef", :left => "old-chef", :right => "new-chef"},
|
12
|
+
{:name => "output.diff.chef2", :left => "old-chef2", :right => "new-chef2"}
|
13
|
+
].product([nil, "-e", "-f", "-c", "-u"]).map { |(fixture, flag)|
|
13
14
|
fixture = fixture.dup
|
14
15
|
fixture[:flag] = flag
|
15
16
|
fixture
|
16
17
|
}
|
18
|
+
# standard:enable Style/HashSyntax
|
17
19
|
|
18
20
|
def self.test_ldiff(fixture)
|
19
21
|
desc = [
|
20
22
|
fixture[:flag],
|
21
23
|
"spec/fixtures/#{fixture[:left]}",
|
22
24
|
"spec/fixtures/#{fixture[:right]}",
|
23
|
-
|
24
|
-
|
25
|
+
"#",
|
26
|
+
"=>",
|
25
27
|
"spec/fixtures/ldiff/#{fixture[:name]}#{fixture[:flag]}"
|
26
|
-
].join(
|
28
|
+
].join(" ")
|
27
29
|
|
28
30
|
it desc do
|
29
31
|
expect(run_ldiff(fixture)).to eq(read_fixture(fixture))
|
@@ -45,7 +47,7 @@ RSpec.describe 'bin/ldiff' do
|
|
45
47
|
def clean_data(data, flag)
|
46
48
|
data =
|
47
49
|
case flag
|
48
|
-
when
|
50
|
+
when "-c", "-u"
|
49
51
|
clean_output_timestamp(data)
|
50
52
|
else
|
51
53
|
data
|
@@ -80,7 +82,7 @@ RSpec.describe 'bin/ldiff' do
|
|
80
82
|
system("ruby -Ilib bin/ldiff #{flag} spec/fixtures/#{left} spec/fixtures/#{right}")
|
81
83
|
end
|
82
84
|
|
83
|
-
expect(stderr).to be_empty if RUBY_VERSION >=
|
85
|
+
expect(stderr).to be_empty if RUBY_VERSION >= "1.9"
|
84
86
|
expect(stdout).not_to be_empty
|
85
87
|
clean_data(stdout, flag)
|
86
88
|
end
|