Sha256: 93a79adcb8c635a48d145cafe2b7eb3e6129808a966f5ff5b41d09db7598dab5

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

module Cucumber
  module Wire
    class AddHooksFilter < Core::Filter.new(:connections)
      def test_case(test_case)
        test_case.
          with_steps([before_hook(test_case)] + test_case.test_steps + [after_hook(test_case)]).
          describe_to receiver
      end

      def before_hook(test_case)
        # TODO: is this dependency on Cucumber::Hooks OK? Feels a bit internal..
        # TODO: how do we express the location of the hook? Should we create one hook per connection so we can use the host:port of the connection?
        Cucumber::Hooks.before_hook(test_case.source, Core::Ast::Location.new('TODO:wire')) do
          connections.begin_scenario(test_case)
        end
      end

      def after_hook(test_case)
        Cucumber::Hooks.after_hook(test_case.source, Core::Ast::Location.new('TODO:wire')) do
          connections.end_scenario(test_case)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/cucumber-wire-0.0.1/lib/cucumber/wire/add_hooks_filter.rb
cucumber-wire-0.0.1 lib/cucumber/wire/add_hooks_filter.rb