Sha256: a4e729d6984c8071452ec548f4b86ee5c47c9819504f05f985d2bc97f838fa5e

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

require_relative '../examiner'
require_relative '../report/formatter'

module Reek
  module Spec
    #
    # An rspec matcher that matches when the +actual+ has code smells.
    #
    # @api private
    class ShouldReek
      def initialize(configuration = Configuration::AppConfiguration.new)
        @configuration = configuration
      end

      def matches?(actual)
        @examiner = Examiner.new(actual, configuration: @configuration)
        @examiner.smelly?
      end

      def failure_message
        "Expected #{@examiner.description} to reek, but it didn't"
      end

      def failure_message_when_negated
        rpt = Report::Formatter.format_list(@examiner.smells)
        "Expected no smells, but got:\n#{rpt}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-3.2.1 lib/reek/spec/should_reek.rb
reek-3.1 lib/reek/spec/should_reek.rb