Sha256: 6957b084916f41d3923703be1c5095e086eef57a31057c0b6f69910e802aed99

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 KB

Contents

shared_examples_for 'a variable detector' do
  context 'with no variables' do
    it "doesn't record a smell" do
      @detector.examine_context(@ctx)
      @detector.smells_found.length.should == 0
    end
  end

  context 'with one variable encountered twice' do
    before :each do
      @ctx.send(@record_variable, :something)
      @ctx.send(@record_variable, :something)
      @detector.examine_context(@ctx)
    end

    it 'records only one smell' do
      @detector.smells_found.length.should == 1
    end
    it 'mentions the variable name in the report' do
      @detector.should have_smell([/something/])
    end
  end

  context 'with two variables' do
    before :each do
      @ctx.send(@record_variable, :something)
      @ctx.send(@record_variable, :something_else)
      @detector.examine_context(@ctx)
    end

    it 'records both smells' do
      @detector.num_smells.should == 2
    end
    it 'mentions both variable names in the report' do
      @detector.should have_smell([/something/])
      @detector.should have_smell([/something_else/])
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
reek-1.3.8 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3.7 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3.6 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3.5 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3.4 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3.3 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3.2 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3.1 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.3 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.2.13 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.2.12 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.2.11 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.2.10 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.2.9 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.2.8 spec/reek/smells/behaves_like_variable_detector.rb
reek-1.2.7.3 spec/reek/smells/behaves_like_variable_detector.rb