Sha256: ee00bee9c4d54c518862cf32176c058dd70a804b96d5f238d79e8972524afe38

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

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 [:before_features, :start_features,
                             :end_features, :after_features]
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gurke-2.4.2 spec/gurke/feature_list_spec.rb
gurke-2.4.1 spec/gurke/feature_list_spec.rb
gurke-2.4.0 spec/gurke/feature_list_spec.rb
gurke-2.3.0 spec/gurke/feature_list_spec.rb
gurke-2.2.2 spec/gurke/feature_list_spec.rb
gurke-2.2.1 spec/gurke/feature_list_spec.rb
gurke-2.1.0 spec/gurke/feature_list_spec.rb
gurke-2.0.3 spec/gurke/feature_list_spec.rb
gurke-2.0.2 spec/gurke/feature_list_spec.rb
gurke-2.0.1 spec/gurke/feature_list_spec.rb
gurke-2.0.0 spec/gurke/feature_list_spec.rb
gurke-2.0.0.dev.1.b25 spec/gurke/feature_list_spec.rb
gurke-2.0.0.dev.1.b24 spec/gurke/feature_list_spec.rb
gurke-2.0.0.dev.1.b23 spec/gurke/feature_list_spec.rb
gurke-2.0.0.dev.1.b22 spec/gurke/feature_list_spec.rb