From a1788054b6a8af0237d1a529ae14abc76b4d2b9b Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Tue, 6 Sep 2016 15:27:20 -0700 Subject: [PATCH] Use VCR for CheckoutsControllerSpec This test now creates a payment profile, and needs to be wrapped with VCR to avoid hitting the network during test runs. --- .../checkouts_controller_spec.rb | 3 +- .../cassettes/checkouts_controller/update.yml | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/cassettes/checkouts_controller/update.yml diff --git a/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb b/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb index ac7dfa29..babacda3 100644 --- a/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb +++ b/spec/controllers/solidus_paypal_braintree/checkouts_controller_spec.rb @@ -4,7 +4,8 @@ RSpec.describe SolidusPaypalBraintree::CheckoutsController, type: :controller do include_context 'order ready for payment' - describe 'PATCH update' do + cassette_options = { cassette_name: "checkouts_controller/update" } + describe 'PATCH update', vcr: cassette_options do subject(:patch_update) { patch :update, params } let(:params) do diff --git a/spec/fixtures/cassettes/checkouts_controller/update.yml b/spec/fixtures/cassettes/checkouts_controller/update.yml new file mode 100644 index 00000000..12bdcb78 --- /dev/null +++ b/spec/fixtures/cassettes/checkouts_controller/update.yml @@ -0,0 +1,72 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.sandbox.braintreegateway.com/merchants/7rdg92j7bm7fk5h3/customers + body: + encoding: UTF-8 + string: | + + + + headers: + Accept-Encoding: + - gzip + Accept: + - application/xml + User-Agent: + - Braintree Ruby Gem 2.66.0 + X-Apiversion: + - '4' + Authorization: + - Basic bXdqa2t4d2NwMzJja2huZjphOTI5OGY0M2IzMGM2OTlkYjMwNzJjYzRhMDBmN2Y0OQ== + Content-Type: + - application/xml + response: + status: + code: 201 + message: Created + headers: + Date: + - Tue, 06 Sep 2016 22:26:30 GMT + Content-Type: + - application/xml; charset=utf-8 + Transfer-Encoding: + - chunked + X-Frame-Options: + - SAMEORIGIN + - SAMEORIGIN + X-Xss-Protection: + - 1; mode=block + X-Content-Type-Options: + - nosniff + X-Authentication: + - basic_auth + X-User: + - 3v249hqtptsg744y + Vary: + - Accept-Encoding + Content-Encoding: + - gzip + Etag: + - W/"431145f5e51c78e5b27309a6202f5af4" + Cache-Control: + - max-age=0, private, must-revalidate + X-Request-Id: + - a04f1687-4ae7-4e9b-a086-f9cb44961da4 + X-Runtime: + - '0.146319' + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + body: + encoding: ASCII-8BIT + string: !binary |- + H4sIAJZCz1cAA5SRwW6DMBBE7/kKy3cXYhRoIkNu/YL00tuGXYJTbJBt2vD3 + dWiUVKI9VD7NPM/uyFb7i+nYBzmve1vy9VPKGdm6R21PJX89vIhnvq9Wqh59 + 6A25asWY0ljJLJ4i26gkiqsXWd2CDSLqwuFpK8/F0RTN+6bNVPKTXm832vkg + LBhiVnclD24knsyog79I3ZsB7LTwyYDuFu7Q9nY5o4HLwvuko9fhl32OIBAK + CCxMA5UcowzaEK9kus5FuhVpfpByJ/Ndlr6p5BGY8+OA/8s/At/75zcXjaYO + /b0S6iBqcOhvQ8E5mG6NAdGR97Rgsdv9A78AAAD//wMABrZt9/MBAAA= + http_version: + recorded_at: Tue, 06 Sep 2016 22:27:14 GMT +recorded_with: VCR 3.0.3