Sha256: 2346d408a8c7a0d3a2cef84d7b543441611dcc95324eff2b312c1fbfaea4089d

Contents?: true

Size: 729 Bytes

Versions: 4

Compression:

Stored size: 729 Bytes

Contents

require 'reek/examiner'
require 'reek/cli/report'

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_for_should
        "Expected #{@examiner.description} to reek, but it didn't"
      end
      def failure_message_for_should_not
        rpt = Cli::ReportFormatter.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

4 entries across 4 versions & 1 rubygems

Version Path
reek-1.3.8 lib/reek/spec/should_reek.rb
reek-1.3.7 lib/reek/spec/should_reek.rb
reek-1.3.6 lib/reek/spec/should_reek.rb
reek-1.3.5 lib/reek/spec/should_reek.rb