Sha256: b2781847679647741be75a98995b4f7562b2b6cdb2372462b5409a5c9d9a1aaf
Contents?: true
Size: 1.91 KB
Versions: 3
Compression:
Stored size: 1.91 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper.rb' require 'reek/spec' include Reek::Spec describe ShouldReek, 'checking code in a string' do before :each do @clean_code = 'def good() true; end' @smelly_code = 'def x() y = 4; end' @matcher = ShouldReek.new end it 'matches a smelly String' do @matcher.matches?(@smelly_code).should be_true end it 'doesnt match a fragrant String' do @matcher.matches?(@clean_code).should be_false end it 'reports the smells when should_not fails' do @matcher.matches?(@smelly_code).should be_true @matcher.failure_message_for_should_not.should include(@smelly_code.to_source.full_report) end end describe ShouldReek, 'checking code in a Dir' do before :each do @clean_dir = Dir['spec/samples/three_clean_files/*.rb'] @smelly_dir = Dir['spec/samples/two_smelly_files/*.rb'] @matcher = ShouldReek.new end it 'matches a smelly String' do @matcher.matches?(@smelly_dir).should be_true end it 'doesnt match a fragrant String' do @matcher.matches?(@clean_dir).should be_false end it 'reports the smells when should_not fails' do @matcher.matches?(@smelly_dir).should be_true @matcher.failure_message_for_should_not.should include(@smelly_dir.to_source.full_report) end end describe ShouldReek, 'checking code in a File' do before :each do @clean_file = File.new(Dir['spec/samples/three_clean_files/*.rb'][0]) @smelly_file = File.new(Dir['spec/samples/two_smelly_files/*.rb'][0]) @matcher = ShouldReek.new end it 'matches a smelly String' do @matcher.matches?(@smelly_file).should be_true end it 'doesnt match a fragrant String' do @matcher.matches?(@clean_file).should be_false end it 'reports the smells when should_not fails' do @matcher.matches?(@smelly_file).should be_true @matcher.failure_message_for_should_not.should include(@smelly_file.to_source.full_report) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kevinrutherford-reek-1.1.3.7 | spec/reek/spec_spec.rb |
kevinrutherford-reek-1.1.3.8 | spec/reek/spec_spec.rb |
kevinrutherford-reek-1.1.3.9 | spec/reek/spec_spec.rb |