diff --git a/app/models/spree/payment_method/customer_credit.rb b/app/models/spree/payment_method/customer_credit.rb index e902d2c952..2fdd9e1500 100644 --- a/app/models/spree/payment_method/customer_credit.rb +++ b/app/models/spree/payment_method/customer_credit.rb @@ -3,6 +3,15 @@ module Spree class PaymentMethod class CustomerCredit < Spree::PaymentMethod + # Name and description are translatable string, to allow instances to customise them + def name + "credit_payment_method.name" + end + + def description + "credit_payment_method.description" + end + def actions %w{internal_void} end diff --git a/spec/factories/payment_method_factory.rb b/spec/factories/payment_method_factory.rb index 5b02f81ade..97006a4a98 100644 --- a/spec/factories/payment_method_factory.rb +++ b/spec/factories/payment_method_factory.rb @@ -31,10 +31,7 @@ FactoryBot.define do end factory :customer_credit_payment_method, class: Spree::PaymentMethod::CustomerCredit do - name { Rails.application.config.credit_payment_method[:name] } - description { Rails.application.config.credit_payment_method[:description] } environment { 'test' } internal { true } - distributors { [Enterprise.is_distributor.first || FactoryBot.create(:distributor_enterprise)] } end end diff --git a/spec/models/spree/payment_method/customer_credit_spec.rb b/spec/models/spree/payment_method/customer_credit_spec.rb index 605f7cb12e..8c97a0aadd 100644 --- a/spec/models/spree/payment_method/customer_credit_spec.rb +++ b/spec/models/spree/payment_method/customer_credit_spec.rb @@ -5,6 +5,14 @@ require "spec_helper" RSpec.describe Spree::PaymentMethod::CustomerCredit do subject { build(:customer_credit_payment_method) } + describe "#name" do + it { expect(subject.name).to eq("credit_payment_method.name") } + end + + describe "#description" do + it { expect(subject.description).to eq("credit_payment_method.description") } + end + describe "#purchase" do let(:response) { subject.purchase(amount, nil, options) }