Class: Reek::Spec::ShouldReek
- Inherits:
-
Object
- Object
- Reek::Spec::ShouldReek
- Defined in:
- lib/reek/spec/should_reek.rb
Overview
An rspec matcher that matches when the actual
has code smells.
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
private
Returns the value of attribute configuration.
-
#examiner ⇒ Object
private
Returns the value of attribute examiner.
Instance Method Summary collapse
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(configuration: Configuration::AppConfiguration.default) ⇒ ShouldReek
constructor
A new instance of ShouldReek.
- #matches?(source) ⇒ Boolean
Constructor Details
#initialize(configuration: Configuration::AppConfiguration.default) ⇒ ShouldReek
Returns a new instance of ShouldReek.
12 13 14 |
# File 'lib/reek/spec/should_reek.rb', line 12 def initialize(configuration: Configuration::AppConfiguration.default) @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object (readonly, private)
Returns the value of attribute configuration.
32 33 34 |
# File 'lib/reek/spec/should_reek.rb', line 32 def configuration @configuration end |
#examiner ⇒ Object (private)
Returns the value of attribute examiner.
33 34 35 |
# File 'lib/reek/spec/should_reek.rb', line 33 def examiner @examiner end |
Instance Method Details
#failure_message ⇒ Object
21 22 23 |
# File 'lib/reek/spec/should_reek.rb', line 21 def "Expected #{examiner.description} to reek, but it didn't" end |
#failure_message_when_negated ⇒ Object
25 26 27 28 |
# File 'lib/reek/spec/should_reek.rb', line 25 def rpt = Report::SimpleWarningFormatter.new.format_list(examiner.smells) "Expected no smells, but got:\n#{rpt}" end |