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

Commit

Permalink
Merge pull request #82 from tvdeyen/user-class-handle
Browse files Browse the repository at this point in the history
Use Spree user class handle
  • Loading branch information
adammathys authored May 5, 2017
2 parents 5c0dbed + 2c10c26 commit d770809
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit d770809

Please sign in to comment.