Sha256: f1b98300b195b6fb78e24d432a1bb88cf3e618913508dd43cedbfaff7ec7e075
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
require_relative '../examiner' require_relative '../report/formatter' require_relative 'should_reek_of' module Reek module Spec # # An rspec matcher that matches when the +actual+ has the specified # code smell and no others. # class ShouldReekOnlyOf < ShouldReekOf def matches?(actual) matches_examiner?(Examiner.new(actual, configuration: configuration)) end def matches_examiner?(examiner) self.examiner = examiner self.warnings = examiner.smells return false if warnings.empty? warnings.all? { |warning| warning.matches?(smell_category) } end def failure_message rpt = Report::Formatter.format_list(warnings) "Expected #{examiner.description} to reek only of #{smell_category}, but got:\n#{rpt}" end def failure_message_when_negated "Expected #{examiner.description} not to reek only of #{smell_category}, but it did" end private private_attr_accessor :warnings end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reek-3.5.0 | lib/reek/spec/should_reek_only_of.rb |
reek-3.4.1 | lib/reek/spec/should_reek_only_of.rb |
reek-3.4.0 | lib/reek/spec/should_reek_only_of.rb |