Sha256: 119e4e157d9bf3dc2e27adc77ab67b186a25d7707078f3384af21fad72d4c1d1

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

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 '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

1 entries across 1 versions & 1 rubygems

Version Path
rubycritic-2.9.3 test/lib/rubycritic/analysers/smells/reek_test.rb