This repository has been archived by the owner on Nov 10, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release 0.4.2 to work better on heroku cedar
- Loading branch information
Showing
4 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require File.dirname(__FILE__) + '/spec_helper' | ||
|
||
describe "The library itself" do | ||
Rspec::Matchers.define :have_no_tab_characters do | ||
match do |filename| | ||
@failing_lines = [] | ||
File.readlines(filename).each_with_index do |line,number| | ||
@failing_lines << number + 1 if line =~ /\t/ | ||
end | ||
@failing_lines.empty? | ||
end | ||
|
||
failure_message_for_should do |filename| | ||
"The file #{filename} has tab characters on lines #{@failing_lines.join(', ')}" | ||
end | ||
end | ||
|
||
Rspec::Matchers.define :have_no_extraneous_spaces do | ||
match do |filename| | ||
@failing_lines = [] | ||
File.readlines(filename).each_with_index do |line,number| | ||
next if line =~ /^\s+#.*\s+\n$/ | ||
@failing_lines << number + 1 if line =~ /\s+\n$/ | ||
end | ||
@failing_lines.empty? | ||
end | ||
|
||
failure_message_for_should do |filename| | ||
"The file #{filename} has spaces on the EOL on lines #{@failing_lines.join(', ')}" | ||
end | ||
end | ||
|
||
it "has no tab characters" do | ||
Dir.chdir(File.dirname(__FILE__) + '/..') do | ||
Dir.glob("./lib/**/*.rb").each do |filename| | ||
filename.should have_no_tab_characters | ||
filename.should have_no_extraneous_spaces | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters