Sha256: b35102d9fba12cd978f1c2657595b4dacc2490203005f44f96a3bdce75a27866
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
require 'reek/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.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
7 entries across 7 versions & 1 rubygems