Class: Reek::Spec::ShouldReekOf Private
- Inherits:
-
Object
- Object
- Reek::Spec::ShouldReekOf
- Defined in:
- lib/reek/spec/should_reek_of.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
An rspec matcher that matches when the actual
has the specified code smell.
Direct Known Subclasses
Instance Method Summary collapse
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
-
#initialize(smell_category, smell_details = {}) ⇒ ShouldReekOf
constructor
private
A new instance of ShouldReekOf.
- #matches?(actual) ⇒ Boolean private
Constructor Details
#initialize(smell_category, smell_details = {}) ⇒ ShouldReekOf
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ShouldReekOf.
11 12 13 14 |
# File 'lib/reek/spec/should_reek_of.rb', line 11 def initialize(smell_category, smell_details = {}) @smell_category = normalize smell_category @smell_details = smell_details end |
Instance Method Details
#failure_message ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/reek/spec/should_reek_of.rb', line 22 def "Expected #{@examiner.description} to reek of #{@smell_category}, but it didn't" end |
#failure_message_when_negated ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/reek/spec/should_reek_of.rb', line 26 def "Expected #{@examiner.description} not to reek of #{@smell_category}, but it did" end |
#matches?(actual) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 |
# File 'lib/reek/spec/should_reek_of.rb', line 16 def matches?(actual) @examiner = Examiner.new(actual) @all_smells = @examiner.smells @all_smells.any? { |warning| warning.matches?(@smell_category, @smell_details) } end |