Sha256: 75eb1eec80eb6ce65d32d4112e9afd6902fc9713393a6eb62c95f7f239c84e4d

Contents?: true

Size: 1009 Bytes

Versions: 6

Compression:

Stored size: 1009 Bytes

Contents

# frozen_string_literal: true
require 'analysers_test_helper'
require 'rubycritic/analysers/smells/reek'

describe RubyCritic::Analyser::ReekSmells do
  context 'when analysing a smelly file' do
    before do
      pathname = Pathname.new('test/samples/reek/smelly.rb')
      @analysed_module = AnalysedModuleDouble.new(pathname: pathname, smells: [])
      analysed_modules = [@analysed_module]
      RubyCritic::Analyser::ReekSmells.new(analysed_modules).run
    end

    it 'detects its smells' do
      @analysed_module.smells.length.must_equal 2
    end

    it 'respects the .reek file' do
      messages = @analysed_module.smells.map(&:message)
      messages.wont_include "has the parameter name 'a'"
    end

    it 'creates smells with messages' do
      first_smell = @analysed_module.smells.first
      first_smell.message.must_equal "has boolean parameter 'reek'"

      last_smell = @analysed_module.smells.last
      last_smell.message.must_equal 'has no descriptive comment'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubycritic-3.2.0 test/lib/rubycritic/analysers/smells/reek_test.rb
rubycritic-3.1.3 test/lib/rubycritic/analysers/smells/reek_test.rb
rubycritic-3.1.2 test/lib/rubycritic/analysers/smells/reek_test.rb
rubycritic-3.1.1 test/lib/rubycritic/analysers/smells/reek_test.rb
rubycritic-3.1.0 test/lib/rubycritic/analysers/smells/reek_test.rb
rubycritic-3.0.0 test/lib/rubycritic/analysers/smells/reek_test.rb