Sha256: d8ae3d82f7be96dae98b05c94755a903430fca2d3b2b7f68b1b77f5b38dc0c8c

Contents?: true

Size: 1.68 KB

Versions: 21

Compression:

Stored size: 1.68 KB

Contents

require "cucumber/filters/tag_limits"

describe Cucumber::Filters::TagLimits do
  subject(:filter) { Cucumber::Filters::TagLimits.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::Filters::GatedReceiver).to receive(:new).with(receiver) { gated_receiver }
    allow(Cucumber::Filters::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::Filters::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

21 entries across 21 versions & 2 rubygems

Version Path
cucumber-2.99.0 spec/cucumber/filters/tag_limits_spec.rb
mobiusloop-0.1.5 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.4.0 spec/cucumber/filters/tag_limits_spec.rb
mobiusloop-0.1.3 spec/cucumber/filters/tag_limits_spec.rb
mobiusloop-0.1.2 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.3.3 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.3.2 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.3.1 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.3.0 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.2.0 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.1.0 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.2 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.1 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.0 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.0.rc.5 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.0.rc.4 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.0.rc.3 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.0.rc.2 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.0.rc.1 spec/cucumber/filters/tag_limits_spec.rb
cucumber-2.0.0.beta.5 spec/cucumber/filters/tag_limits_spec.rb