Skip to content

Commit

Permalink
Add validation to check that a podspec's name doesn't contain whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
joshkalpin committed Nov 19, 2013
1 parent 5212432 commit 2f06d53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/cocoapods-core/specification/linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ def _validate_name(n)
unless names_match
error "The name of the spec should match the name of the file."
end

if spec.root.name =~ /\s/
error "The name of a spec should not contain whitespace."
end
end
end

Expand Down
7 changes: 7 additions & 0 deletions spec/specification/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ def message_should_include(*values)
message_should_include('name', 'match')
end

it "fails a specification whose name contains whitespace" do
@spec.stubs(:name).returns('bad name')
@linter.lint
@linter.results.count.should == 2
@linter.results[2].message.should.match /should not contain whitespace/
end

#------------------#

it "checks that the version has been specified" do
Expand Down

0 comments on commit 2f06d53

Please sign in to comment.