Class: FakeMDEX

Inherits:
Object
  • Object
show all
Extended by:
WebMock::API
Defined in:
lib/mdex_client/fake_mdex/fake_mdex.rb

Constant Summary collapse

WSDL_FILE =
File.expand_path("#{__FILE__}/../mdex.wsdl")
File.expand_path("#{__FILE__}/../mdex_response.xml")

Class Method Summary collapse

Class Method Details



17
18
19
20
21
22
# File 'lib/mdex_client/fake_mdex/fake_mdex.rb', line 17

def self.navigation_result
  xml = Nokogiri::XML.parse(File.new(NAVIGATION_RESULT_FILE))
  result = xml.xpath("/env:Envelope/env:Body/mdata:Response/mdata:TypedResult/mdata:NavigationResults",
    MDEXClient::Client::NAMESPACES)
  MDEXClient::MData::NavigationResult.new(result)
end

.setup_stubs!Object



9
10
11
12
13
14
15
# File 'lib/mdex_client/fake_mdex/fake_mdex.rb', line 9

def self.setup_stubs!
  stub_request(:post, %r{^https://(.*:.*@)?mdex.gively.com/ws/mdex}).
    to_return(:body => File.new(NAVIGATION_RESULT_FILE), :status => 200)
  
  stub_request(:get, %r{^https://(.*:.*@)?mdex.gively.com/ws/mdex}).
    to_return(:body => File.new(WSDL_FILE), :status => 200)
end