Class: Reek::Spec::ShouldReekOf

Inherits:
Object
  • Object
show all
Includes:
ReekMatcher
Defined in:
lib/reek/adapters/spec.rb

Overview

:nodoc:

Direct Known Subclasses

ShouldReekOnlyOf

Instance Method Summary collapse

Methods included from ReekMatcher

#report

Constructor Details

#initialize(klass, patterns) ⇒ ShouldReekOf

Returns a new instance of ShouldReekOf.



70
71
72
73
# File 'lib/reek/adapters/spec.rb', line 70

def initialize(klass, patterns)
  @klass = klass
  @patterns = patterns
end

Instance Method Details

#failure_message_for_shouldObject



78
79
80
# File 'lib/reek/adapters/spec.rb', line 78

def failure_message_for_should
  "Expected #{@sniffer.desc} to reek of #{@klass}, but it didn't"
end

#failure_message_for_should_notObject



81
82
83
# File 'lib/reek/adapters/spec.rb', line 81

def failure_message_for_should_not
  "Expected #{@sniffer.desc} not to reek of #{@klass}, but got:\n#{report}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
77
# File 'lib/reek/adapters/spec.rb', line 74

def matches?(actual)
  @sniffer = actual.sniff
  @sniffer.has_smell?(@klass, @patterns)
end