Sha256: 4cdc1e25f1c14d15959c11bdb4ece0bcbd706308be6d3aa7bb541d0c4eed6ce1

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

unless defined?(INTEGRATION_SPEC_HELPER_LOADED)
  INTEGRATION_SPEC_HELPER_LOADED = true

  require File.dirname(__FILE__) + "/../spec_helper"
  require File.dirname(__FILE__) + "/../hacks/tcp_socket"

  def start_ssl_server
    web_server_pid_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "httpsd.pid"))

    FileUtils.rm(web_server_pid_file) if File.exist?(web_server_pid_file)
    command = File.expand_path(File.join(File.dirname(__FILE__), "..", "script", "httpsd.rb"))
    `#{command} #{web_server_pid_file}`
    TCPSocket.wait_for_service :host => "127.0.0.1", :port => 8443

    yield

    10.times { unless File.exists?(web_server_pid_file); sleep 1; end }
    Process.kill "INT", File.read(web_server_pid_file).to_i
  end

  def create_modification_for_tests(attributes)
    config = Braintree::Configuration.gateway.config
    config.http.post "/modifications/create_modification_for_tests", :modification => attributes
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
braintree-2.12.0 spec/integration/spec_helper.rb