Skip to content

Commit

Permalink
[Linter] Allow version 0 to be used.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Oct 22, 2020
1 parent 4982927 commit b1814be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

##### Enhancements

* None.
* Allow version `0` to be used.
[Eloy Durán](https://github.com/alloy)
[#657](https://github.com/CocoaPods/Core/pull/657)

##### Bug Fixes

Expand Down
3 changes: 0 additions & 3 deletions lib/cocoapods-core/specification/linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ def _validate_authors(a)
def _validate_version(v)
if v.to_s.empty?
results.add_error('version', 'A version is required.')
elsif v <= Version::ZERO
results.add_error('version', 'The version of the spec should be' \
' higher than 0.')
end
end

Expand Down
5 changes: 0 additions & 5 deletions spec/specification/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,6 @@ def result_should_include(*values)
result_should_include('version', 'required')
end

it 'checks the version is higher than 0' do
@spec.stubs(:version).returns(Pod::Version.new('0'))
result_should_include('version', '0')
end

it 'handles invalid version strings' do
@spec.stubs(:version).raises('Bad version')
result_ignore('attributes')
Expand Down
6 changes: 6 additions & 0 deletions spec/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ module Pod
version.to_s.should == '1.2.3'
end

it 'does not accept negative versions' do
should.raise ArgumentError do
Version.new('-1')
end
end

it 'identifies release versions' do
version = Version.new('1.0.0')
version.should.not.be.prerelease
Expand Down

0 comments on commit b1814be

Please sign in to comment.