Sha256: 6fa60e0a818e89ec8ca87ef32de0ac06eb661203916aebcd640f3f32eb5b9db0
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'examiner') module Reek module Spec # # An rspec matcher that matches when the +actual+ has the specified # code smell. # class ShouldReekOf # :nodoc: def initialize(klass, patterns) @klass = klass @patterns = patterns end def matches?(actual) @examiner = Examiner.new(actual) @all_smells = @examiner.all_active_smells @all_smells.any? {|warning| warning.matches?(@klass, @patterns)} end def failure_message_for_should "Expected #{@examiner.description} to reek of #{@klass}, but it didn't" end def failure_message_for_should_not "Expected #{@examiner.description} not to reek of #{@klass}, but it did" end end # # Checks the target source code for instances of +smell_class+, # and returns +true+ only if one of them has a report string matching # all of the +patterns+. # def reek_of(smell_class, *patterns) ShouldReekOf.new(smell_class, patterns) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-1.2.7.1 | lib/reek/spec/should_reek_of.rb |
reek-1.2.7 | lib/reek/spec/should_reek_of.rb |