Sha256: 9a816f71e14574f82a8622b3fb75a9b10bb8bc6f7dceca47eb0616eb4c0ff7d7

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.5.24 spec/unit/mutant/cli_run_spec.rb
mutant-0.5.23 spec/unit/mutant/cli_run_spec.rb
mutant-0.5.22 spec/unit/mutant/cli_run_spec.rb
mutant-0.5.21 spec/unit/mutant/cli_run_spec.rb
mutant-0.5.20 spec/unit/mutant/cli_run_spec.rb