Sha256: 5b4339f366f35774e41b71bed153afc4c59f0cb4b1fc2a8ff5a05f0b08fb2718
Contents?: true
Size: 1.02 KB
Versions: 6
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
6 entries across 6 versions & 1 rubygems