instiki/vendor/plugins/bundler/gems/bundler-1.0.15/spec/quality_spec.rb
Jacques Distler 9e909d5be3 Update Rails, rails_xss and Bundler
Update Bundler to 1.0.15.
Update Rails to 2.3.12.
Update rails_xss plugin.

The latter two were the
source of a considerable
amount of grief, as rails_xss
is now MUCH stricter about what
string methods can be used.

Also made it possible to use
rake 0.9.x with Instiki. But
you probably REALLY want to use

 ruby bundle exec rake ...

instead of just saying

 rake ....
2011-06-15 00:43:38 -05:00

59 lines
1.5 KiB
Ruby

require "spec_helper"
describe "The library itself" do
def check_for_tab_characters(filename)
failing_lines = []
File.readlines(filename).each_with_index do |line,number|
failing_lines << number + 1 if line =~ /\t/
end
unless failing_lines.empty?
"#{filename} has tab characters on lines #{failing_lines.join(', ')}"
end
end
def check_for_extra_spaces(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
unless failing_lines.empty?
"#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}"
end
end
RSpec::Matchers.define :be_well_formed do
failure_message_for_should do |actual|
actual.join("\n")
end
match do |actual|
actual.empty?
end
end
it "has no malformed whitespace" do
error_messages = []
Dir.chdir(File.expand_path("../..", __FILE__)) do
`git ls-files`.split("\n").each do |filename|
next if filename =~ /\.gitmodules|fixtures/
error_messages << check_for_tab_characters(filename)
error_messages << check_for_extra_spaces(filename)
end
end
error_messages.compact.should be_well_formed
end
it "can still be built" do
Dir.chdir(root) do
`gem build bundler.gemspec`
$?.should eq(0)
# clean up the .gem generated
system("rm bundler-#{Bundler::VERSION}.gem")
end
end
end