Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Vcr improvements #30

Merged
merged 8 commits into from
Sep 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
RSpec.describe SolidusPaypalBraintree::CheckoutsController, type: :controller do
include_context 'order ready for payment'

cassette_options = { cassette_name: "checkouts_controller/update" }
describe 'PATCH update', vcr: cassette_options do
describe 'PATCH update', vcr: { cassette_name: 'checkout/update' } do
subject(:patch_update) { patch :update, params }

let(:params) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
allow(controller).to receive(:current_order) { order }
end

cassette_options = { cassette_name: "transactions_controller/create" }
describe "POST create", vcr: cassette_options do
describe "POST create" do
subject(:post_create) { post :create, params }

let(:params) do
Expand All @@ -35,7 +34,19 @@
}
end

context "when the transaction is valid" do
context "import has invalid address" do
before { params[:transaction][:address_attributes][:city] = nil }

it "raises a validation error" do
expect { post_create }.to raise_error(
SolidusPaypalBraintree::TransactionImport::InvalidImportError,
"Validation failed: " \
"Transactionaddress city can't be blank"
)
end
end

context "when the transaction is valid", vcr: { cassette_name: 'transaction/import/valid' } do
it "imports the payment" do
expect { post_create }.to change { order.payments.count }.by(1)
expect(order.payments.first.amount).to eq 55
Expand All @@ -51,18 +62,6 @@
end
end

context "and an invalid address is provided" do
before { params[:transaction][:address_attributes][:city] = nil }

it "raises a validation error" do
expect { post_create }.to raise_error(
SolidusPaypalBraintree::TransactionImport::InvalidImportError,
"Validation failed: " \
"Transactionaddress city can't be blank"
)
end
end

context "and the transaction does not have an address" do
before { params[:transaction].delete(:address_attributes) }

Expand Down
106 changes: 0 additions & 106 deletions spec/fixtures/cassettes/braintree/authorize.yml

This file was deleted.

Loading