diff options
Diffstat (limited to 'qa/spec/scenario/test/instance_spec.rb')
-rw-r--r-- | qa/spec/scenario/test/instance_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/qa/spec/scenario/test/instance_spec.rb b/qa/spec/scenario/test/instance_spec.rb new file mode 100644 index 00000000000..1824db54c9b --- /dev/null +++ b/qa/spec/scenario/test/instance_spec.rb @@ -0,0 +1,44 @@ +describe QA::Scenario::Test::Instance do + subject do + Class.new(described_class) do + tags :rspec + end + end + + context '#perform' do + let(:arguments) { spy('Runtime::Scenario') } + let(:release) { spy('Runtime::Release') } + let(:runner) { spy('Specs::Runner') } + + before do + stub_const('QA::Runtime::Release', release) + stub_const('QA::Runtime::Scenario', arguments) + stub_const('QA::Specs::Runner', runner) + + allow(runner).to receive(:perform).and_yield(runner) + end + + it 'sets an address of the subject' do + subject.perform("hello") + + expect(arguments).to have_received(:define) + .with(:gitlab_address, "hello") + end + + context 'no paths' do + it 'should call runner with default arguments' do + subject.perform("test") + + expect(runner).to have_received(:files=).with('qa/specs/features') + end + end + + context 'specifying paths' do + it 'should call runner with paths' do + subject.perform('test', 'path1', 'path2') + + expect(runner).to have_received(:files=).with(%w[path1 path2]) + end + end + end +end |