Sha256: 3502b760e88c1eda35f537ebf188792ad41e9dd44290aaaba107069f4925997f

Contents?: true

Size: 1.03 KB

Versions: 37

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require 'cucumber/core/filter'
require 'cucumber/core/test/location'
require 'cucumber/running_test_case'

module Cucumber
  module Filters
    class PrepareWorld < Core::Filter.new(:runtime)
      def test_case(test_case)
        CaseFilter.new(runtime, test_case).test_case.describe_to receiver
      end

      class CaseFilter
        def initialize(runtime, original_test_case)
          @runtime = runtime
          @original_test_case = original_test_case
        end

        def test_case
          init_scenario = Cucumber::Hooks.around_hook do |continue|
            @runtime.begin_scenario(scenario)
            continue.call
            @runtime.end_scenario(scenario)
          end
          around_hooks = [init_scenario] + @original_test_case.around_hooks

          @original_test_case.with_around_hooks(around_hooks).with_steps(@original_test_case.test_steps)
        end

        private

        def scenario
          @scenario ||= RunningTestCase.new(test_case)
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 4 rubygems

Version Path
cucumber-9.2.1 lib/cucumber/filters/prepare_world.rb
cucumber-9.2.0 lib/cucumber/filters/prepare_world.rb
cucumber-9.1.2 lib/cucumber/filters/prepare_world.rb
cucumber-9.1.1 lib/cucumber/filters/prepare_world.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/cucumber-9.1.0/lib/cucumber/filters/prepare_world.rb
cucumber-9.1.0 lib/cucumber/filters/prepare_world.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/cucumber-9.0.2/lib/cucumber/filters/prepare_world.rb
cucumber-9.0.2 lib/cucumber/filters/prepare_world.rb
cucumber-9.0.1 lib/cucumber/filters/prepare_world.rb
cucumber-9.0.0 lib/cucumber/filters/prepare_world.rb
rubypitaya-3.12.5 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/filters/prepare_world.rb
rubypitaya-3.12.4 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/filters/prepare_world.rb
rubypitaya-3.12.3 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/filters/prepare_world.rb
rubypitaya-3.12.2 ./lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/filters/prepare_world.rb
cucumber-8.0.0 lib/cucumber/filters/prepare_world.rb
cucumber-8.0.0.rc.1 lib/cucumber/filters/prepare_world.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-7.1.0/lib/cucumber/filters/prepare_world.rb
cucumber-7.1.0 lib/cucumber/filters/prepare_world.rb
cucumber-7.0.0 lib/cucumber/filters/prepare_world.rb
cucumber-6.1.0 lib/cucumber/filters/prepare_world.rb