module Wrappi::Testing
Public Instance Methods
store_response(path, &block)
click to toggle source
# File lib/wrappi/testing.rb, line 34 def store_response(path, &block) endpoint = block.call raise "Not succesful call to #{endpoint.class}" unless endpoint.success? file_fullname = File.join(path, endpoint.fixture_name) return endpoint if File.exists?(file_fullname) File.open(file_fullname, "w") do |f| f.write(JSON.pretty_generate(endpoint.fixture_content)) end endpoint end