Sha256: f36d82644114817e7cc0f3b87c54a3d9ffd142203dc0188e52ed61e77c80276b

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require File.join(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__)))), 'spec_helper')
require File.join(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))), 'lib', 'reek', 'cli', 'reek_command')
require File.join(File.dirname(File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))), 'lib', 'reek', 'examiner')

include Reek
include Reek::Cli

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

  context 'with smells' do
    before :each do
      examiner = Examiner.new('def x(); end')
      @cmd = ReekCommand.new([examiner], 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
      examiner = Examiner.new('def clean(); end')
      @cmd = ReekCommand.new([examiner], 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

2 entries across 2 versions & 1 rubygems

Version Path
reek-1.2.7.1 spec/reek/cli/reek_command_spec.rb
reek-1.2.7 spec/reek/cli/reek_command_spec.rb