Sha256: 7f63e35af252ea6fed42dc1620e004a71a568686a2f36c9193a981c317f18128

Contents?: true

Size: 824 Bytes

Versions: 15

Compression:

Stored size: 824 Bytes

Contents

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

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

      def matches?(actual)
        self.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

      private_attr_reader :configuration
      private_attr_accessor :examiner
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
reek-3.10.1 lib/reek/spec/should_reek.rb
reek-3.10.0 lib/reek/spec/should_reek.rb
reek-3.9.1 lib/reek/spec/should_reek.rb
reek-3.9.0 lib/reek/spec/should_reek.rb
reek-3.8.3 lib/reek/spec/should_reek.rb
reek-3.8.2 lib/reek/spec/should_reek.rb
reek-3.8.1 lib/reek/spec/should_reek.rb
reek-3.8.0 lib/reek/spec/should_reek.rb
reek-3.7.1 lib/reek/spec/should_reek.rb
reek-3.7.0 lib/reek/spec/should_reek.rb
reek-3.6.1 lib/reek/spec/should_reek.rb
reek-3.6.0 lib/reek/spec/should_reek.rb
reek-3.5.0 lib/reek/spec/should_reek.rb
reek-3.4.1 lib/reek/spec/should_reek.rb
reek-3.4.0 lib/reek/spec/should_reek.rb