Top Level Namespace
Defined Under Namespace
Modules: GlobalCollect
Instance Method Summary collapse
- #filename_for(success, action, version) ⇒ Object
- #install_canned_response(service, env, auth_scheme, success, action, version) ⇒ Object
- #parse_canned_response(success, action, version) ⇒ Object
- #read_support_file(filename) ⇒ Object
- #support_path(filename) ⇒ Object
Instance Method Details
#filename_for(success, action, version) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/global_collect/test_helper.rb', line 11 def filename_for(success, action, version) filename = [ success, action, version, "response" ].map(&:to_s).join("_") + ".xml" end |
#install_canned_response(service, env, auth_scheme, success, action, version) ⇒ Object
20 21 22 23 24 |
# File 'lib/global_collect/test_helper.rb', line 20 def install_canned_response(service, env, auth_scheme, success, action, version) response_body = read_support_file(filename_for(success, action, version)) service_url = GlobalCollect::ApiClient.service_url(service, env, auth_scheme) FakeWeb.register_uri(:post, service_url, :body => response_body) end |
#parse_canned_response(success, action, version) ⇒ Object
26 27 28 29 |
# File 'lib/global_collect/test_helper.rb', line 26 def parse_canned_response(success, action, version) response_body = read_support_file(filename_for(success, action, version)) GlobalCollect::Responses::Base.new(Crack::XML.parse(response_body), response_body) end |
#read_support_file(filename) ⇒ Object
7 8 9 |
# File 'lib/global_collect/test_helper.rb', line 7 def read_support_file(filename) File.read(support_path(filename)) end |
#support_path(filename) ⇒ Object
3 4 5 |
# File 'lib/global_collect/test_helper.rb', line 3 def support_path(filename) File.(File.join(File.dirname(__FILE__), '..', '..', 'spec', 'support', filename)) end |