Sha256: 714699921cf3494776e0a8d567336de697c0a5372299e8515f77594a5f34e741

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Mutant::CLI, '.run' do
  subject { object.run(argv) }

  let(:object)     { described_class                                 }
  let(:argv)       { double('ARGV')                                  }
  let(:attributes) { double('Options')                               }
  let(:runner)     { double('Runner', :success? => success)          }
  let(:config)     { double('Config')                                }
  let(:instance)   { double(described_class.name, :config => config) }

  before do
    described_class.stub(:new => instance)
    Mutant::Runner::Config.stub(:run => runner)
  end

  context 'when runner is successful' do
    let(:success) { true }

    it { should be(0) }

    it 'should run with attributes' do
      Mutant::Runner::Config
        .should_receive(:run)
        .with(config)
        .and_return(runner)
      should be(0)
    end
  end

  context 'when runner fails' do
    let(:success) { false }

    it { should be(1) }

    it 'should run with attributes' do
      Mutant::Runner::Config
        .should_receive(:run)
        .with(config)
        .and_return(runner)
      should be(1)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutant-0.3.0.rc1 spec/unit/mutant/cli/class_methods/run_spec.rb
mutant-0.3.0.beta22 spec/unit/mutant/cli/class_methods/run_spec.rb