Skip to content

Commit

Permalink
[Specification::Linter] Disallow slashes in spec names
Browse files Browse the repository at this point in the history
  • Loading branch information
mrackwitz committed Apr 7, 2015
1 parent ed08d80 commit f0ce915
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/cocoapods-core/specification/linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ def validate_name
'name of the file.')
end

if spec.name =~ /\//
results.add_error('name', 'The name of a spec should not contain ' \
'a slash.')
end

if spec.root.name =~ /\s/
results.add_error('name', 'The name of a spec should not contain ' \
'whitespace.')
Expand Down
5 changes: 5 additions & 0 deletions spec/specification/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ def result_should_include(*values)
result_should_include('name', 'whitespace')
end

it 'fails a specification whose name contains a slash' do
@spec.stubs(:name).returns('BananaKit/BananaFruit')
result_should_include('name', 'slash')
end

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

it 'fails a specification whose authors are the default' do
Expand Down

0 comments on commit f0ce915

Please sign in to comment.