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: b6c38322e782230d1ef5e12c31808dbadeb564fe452bd91df5a65518fb809e95
4
- data.tar.gz: e650a0d48a4c4785a2abdf83ad18985eeebf698a417381eb16547ebb84aeaa93
3
+ metadata.gz: 65da887b73e5fabab1db09457461a5579fd2bb42471e5f6880d09641c68acb5c
4
+ data.tar.gz: 4b29c00670d32ee28010f07ad31d88590d128a61c48aa4ca814b95a5335ed2d6
5
5
  SHA512:
6
- metadata.gz: aa6d3ac40c49e0ad9be1b03d72384c43c825befb840c966462aca21118a7a69d9105dab2998ae8669ec79cce7a7ace5826a23e6e451845ed457ffeffb5511247
7
- data.tar.gz: 3072a1d8d189c2ccf6d6791d9490773893e37e88cf2395e735d31d486bbd4d98de3e2630661bcc39d93d05453af4c17b38fa24679f9b6be49e503bfda8ad222f
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
@@ -1,3 +1,3 @@
1
1
  class CompareLinker
2
- VERSION = "1.4.1"
2
+ VERSION = "1.4.2"
3
3
  end
@@ -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)' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compare_linker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kensuke Nagae