Class: Danger::DangerSpecPostfix

Inherits:
Plugin
  • Object
show all
Defined in:
lib/spec_postfix/plugin.rb

Overview

Lints the test files. Will fail if any has no ‘_spec’ postfix. Generates a ‘string` with warning.

Returns:

  • (void)

Instance Method Summary collapse

Instance Method Details

#lint(exceptions: []) ⇒ Object



13
14
15
16
17
18
# File 'lib/spec_postfix/plugin.rb', line 13

def lint(exceptions: [])
  changed_files.select { |f| f.match?(%r{^spec/.*rb$}) }
               .reject { |f| f.end_with?('_spec.rb') }
               .reject { |f| exceptions.any? { |e| f.start_with?(e) } }
               .each   { |f| warn(warning_generator(f)) }
end