Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linter] Allow version 0 to be used. #657

Merged
merged 1 commit into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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