Sha256: a5141571cef26a0f86f2ea17f7090daa31fac9d3ae240453f102c42fca6e3c35

Contents?: true

Size: 998 Bytes

Versions: 3

Compression:

Stored size: 998 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'

require 'reek/reek_command'

include Reek

describe ReekCommand do
  before :each do
    @view = mock('view', :null_object => true)
  end

  context 'with smells' do
    before :each do
      src = 'def x(); end'
      @cmd = ReekCommand.new(src, QuietReport, false)
    end

    it 'displays the correct text on the view' do
      @view.should_receive(:output).with(/Uncommunicative Name/)
      @cmd.execute(@view)
    end

    it 'tells the view it succeeded' do
      @view.should_receive(:report_smells)
      @cmd.execute(@view)
    end
  end

  context 'with no smells' do
    before :each do
      src = 'def clean(); end'
      @cmd = ReekCommand.new(src, QuietReport, false)
    end

    it 'displays nothing on the view' do
      @view.should_receive(:output).with('')
      @cmd.execute(@view)
    end

    it 'tells the view it succeeded' do
      @view.should_receive(:report_success)
      @cmd.execute(@view)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reek-1.2.6 spec/reek/reek_command_spec.rb
reek-1.2.5 spec/reek/reek_command_spec.rb
reek-1.2.4 spec/reek/reek_command_spec.rb