Sha256: 209a9b05ada16691d386ea2f450ca12911d24010fe97fe19f3fa9d072e80df5a

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

require "cucumber/runtime/tag_limits"

describe Cucumber::Runtime::TagLimits::Filter do
  subject(:filter) { Cucumber::Runtime::TagLimits::Filter.new(tag_limits, receiver) }

  let(:tag_limits) { double(:tag_limits) }
  let(:receiver) { double(:receiver) }

  let(:gated_receiver) { double(:gated_receiver) }
  let(:test_case_index) { double(:test_case_index) }
  let(:test_case) { double(:test_case) }

  before do
    allow(Cucumber::Runtime::GatedReceiver).to receive(:new).with(receiver) { gated_receiver }
    allow(Cucumber::Runtime::TagLimits::TestCaseIndex).to receive(:new) { test_case_index }
  end

  describe "#test_case" do
    before do
      allow(test_case_index).to receive(:add)
      allow(gated_receiver).to receive(:test_case)
    end

    it "indexes the test case" do
      expect(test_case_index).to receive(:add).with(test_case)
      filter.test_case(test_case)
    end

    it "adds the test case to the gated receiver" do
      expect(gated_receiver).to receive(:test_case).with(test_case)
      filter.test_case(test_case)
    end
  end

  describe "#done" do
    let(:verifier) { double(:verifier) }

    before do
      allow(Cucumber::Runtime::TagLimits::Verifier).to receive(:new).with(tag_limits) { verifier }
      allow(gated_receiver).to receive(:done)
    end

    it "verifies tag limits have not been exceeded" do
      expect(verifier).to receive(:verify!).with(test_case_index)
      filter.done
    end

    context "the verifier verifies successfully" do
      before do
        allow(verifier).to receive(:verify!).with(test_case_index)
      end

      it "calls done on the receiver gate" do
        expect(gated_receiver).to receive(:done)
        filter.done
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber-2.0.0.beta.3 spec/cucumber/runtime/tag_limits/filter_spec.rb
cucumber-2.0.0.beta.2 spec/cucumber/runtime/tag_limits/filter_spec.rb
cucumber-2.0.0.beta.1 spec/cucumber/runtime/tag_limits/filter_spec.rb