Sha256: 49c3948f09d76941c57e7108e5032838f4ed2703e0d4c5b49da2ebf3ecf92267

Contents?: true

Size: 1.43 KB

Versions: 20

Compression:

Stored size: 1.43 KB

Contents

describe KnapsackPro::Runners::CucumberRunner do
  subject { described_class.new(KnapsackPro::Adapters::CucumberAdapter) }

  it { should be_kind_of KnapsackPro::Runners::BaseRunner }

  describe '.run' do
    let(:args) { '--custom-arg' }

    after { described_class.run(args) }

    before do
      stub_const("ENV", { 'KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER' => 'cucumber-token' })

      stringify_test_file_paths = 'features/a.feature features/b.feature'
      runner = instance_double(described_class,
                               stringify_test_file_paths: stringify_test_file_paths)
      expect(described_class).to receive(:new)
      .with(KnapsackPro::Adapters::CucumberAdapter).and_return(runner)

      expect(Kernel).to receive(:system).with('KNAPSACK_PRO_RECORDING_ENABLED=true KNAPSACK_PRO_TEST_SUITE_TOKEN=cucumber-token bundle exec cucumber --custom-arg -- features/a.feature features/b.feature')
    end

    context 'when command exit with success code' do
      let(:exitstatus) { 0 }

      before do
        expect($?).to receive(:exitstatus).and_return(exitstatus)
      end

      it do
        expect(Kernel).not_to receive(:exit)
      end
    end

    context 'when command exit without success code' do
      let(:exitstatus) { 1 }

      before do
        expect($?).to receive(:exitstatus).twice.and_return(exitstatus)
      end

      it do
        expect(Kernel).to receive(:exit).with(exitstatus)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
knapsack_pro-0.14.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.13.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.12.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.11.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.10.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.9.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.8.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.7.2 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.7.1 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.7.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.6.1 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.6.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.5.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.4.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.3.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.2.1 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.2.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.1.2 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.1.1 spec/knapsack_pro/runners/cucumber_runner_spec.rb
knapsack_pro-0.1.0 spec/knapsack_pro/runners/cucumber_runner_spec.rb