Sha256: 01d23cfd07c7e06a3250c94d70daa1d5c079ad986f710d1feb0387101519b606

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 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', 'cli', 'report')
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(QuietReport, ['def x(); end'])
    end

    it 'displays the correct text on the view' do
      @view.should_receive(:output).with(/UncommunicativeMethodName/)
      @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
      @cmd = ReekCommand.new(QuietReport, ['def clean(); end'])
    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

4 entries across 4 versions & 1 rubygems

Version Path
reek-1.2.12 spec/reek/cli/reek_command_spec.rb
reek-1.2.11 spec/reek/cli/reek_command_spec.rb
reek-1.2.10 spec/reek/cli/reek_command_spec.rb
reek-1.2.9 spec/reek/cli/reek_command_spec.rb