Sha256: f6c4bbd080f786444e282b536850c3f0a39b42bbad55eb50cac9cf9e842ddf82

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Stairs::Runner do
  let(:groups) { nil }
  let(:subject) { described_class.new(groups) }

  describe '#run!' do
    let(:script_double) { double('script', run!: true) }

    before do
      # Stub things as to not block IO
      allow_any_instance_of(Stairs::InteractiveConfiguration).to receive(:run!)
      allow_any_instance_of(Stairs::Script).to receive(:run!)
      allow(Stairs::Script).to receive(:new).and_return(script_double)
    end

    it 'runs the interactive configuration' do
      expect_any_instance_of(Stairs::InteractiveConfiguration)
        .to receive(:run!)

      subject.run!
    end

    it 'runs all groups in the setup.rb script' do
      expect(Stairs::Script)
        .to receive(:new).with('setup.rb', groups).and_return(script_double)

      expect(script_double).to receive(:run!)

      subject.run!
    end

    context 'with groups provided' do
      let(:groups) { [:reset] }

      it 'passes the specified groups to the script' do
        expect(Stairs::Script).to receive(:new).with('setup.rb', groups)
        subject.run!
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stairs-0.10.0 spec/lib/stairs/runner_spec.rb