Skip to content

Commit

Permalink
Use IdGenerator::UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-psarga committed Feb 19, 2020
1 parent eca72b8 commit c55e16d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/cucumber/wire/add_hooks_filter.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# coding: utf-8
require 'cucumber/messages'

module Cucumber
module Wire
class AddHooksFilter < Core::Filter.new(:connections)
Expand All @@ -11,16 +13,20 @@ def test_case(test_case)
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('TODO:wire-hook-id', Core::Test::Location.new('TODO:wire')) do
Cucumber::Hooks.before_hook(id_generator.new_id, Core::Test::Location.new('TODO:wire')) do
connections.begin_scenario(test_case)
end
end

def after_hook(test_case)
Cucumber::Hooks.after_hook('TODO:wire-hook-id', Core::Test::Location.new('TODO:wire')) do
Cucumber::Hooks.after_hook(id_generator.new_id, Core::Test::Location.new('TODO:wire')) do
connections.end_scenario(test_case)
end
end

def id_generator
@id_generator ||= Cucumber::Messages::IdGenerator::UUID.new
end
end
end
end

0 comments on commit c55e16d

Please sign in to comment.