spec/spec_helper.rb in moip2-0.1.4 vs spec/spec_helper.rb in moip2-1.0.0

- old
+ new

@@ -1,31 +1,36 @@ -require "codeclimate-test-reporter" -CodeClimate::TestReporter.start - require "moip2" require "vcr" require "webmock" +require "simplecov" +SimpleCov.start RSpec.configure do |config| - end -ENV['sandbox_url'] = 'https://sandbox.moip.com.br' +ENV["sandbox_url"] = "https://sandbox.moip.com.br" +ENV["connect_sandbox_url"] = "https://connect-sandbox.moip.com.br" VCR.configure do |c| - c.cassette_library_dir = 'vcr_cassettes' + c.cassette_library_dir = "vcr_cassettes" c.hook_into :webmock # or :fakeweb - c.ignore_hosts 'codeclimate.com' + c.ignore_hosts "codeclimate.com" + c.before_record do |i| + i.response.body.force_encoding("UTF-8") + end end # Helper methods def sandbox_auth - Moip2::Auth::Basic.new('01010101010101010101010101010101', 'ABABABABABABABABABABABABABABABABABABABAB') + Moip2::Auth::Basic.new( + "01010101010101010101010101010101", + "ABABABABABABABABABABABABABABABABABABABAB", + ) end def sandbox_oauth - Moip2::Auth::OAuth.new "d63tz2xwyu0ewrembove4j5cbv2otpd" + Moip2::Auth::OAuth.new("9fdc242631454d4c95d82e27b4127394_v2") end def sandbox_client Moip2::Client.new(:sandbox, sandbox_auth) end @@ -33,7 +38,16 @@ def sandbox_oauth_client Moip2::Client.new :sandbox, sandbox_oauth end def sanbox_client_with_header - Moip2::Client.new(:sandbox, sandbox_auth, { headers: { "Moip-Account" => "MPA-UY765TYBL912" } } ) + Moip2::Client.new(:sandbox, sandbox_auth, headers: { "Moip-Account" => "MPA-UY765TYBL912" }) +end + +def sandbox_client_connect + Moip2::Client.new( + :sandbox, + sandbox_auth, + ENV["connect_sandbox_url"], + {}, + ) end