This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from solidusio/fix_admin_view_error
Fix error when saving braintree payment method
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,35 @@ | |
end | ||
let(:payment_type) { SolidusPaypalBraintree::Source::PAYPAL } | ||
|
||
describe "saving preference hashes as strings" do | ||
subject { gateway.update(update_params) } | ||
|
||
context "with valid hash syntax" do | ||
let(:update_params) do | ||
{ | ||
preferred_merchant_currency_map: '{"EUR" => "test_merchant_account_id"}', | ||
preferred_paypal_payee_email_map: '{"CAD" => "[email protected]"}' | ||
} | ||
end | ||
|
||
it "successfully updates the preference" do | ||
subject | ||
expect(gateway.preferred_merchant_currency_map).to eq({ "EUR" => "test_merchant_account_id" }) | ||
expect(gateway.preferred_paypal_payee_email_map).to eq({ "CAD" => "[email protected]" }) | ||
end | ||
end | ||
|
||
context "with invalid user input" do | ||
let(:update_params) do | ||
{ preferred_merchant_currency_map: '{this_is_not_a_valid_hash}' } | ||
end | ||
|
||
it "raise a JSON parser error" do | ||
expect{ subject }.to raise_error(JSON::ParserError) | ||
end | ||
end | ||
end | ||
|
||
describe 'making a payment on an order', vcr: { cassette_name: 'gateway/complete' } do | ||
include_context 'order ready for payment' | ||
|
||
|