plugin.rb in danger-spec_postfix-0.0.1 vs plugin.rb in danger-spec_postfix-0.0.2
- old
+ new
@@ -28,13 +28,13 @@
yield configuration
end
def lint
changed_files.select { |f| f.match?(%r{^spec/.*rb$}) }
- .reject { |f| f.end_with?('_spec.rb') }
- .reject { |f| DangerSpecPostfix.configuration.exceptions.any? { |e| f.start_with?(e) } }
- .each { |f| warn(warning_generator(f)) }
+ .reject { |f| f.end_with?('_spec.rb') }
+ .reject { |f| DangerSpecPostfix.configuration.exceptions.any? { |e| f.start_with?(e) } }
+ .each { |f| warn(warning_generator(f)) }
end
private
def changed_files
@@ -44,11 +44,15 @@
def warning_generator(file)
"Tests should have `_spec` postfix: #{file}"
end
end
- class DangerSpecPostfix::Configuration
- include ::ActiveSupport::Configurable
+ class DangerSpecPostfix
+ class Configuration
+ include ::ActiveSupport::Configurable
- config_accessor(:exceptions) { ['spec/shared_examples/', 'spec/factories/', 'spec/support/', 'spec/rails_helper.rb', 'spec/spec_helper.rb'] }
+ config_accessor(:exceptions) do
+ ['spec/shared_examples/', 'spec/factories/', 'spec/support/', 'spec/rails_helper.rb', 'spec/spec_helper.rb']
+ end
+ end
end
end