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

Use Spree user class handle #82

Merged
merged 1 commit into from
May 5, 2017
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
2 changes: 1 addition & 1 deletion app/models/solidus_paypal_braintree/customer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SolidusPaypalBraintree::Customer < ApplicationRecord
belongs_to :user, class_name: "Spree::User"
belongs_to :user, class_name: Spree::UserClassHandle.new
has_many :sources, class_name: "SolidusPaypalBraintree::Source", inverse_of: :customer
end
2 changes: 1 addition & 1 deletion app/models/solidus_paypal_braintree/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Source < ApplicationRecord
APPLE_PAY = "ApplePayCard"
CREDIT_CARD = "CreditCard"

belongs_to :user, class_name: "Spree::User"
belongs_to :user, class_name: Spree::UserClassHandle.new
belongs_to :payment_method, class_name: 'Spree::PaymentMethod'
has_many :payments, as: :source, class_name: "Spree::Payment"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
end

context 'order has a user' do
let(:user) { Spree::User.new }
let(:user) { Spree.user_class.new }
let(:order) { Spree::Order.new user: user }

it 'associates user to the source' do
Expand All @@ -70,7 +70,7 @@
it { is_expected.to be_nil }

context 'when order has a user' do
let(:user) { Spree::User.new }
let(:user) { Spree.user_class.new }
let(:order) { Spree::Order.new user: user }

it { is_expected.to eq user }
Expand Down