Sha256: 931df122e75bc513343a35a023cdcd81a1231ddf72428e48fb5a96aa58266c6b

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

require "rubygems"
require "test/unit"
require "mocha"
require "shoulda"
require "apricoteatsgorilla"

require File.join(File.dirname(__FILE__), "..", "lib", "savon")
require File.join(File.dirname(__FILE__), "factories", "wsdl")
require File.join(File.dirname(__FILE__), "fixtures", "soap_response")

module TestHelper

  def some_url
    "http://example.com"
  end

  def some_uri
    URI(some_url)
  end

  def service_http_mock(response_body)
    http_mock = mock("Net::HTTP")
    http_mock.stubs(:get).returns(response_mock(WsdlFactory.new.build))
    http_mock.stubs(:request_post).returns(response_mock(response_body))
    http_mock
  end

  def http_mock(response_body)
    http_mock = mock("Net::HTTP")
    http_mock.stubs(:get).returns(response_mock(response_body))
    http_mock
  end

  def response_mock(response_body)
    build_response_mock("200", "OK", response_body)
  end

  def response_fault_mock
    build_response_mock("404", "NotFound")
  end

  def build_response_mock(code, message, body = nil)
    response_mock = mock("Net::HTTPResponse")
    response_mock.stubs(:code => code, :message => message, :body => body)
    response_mock
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smacks-savon-0.1.0 test/helper.rb
smacks-savon-0.1.1 test/helper.rb