File: rails_spec.rb

package info (click to toggle)
ruby-rspec-rails 4.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,624 kB
  • sloc: ruby: 9,512; sh: 364; makefile: 6
file content (26 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (3)
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