Sha256: 4cf37ac968510c00aebfc3941db87bb330fc3cbb6f6a5b7ecc1d76be975c1108

Contents?: true

Size: 724 Bytes

Versions: 26

Compression:

Stored size: 724 Bytes

Contents

require 'cucumber/formatter/errors'

module Cucumber
  module Formatter
    module Query
      class PickleByTest
        def initialize(config)
          @pickle_id_by_test_case_id = {}
          config.on_event :test_case_created, &method(:on_test_case_created)
        end

        def pickle_id(test_case)
          return @pickle_id_by_test_case_id[test_case.id] if @pickle_id_by_test_case_id.key?(test_case.id)

          raise TestCaseUnknownError, "No pickle found for #{test_case.id} }. Known: #{@pickle_id_by_test_case_id.keys}"
        end

        private

        def on_test_case_created(event)
          @pickle_id_by_test_case_id[event.test_case.id] = event.pickle.id
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
cucumber-9.0.1 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-9.0.0 lib/cucumber/formatter/query/pickle_by_test.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/query/pickle_by_test.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/query/pickle_by_test.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/query/pickle_by_test.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-8.0.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-8.0.0.rc.1 lib/cucumber/formatter/query/pickle_by_test.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-7.1.0/lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-7.1.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-7.0.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-6.1.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-6.0.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-5.3.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-5.2.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-5.1.3 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-5.1.2 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-5.1.1 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-5.1.0 lib/cucumber/formatter/query/pickle_by_test.rb
cucumber-5.0.0 lib/cucumber/formatter/query/pickle_by_test.rb