Sha256: 42af312480770ab7a6808fd6d4a7f7c42ec733f4328bee96e79f82006a062a9f

Contents?: true

Size: 822 Bytes

Versions: 73

Compression:

Stored size: 822 Bytes

Contents

Given /^there is a wire server (running |)on port (\d+) which understands the following protocol:$/ do |running, port, table|
  table.map_column!('response') {|cell| cell.gsub(/\n/, '\n')}
  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

73 entries across 69 versions & 11 rubygems

Version Path
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/legacy_features/step_definitions/wire_steps.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/legacy_features/step_definitions/wire_steps.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/legacy_features/step_definitions/wire_steps.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/legacy_features/step_definitions/wire_steps.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/legacy_features/step_definitions/wire_steps.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/legacy_features/step_definitions/wire_steps.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/cucumber-1.1.9/legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.9 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.8 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.7 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.6 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.5 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.4 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.3 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.2 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.1 legacy_features/step_definitions/wire_steps.rb
js-log-cucumber-1.0.2 legacy_features/step_definitions/wire_steps.rb
cucumber-1.1.0 legacy_features/step_definitions/wire_steps.rb
cucumber-1.0.6 legacy_features/step_definitions/wire_steps.rb
cucumber-1.0.5 legacy_features/step_definitions/wire_steps.rb