Sha256: 1cea33446d3a620f83427d69caea57b02b0555d595222c17b366c5aff599adfb

Contents?: true

Size: 1.03 KB

Versions: 30

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true
require 'cucumber/core/filter'

module Cucumber
  module Core
    module Test
      class TagFilter < Filter.new(:filter_expressions)

        def test_case(test_case)
          test_cases << test_case
          if test_case.match_tags?(filter_expressions)
            test_case.describe_to(receiver)
          end
          self
        end

        def done
          receiver.done
          self
        end

        private

        def test_cases
          @test_cases ||= TestCases.new
        end

        class TestCases
          attr_reader :test_cases_by_tag_name
          private :test_cases_by_tag_name
          def initialize
            @test_cases_by_tag_name = Hash.new { [] }
          end

          def <<(test_case)
            test_case.tags.each do |tag|
              test_cases_by_tag_name[tag.name] += [test_case]
            end
            self
          end

          def with_tag_name(tag_name)
            test_cases_by_tag_name[tag_name]
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 4 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-core-12.0.0/lib/cucumber/core/test/filters/tag_filter.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-core-11.1.0/lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-12.0.0 lib/cucumber/core/test/filters/tag_filter.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/filters/tag_filter.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/filters/tag_filter.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/filters/tag_filter.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-core-11.0.0/lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-11.1.0 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-11.0.0 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-10.1.1 lib/cucumber/core/test/filters/tag_filter.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-core-10.1.0/lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-10.1.0 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-10.0.1 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-10.0.0 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-9.0.1 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-9.0.0 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-8.0.1 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-7.1.0 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-7.0.0 lib/cucumber/core/test/filters/tag_filter.rb
cucumber-core-6.0.0 lib/cucumber/core/test/filters/tag_filter.rb