Skip to content

Commit

Permalink
Tests for comment detection behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
keith committed Mar 19, 2013
1 parent b028662 commit 8ec98e4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/specification/linter_spec.rb
Expand Up @@ -151,6 +151,27 @@ def message_should_include(*values)
@spec.stubs(:summary).returns('sample')
message_should_include('summary', 'punctuation')
end

it "checks to make sure there are not too many comments in the file" do
podspec = "# some comment\n" * 30
path = SpecHelper.temporary_directory + 'BananaLib.podspec'
FileUtils.cp @podspec_path, path
File.open(path, 'a') {|f| f.puts(podspec) }
linter = Specification::Linter.new(path)
linter.lint
linter.results.count.should == 1
linter.results.first.message.should.match /Comments must be deleted./
end

it "should not count #define's as comments" do
podspec = "#define\n" * 30
path = SpecHelper.temporary_directory + 'BananaLib.podspec'
FileUtils.cp @podspec_path, path
File.open(path, 'a') {|f| f.puts(podspec) }
linter = Specification::Linter.new(path)
linter.lint
linter.results.count.should == 0
end

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

Expand Down

0 comments on commit 8ec98e4

Please sign in to comment.