BigW Consortium Gitlab

instance_spec.rb 1.1 KB
Newer Older
1
describe QA::Scenario::Test::Instance do
2
  subject do
3
    Class.new(described_class) do
4 5 6 7 8
      tags :rspec
    end
  end

  context '#perform' do
9
    let(:arguments) { spy('Runtime::Scenario') }
10 11 12 13 14
    let(:release) { spy('Runtime::Release') }
    let(:runner) { spy('Specs::Runner') }

    before do
      stub_const('QA::Runtime::Release', release)
15
      stub_const('QA::Runtime::Scenario', arguments)
16
      stub_const('QA::Specs::Runner', runner)
17 18

      allow(runner).to receive(:perform).and_yield(runner)
19 20
    end

21
    it 'sets an address of the subject' do
22 23
      subject.perform("hello")

24 25
      expect(arguments).to have_received(:define)
        .with(:gitlab_address, "hello")
26 27 28 29 30 31
    end

    context 'no paths' do
      it 'should call runner with default arguments' do
        subject.perform("test")

32
        expect(runner).to have_received(:files=).with('qa/specs/features')
33 34 35 36 37 38 39
      end
    end

    context 'specifying paths' do
      it 'should call runner with paths' do
        subject.perform('test', 'path1', 'path2')

40
        expect(runner).to have_received(:files=).with(%w[path1 path2])
41 42 43 44
      end
    end
  end
end