Sha256: ee6578f25603f8be813bda176c0a4ea8d4caee655d784755e0a60b987cb29720
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'spec_helper') require File.join(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))), 'lib', 'reek', 'examiner') include Reek describe Examiner do it 'detects smells in a file' do dirty_file = Dir['spec/samples/two_smelly_files/*.rb'][0] Examiner.new(File.new(dirty_file)).should be_smelly end it 'doesnt match a fragrant String' do examiner = Examiner.new('def good() true; end') examiner.all_active_smells.should == [] end it 'matches a smelly String' do Examiner.new('def fine() y = 4; end').all_active_smells.length.should == 1 end context 'checking code in a Dir' do it 'matches a smelly Dir' do smelly_dir = Dir['spec/samples/all_but_one_masked/*.rb'] Examiner.new(smelly_dir).all_active_smells.length.should == 1 end it 'doesnt match a fragrant Dir' do clean_dir = Dir['spec/samples/three_clean_files/*.rb'] Examiner.new(clean_dir).all_active_smells.length.should == 0 end end context 'checking code in a File' do it 'matches a smelly File' do smelly_file = File.new(Dir['spec/samples/all_but_one_masked/d*.rb'][0]) Examiner.new(smelly_file).all_active_smells.length.should == 1 end it 'doesnt match a fragrant File' do clean_file = File.new(Dir['spec/samples/three_clean_files/*.rb'][0]) Examiner.new(clean_file).all_active_smells.length.should == 0 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-1.2.7.1 | spec/reek/examiner_spec.rb |
reek-1.2.7 | spec/reek/examiner_spec.rb |