Sha256: b0d4638242693c2b52ffc61755c919d8281e6ae357dfa7a01990067b33aab2d7

Contents?: true

Size: 1.41 KB

Versions: 3

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').as_null_object
  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

3 entries across 3 versions & 1 rubygems

Version Path
reek-1.3.1 spec/reek/cli/reek_command_spec.rb
reek-1.3 spec/reek/cli/reek_command_spec.rb
reek-1.2.13 spec/reek/cli/reek_command_spec.rb