1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
require 'rspec/support/spec/library_wide_checks'
RSpec.describe "RSpec::Rails" do
include RSpec::Support::WhitespaceChecks
# Pasted from rspec-support lib/rspec/support/spec/library_wide_checks.rb:134
# Easier to do that here than to extract it out
RSpec::Matchers.define :be_well_formed do
match do |actual|
actual.empty?
end
failure_message do |actual|
actual.join("\n")
end
end
it "has no malformed whitespace", :slow do
error_messages = []
Dir.glob("**/*").select { |f| !(f =~ /^debian/) && File.file?(f)}.each do |filename|
error_messages << check_for_tab_characters(filename)
error_messages << check_for_extra_spaces(filename)
end
expect(error_messages.compact).to be_well_formed
end
end
|