Sha256: 2db7b6153c0963e7d71c929c5400549675d833bf3a500656f3e897f65816b569
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'analysers_test_helper' require 'rubycritic/analysers/helpers/methods_counter' describe RubyCritic::MethodsCounter do describe '#count' do context 'when a file contains Ruby code' do it 'calculates the number of methods' do analysed_module = AnalysedModuleDouble.new(path: 'test/samples/methods_count.rb') RubyCritic::MethodsCounter.new(analysed_module).count.must_equal 2 end end context 'when a file is empty' do it 'returns 0 as the number of methods' do analysed_module = AnalysedModuleDouble.new(path: 'test/samples/empty.rb') RubyCritic::MethodsCounter.new(analysed_module).count.must_equal 0 end end context 'when a file is unparsable' do it 'does not blow up and returns 0 as the number of methods' do analysed_module = AnalysedModuleDouble.new(path: 'test/samples/unparsable.rb') capture_output_streams do RubyCritic::MethodsCounter.new(analysed_module).count.must_equal 0 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubycritic-2.9.3 | test/lib/rubycritic/analysers/helpers/methods_counter_test.rb |