Skip to content

Commit 610984d

Browse files
Resolve codenarc issues, tweak test names
1 parent b780621 commit 610984d

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

jruby-gradle-base-plugin/src/main/groovy/com/github/jrubygradle/internal/GemVersion.groovy

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,27 +169,13 @@ class GemVersion {
169169
return 1
170170
}
171171

172-
def aaObject
173-
def bbObject
174-
175172
if (aDigits[index].isInteger() && bDigits[index].isInteger()) {
176173
// compare them as number
177-
aaObject = aDigits[index] as int
178-
bbObject = bDigits[index] as int
174+
aDigits[index] as int <=> bDigits[index] as int
179175
}
180176
else {
181177
// compare them as string
182-
aaObject = aDigits[index]
183-
bbObject = bDigits[index]
184-
}
185-
if (aaObject < bbObject) {
186-
-1
187-
}
188-
else if (aaObject > bbObject) {
189-
1
190-
}
191-
else {
192-
0
178+
aDigits[index] <=> bDigits[index]
193179
}
194180
}
195181

jruby-gradle-base-plugin/src/test/groovy/com/github/jrubygradle/internal/GemVersionSpec.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,23 +179,23 @@ class GemVersionSpec extends Specification {
179179
subject.intersect('[1.2.4, 1.2.4]').conflict() == true
180180
}
181181

182-
def "passes non-integer version ranges with no conflicts"() {
182+
def "finds no conflicts in non-integer version ranges"() {
183183
given:
184184
GemVersion subject = new GemVersion('[1.2.bar, 1.2.foo]')
185185

186186
expect:
187187
!subject.conflict()
188188
}
189189

190-
def "fails non-integer version ranges with conflicts"() {
190+
def "finds conflicts in non-integer version ranges"() {
191191
given:
192192
GemVersion subject = new GemVersion('[1.2.foo, 1.2.bar]')
193193

194194
expect:
195195
subject.conflict()
196196
}
197197

198-
def "it does not throw an exception for a '+' version"() {
198+
def "does not throw an exception for a '+' version"() {
199199
when:
200200
new GemVersion('+').conflict()
201201

0 commit comments

Comments
 (0)