Class: Reek::Spec::ShouldReekOnlyOf Private
- Inherits:
-
ShouldReekOf
- Object
- ShouldReekOf
- Reek::Spec::ShouldReekOnlyOf
- Defined in:
- lib/reek/spec/should_reek_only_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 and no others.
Instance Method Summary collapse
- #failure_message ⇒ Object private
- #failure_message_when_negated ⇒ Object private
- #matches?(actual) ⇒ Boolean private
- #matches_examiner?(examiner) ⇒ Boolean private
Methods inherited from ShouldReekOf
Constructor Details
This class inherits a constructor from Reek::Spec::ShouldReekOf
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.
23 24 25 26 |
# File 'lib/reek/spec/should_reek_only_of.rb', line 23 def rpt = Report::Formatter.format_list(@warnings) "Expected #{@examiner.description} to reek only of #{@smell_category}, but got:\n#{rpt}" 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.
28 29 30 |
# File 'lib/reek/spec/should_reek_only_of.rb', line 28 def "Expected #{@examiner.description} not to reek only 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.
12 13 14 |
# File 'lib/reek/spec/should_reek_only_of.rb', line 12 def matches?(actual) matches_examiner?(Examiner.new(actual)) end |
#matches_examiner?(examiner) ⇒ 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 21 |
# File 'lib/reek/spec/should_reek_only_of.rb', line 16 def matches_examiner?(examiner) @examiner = examiner @warnings = @examiner.smells return false if @warnings.empty? @warnings.all? { |warning| warning.matches?(@smell_category) } end |