compare_linker 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65da887b73e5fabab1db09457461a5579fd2bb42471e5f6880d09641c68acb5c
|
4
|
+
data.tar.gz: 4b29c00670d32ee28010f07ad31d88590d128a61c48aa4ca814b95a5335ed2d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01066c681a37b6b9368814a6653792ab7c77c2b917a12e20b83fb40b74ff2f5cc29f9c0f6b5fa96ead45737d8f176ef8df081486f87b9cb007539e4658a16e84
|
7
|
+
data.tar.gz: 7fcdf4d543eb414a30e2bcaeae80863917c282a28b55adcb6cf553d48f8c8b4588abc8727fa31eb9141b1613ff2cc8d9579867655eab462625bdf85bf5e9f7dd
|
@@ -18,9 +18,9 @@ class CompareLinker
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def downgrade?(old_ver, new_ver, old_tag, new_tag, old_rev, new_rev)
|
21
|
-
Gem::Version.new(new_ver) < Gem::Version.new(old_ver) ||
|
22
|
-
(old_tag && new_tag && Gem::Version.new(to_ver(new_tag)) < Gem::Version.new(to_ver(old_tag))) ||
|
23
|
-
(old_rev && new_rev && Gem::Version.new(to_ver(new_rev)) < Gem::Version.new(to_ver(old_rev)))
|
21
|
+
(old_ver && new_ver && (Gem::Version.new(new_ver) < Gem::Version.new(old_ver))) ||
|
22
|
+
(old_tag && new_tag && (Gem::Version.new(to_ver(new_tag)) < Gem::Version.new(to_ver(old_tag)))) ||
|
23
|
+
(old_rev && new_rev && (Gem::Version.new(to_ver(new_rev)) < Gem::Version.new(to_ver(old_rev))))
|
24
24
|
rescue ArgumentError # Gem::Version raise ArgumentError if it is invalid as version
|
25
25
|
false
|
26
26
|
end
|
data/spec/factories/gem_info.rb
CHANGED
@@ -143,6 +143,31 @@ FactoryGirl.define do
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
+
factory :g_invalid_version__old_rev__new_rev do
|
147
|
+
defaults = {
|
148
|
+
owner: 'sds',
|
149
|
+
gem_name: 'slim-lint',
|
150
|
+
}
|
151
|
+
|
152
|
+
factory :g_upgrade__invalid_version__old_rev__new_rev do
|
153
|
+
initialize_with do
|
154
|
+
defaults.merge(
|
155
|
+
old_rev: '111e56fa5f4f75c03ad4043023232f7e972100d8',
|
156
|
+
new_rev: 'dc24a0900a4bd29209b812e9119f5bc6eb3eb649'
|
157
|
+
)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
factory :g_downgrade__invalid_version__old_rev__new_rev do
|
162
|
+
initialize_with do
|
163
|
+
defaults.merge(
|
164
|
+
old_rev: 'dc24a0900a4bd29209b812e9119f5bc6eb3eb649',
|
165
|
+
new_rev: '111e56fa5f4f75c03ad4043023232f7e972100d8'
|
166
|
+
)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
146
171
|
factory :g_else do
|
147
172
|
defaults = {
|
148
173
|
owner: nil,
|
@@ -31,6 +31,11 @@ describe CompareLinker::Formatter::Markdown do
|
|
31
31
|
it { is_expected.to eq '* [ ] [sfl](https://github.com/ujihisa/spawn-for-legacy): `2.2...2.3`' }
|
32
32
|
end
|
33
33
|
|
34
|
+
context 'given invalid version' do
|
35
|
+
let(:gem_info) { build(:g_upgrade__invalid_version__old_rev__new_rev) }
|
36
|
+
it { is_expected.to eq '* [ ] [slim-lint](https://github.com/sds/slim-lint): [`111e56fa5f4f75c03ad4043023232f7e972100d8...dc24a0900a4bd29209b812e9119f5bc6eb3eb649`](https://github.com/sds/slim-lint/compare/111e56fa5f4f75c03ad4043023232f7e972100d8...dc24a0900a4bd29209b812e9119f5bc6eb3eb649)' }
|
37
|
+
end
|
38
|
+
|
34
39
|
context 'given else' do
|
35
40
|
let(:gem_info) { build(:g_upgrade__else) }
|
36
41
|
it { is_expected.to eq '* [ ] json: (link not found) `1.8.1...1.8.2`' }
|
@@ -64,6 +69,11 @@ describe CompareLinker::Formatter::Markdown do
|
|
64
69
|
it { is_expected.to eq '* [ ] [sfl](https://github.com/ujihisa/spawn-for-legacy): `2.3...2.2` (downgrade)' }
|
65
70
|
end
|
66
71
|
|
72
|
+
context 'given invalid version' do
|
73
|
+
let(:gem_info) { build(:g_downgrade__invalid_version__old_rev__new_rev) }
|
74
|
+
it { is_expected.to eq '* [ ] [slim-lint](https://github.com/sds/slim-lint): [`dc24a0900a4bd29209b812e9119f5bc6eb3eb649...111e56fa5f4f75c03ad4043023232f7e972100d8`](https://github.com/sds/slim-lint/compare/dc24a0900a4bd29209b812e9119f5bc6eb3eb649...111e56fa5f4f75c03ad4043023232f7e972100d8)' }
|
75
|
+
end
|
76
|
+
|
67
77
|
context 'given else' do
|
68
78
|
let(:gem_info) { build(:g_downgrade__else) }
|
69
79
|
it { is_expected.to eq '* [ ] json: (link not found) `1.8.2...1.8.1` (downgrade)' }
|
@@ -31,6 +31,11 @@ describe CompareLinker::Formatter::Text do
|
|
31
31
|
it { is_expected.to eq 'sfl: https://github.com/ujihisa/spawn-for-legacy 2.2...2.3' }
|
32
32
|
end
|
33
33
|
|
34
|
+
context 'given invalid version' do
|
35
|
+
let(:gem_info) { build(:g_upgrade__invalid_version__old_rev__new_rev) }
|
36
|
+
it { is_expected.to eq 'slim-lint: https://github.com/sds/slim-lint/compare/111e56fa5f4f75c03ad4043023232f7e972100d8...dc24a0900a4bd29209b812e9119f5bc6eb3eb649' }
|
37
|
+
end
|
38
|
+
|
34
39
|
context 'given else' do
|
35
40
|
let(:gem_info) { build(:g_upgrade__else) }
|
36
41
|
it { is_expected.to eq 'json (link not found): 1.8.1...1.8.2' }
|
@@ -64,6 +69,10 @@ describe CompareLinker::Formatter::Text do
|
|
64
69
|
it { is_expected.to eq 'sfl: https://github.com/ujihisa/spawn-for-legacy 2.3...2.2 (downgrade)' }
|
65
70
|
end
|
66
71
|
|
72
|
+
context 'given invalid version' do
|
73
|
+
let(:gem_info) { build(:g_downgrade__invalid_version__old_rev__new_rev) }
|
74
|
+
it { is_expected.to eq 'slim-lint: https://github.com/sds/slim-lint/compare/dc24a0900a4bd29209b812e9119f5bc6eb3eb649...111e56fa5f4f75c03ad4043023232f7e972100d8' }
|
75
|
+
end
|
67
76
|
context 'given else' do
|
68
77
|
let(:gem_info) { build(:g_downgrade__else) }
|
69
78
|
it { is_expected.to eq 'json (link not found): 1.8.2...1.8.1 (downgrade)' }
|