Sha256: 8b9f69153fe100aab0afa2bf312aa2471b34a535e4f857d20bded3e39f6f3ecb

Contents?: true

Size: 759 Bytes

Versions: 9

Compression:

Stored size: 759 Bytes

Contents

Given /^there is a wire server (running |)on port (\d+) which understands the following protocol:$/ do |running, port, table|
  protocol = table.hashes
  @server = FakeWireServer.new(port.to_i, protocol)
  start_wire_server if running.strip == "running"
end

Given /^the wire server takes (.*) seconds to respond to the invoke message$/ do |timeout|
  @server.delay_response(:invoke, timeout.to_f)
  start_wire_server
end

module WireHelper
  def start_wire_server
    @wire_pid = fork do
      at_exit { stop_wire_server }
      @server.run
    end
  end
  
  def stop_wire_server
    return unless @wire_pid
    Process.kill('KILL', @wire_pid)
    Process.wait
  end
end

Before('@wire') do
  extend(WireHelper)
end

After('@wire') do
  stop_wire_server
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/cucumber-0.9.4/features/step_definitions/wire_steps.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/cucumber-0.9.4/features/step_definitions/wire_steps.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/cucumber-0.9.4/features/step_definitions/wire_steps.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/cucumber-0.9.4/features/step_definitions/wire_steps.rb
cucumber-0.9.4 features/step_definitions/wire_steps.rb
cucumber-0.9.3 features/step_definitions/wire_steps.rb
cucumber-0.9.2 features/step_definitions/wire_steps.rb
cucumber-0.9.1 features/step_definitions/wire_steps.rb
cucumber-0.9.0 features/step_definitions/wire_steps.rb