diff --git a/lib/cocoapods-core/specification/linter.rb b/lib/cocoapods-core/specification/linter.rb index f13c7d2b3..cdf168313 100644 --- a/lib/cocoapods-core/specification/linter.rb +++ b/lib/cocoapods-core/specification/linter.rb @@ -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 diff --git a/spec/specification/linter_spec.rb b/spec/specification/linter_spec.rb index 261caab73..6586ec691 100644 --- a/spec/specification/linter_spec.rb +++ b/spec/specification/linter_spec.rb @@ -43,7 +43,7 @@ module Pod before do fixture_path = 'spec-repos/test_repo/Specs/BananaLib/1.0/BananaLib.podspec' - podspec_path = fixture(fixture_path) + @podspec_path = fixture(fixture_path) @linter = Specification::Linter.new(@podspec_path) end @@ -95,13 +95,16 @@ module Pod def message_should_include(*values) @linter.lint - result = @linter.results.first - result.should.not.be.nil - @linter.results.map(&:message).should == [result.message] - message = result.message.downcase - values.each do |value| - message.should.include(value.downcase) + results = @linter.results + results.should.not.be.nil + + matched = results.select do |result| + values.all? do |value| + result.message.downcase.include?(value.downcase) + end end + + matched.size.should == 1 end #------------------# @@ -135,6 +138,11 @@ 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') + message_should_include('name', 'whitespace') + end + #------------------# it "checks that the version has been specified" do