Sha256: 6d0efd2797afef633ea0a1c7f7708ecd4864a10f13fd068bac7f1b2126972622
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require 'test_helper' require 'rubycritic/analysers/smells/flay' require 'rubycritic/core/analysed_module' require 'pathname' describe RubyCritic::Analyser::FlaySmells do context 'when analysing a bunch of files with duplicate code' do before do @analysed_modules = [ RubyCritic::AnalysedModule.new(pathname: Pathname.new('test/samples/flay/smelly.rb')), RubyCritic::AnalysedModule.new(pathname: Pathname.new('test/samples/flay/smelly2.rb')) ] RubyCritic::Analyser::FlaySmells.new(@analysed_modules).run end it 'detects its smells' do @analysed_modules.first.smells?.must_equal true end it 'creates smells with messages' do smell = @analysed_modules.first.smells.first smell.message.must_be_instance_of String end it 'creates smells with scores' do smell = @analysed_modules.first.smells.first smell.score.must_be_kind_of Numeric end it 'creates smells with more than one location' do smell = @analysed_modules.first.smells.first smell.multiple_locations?.must_equal true end it 'calculates the mass of duplicate code' do @analysed_modules.first.duplication.must_be(:>, 0) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubycritic-2.9.3 | test/lib/rubycritic/analysers/smells/flay_test.rb |