From 337ae0c8271511eac580eb6e3714f607d706af9b Mon Sep 17 00:00:00 2001 From: Jakub Kuchar Date: Sun, 24 Mar 2019 19:01:57 +0700 Subject: [PATCH 1/2] merge with active merchant option name for test --- app/models/spree/gateway/paymill.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/spree/gateway/paymill.rb b/app/models/spree/gateway/paymill.rb index fab6aca7..3cc6eb02 100644 --- a/app/models/spree/gateway/paymill.rb +++ b/app/models/spree/gateway/paymill.rb @@ -8,5 +8,10 @@ class Gateway::Paymill < Gateway def provider_class ActiveMerchant::Billing::PaymillGateway end + + def options + super().merge(:test => self.preferred_test_mode) + end + end end From b8ba3ef386060ce2beb73b11d4af971b220bc9c4 Mon Sep 17 00:00:00 2001 From: Jakub Kuchar Date: Sun, 24 Mar 2019 19:10:13 +0700 Subject: [PATCH 2/2] added spec for test option --- spec/models/gateway/paymill_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/models/gateway/paymill_spec.rb b/spec/models/gateway/paymill_spec.rb index 3ede99aa..889822bf 100644 --- a/spec/models/gateway/paymill_spec.rb +++ b/spec/models/gateway/paymill_spec.rb @@ -8,4 +8,17 @@ expect(gateway.provider_class).to eq ::ActiveMerchant::Billing::PaymillGateway end end + + describe 'options' do + it 'include :test => true in when :test_mode is true' do + gateway.preferred_test_mode = true + expect(gateway.options[:test]).to be true + end + + it 'does not include :test when test_mode is false' do + gateway.preferred_test_mode = false + expect(gateway.options[:test]).to be false + end + end + end