Sha256: 50f2cec4c14877b8ddbb50678201fd1080098b2754c3d8e961341241b32e47c6

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require "cucumber/runtime/tag_limits"

describe Cucumber::Runtime::TagLimits::Verifier do
  describe "#verify!" do
    subject(:verifier) { Cucumber::Runtime::TagLimits::Verifier.new(tag_limits) }
    let(:test_case_index) { double(:test_case_index) }

    context "the tag counts exceed the tag limits" do
      let(:tag_limits) do
        {
          "@exceed_me" => 1
        }
      end

      let(:locations) do
        [
          double(:location, to_s: "path/to/some.feature:3"),
          double(:location, to_s: "path/to/some/other.feature:8"),
        ]
      end

      before do
        allow(test_case_index).to receive(:count_by_tag_name).with("@exceed_me") { 2 }
        allow(test_case_index).to receive(:locations_of_tag_name).with("@exceed_me") { locations }
      end

      it "raises a TagLimitExceeded error with the locations of the tags" do
        expect {
          verifier.verify!(test_case_index)
        }.to raise_error(
          Cucumber::Runtime::TagLimits::TagLimitExceededError,
          "@exceed_me occurred 2 times, but the limit was set to 1\n" +
          "  path/to/some.feature:3\n" +
          "  path/to/some/other.feature:8"
        )
      end
    end

    context "the tag counts do not exceed the tag limits" do
      let(:tag_limits) do
        {
          "@dont_exceed_me" => 2
        }
      end

      before do
        allow(test_case_index).to receive(:count_by_tag_name).with("@dont_exceed_me") { 1 }
      end

      it "does not raise an error" do
        expect {
          verifier.verify!(test_case_index)
        }.to_not raise_error
      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/verifier_spec.rb
cucumber-2.0.0.beta.2 spec/cucumber/runtime/tag_limits/verifier_spec.rb
cucumber-2.0.0.beta.1 spec/cucumber/runtime/tag_limits/verifier_spec.rb