Sha256: adc96923edb2dca76202f28bb5f10889ceb29c35c451cacc1f223bb940bd4a37

Contents?: true

Size: 797 Bytes

Versions: 10

Compression:

Stored size: 797 Bytes

Contents

require 'reek/examiner'
require 'reek/cli/report/report'
require 'reek/cli/report/formatter'
require 'reek/cli/report/strategy'

module Reek
  module Spec
    #
    # An rspec matcher that matches when the +actual+ has code smells.
    #
    class ShouldReek        # :nodoc:
      def matches?(actual)
        @examiner = Examiner.new(actual)
        @examiner.smelly?
      end

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

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

    #
    # Returns +true+ if and only if the target source code contains smells.
    #
    def reek
      ShouldReek.new
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
reek-1.6.6 lib/reek/spec/should_reek.rb
reek-1.6.5 lib/reek/spec/should_reek.rb
reek-1.6.4 lib/reek/spec/should_reek.rb
reek-1.6.3 lib/reek/spec/should_reek.rb
reek-1.6.2 lib/reek/spec/should_reek.rb
reek-1.6.1 lib/reek/spec/should_reek.rb
reek-1.6.0 lib/reek/spec/should_reek.rb
reek-1.5.1 lib/reek/spec/should_reek.rb
reek-1.5.0 lib/reek/spec/should_reek.rb
reek-1.4.0 lib/reek/spec/should_reek.rb