Sha256: 257a8546a8a9ff2453292c152bec76a27feaa0384b3b12f8cfa7b4c6dc82fea5

Contents?: true

Size: 1.22 KB

Versions: 9

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Gurke::FeatureList do
  let(:reporter) { Gurke::Reporters::NullReporter.new }
  let(:runner)   { double 'runner' }
  let(:feature)  { double 'feature' }

  before do
    features << feature

    allow(runner).to receive(:hook) {|_, _, &block| block.call }
    allow(feature).to receive(:failed?).and_return false
    allow(feature).to receive(:pending?).and_return false
    allow(feature).to receive(:run)
  end

  let(:features) { Gurke::FeatureList.new }

  describe '#run' do
    subject { features.run runner, reporter }

    it 'should run all features' do
      expect(feature).to receive(:run).with(runner, reporter)

      subject
    end

    it 'should run hooks' do
      expect(runner).to receive(:hook) do |scope, world|
        expect(scope).to eq :features
        expect(world).to eq nil
      end

      subject
    end

    it 'should run reporter callbacks in correct order' do
      expect(reporter).to receive(:invoke).exactly(4).times do |*args|
        @scopes ||= []
        @scopes << args.first
      end

      subject

      expect(@scopes).to eq %i[before_features start_features
                               end_features after_features]
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gurke-3.3.4 spec/gurke/feature_list_spec.rb
gurke-3.3.3 spec/gurke/feature_list_spec.rb
gurke-3.3.2 spec/gurke/feature_list_spec.rb
gurke-3.3.1 spec/gurke/feature_list_spec.rb
gurke-3.2.2 spec/gurke/feature_list_spec.rb
gurke-3.2.1 spec/gurke/feature_list_spec.rb
gurke-3.2.0 spec/gurke/feature_list_spec.rb
gurke-3.1.0 spec/gurke/feature_list_spec.rb
gurke-3.0.0 spec/gurke/feature_list_spec.rb