Sha256: b72ee7185efc11dda01730a1a86d7e66b5e5e28621007a674b7ca2743e781ecd

Contents?: true

Size: 768 Bytes

Versions: 27

Compression:

Stored size: 768 Bytes

Contents

RSpec.describe Spree::Order, type: :model do

  let(:order) { described_class.new }

  context '#associate_user!' do
    let(:user) { build_stubbed(:user, email: 'spree@example.com') }
    before { allow(order).to receive(:save!) { true } }

    it 'associates the order with the specified user' do
      order.associate_user! user
      expect(order.user).to eq user
    end

    it "sets the order's email attribute to that of the specified user" do
      order.associate_user! user
      expect(order.email).to eq user.email
    end

    it 'destroys any previous association with a guest user' do
      guest_user = build_stubbed(:user)
      order.user = guest_user
      order.associate_user! user
      expect(order.user).not_to eq guest_user
    end
  end
end

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
solidus_auth_devise-2.2.0 spec/models/order_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.5 spec/models/order_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.4 spec/models/order_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.3 spec/models/order_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.2 spec/models/order_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0.1 spec/models/order_spec.rb
solidus_auth_devise_devise_token_auth-2.1.0 spec/models/order_spec.rb
solidus_auth_devise-2.1.0 spec/models/order_spec.rb
solidus_auth_devise-2.0.0 spec/models/order_spec.rb
solidus_auth_devise-1.6.4 spec/models/order_spec.rb
solidus_auth_devise-1.6.3 spec/models/order_spec.rb
spree_auth_devise-3.2.0.beta spec/models/order_spec.rb
solidus_auth_devise-1.6.2 spec/models/order_spec.rb
solidus_auth_devise-1.6.1 spec/models/order_spec.rb
solidus_auth_devise-1.6.0 spec/models/order_spec.rb
solidus_auth_devise-1.5.0 spec/models/order_spec.rb
solidus_auth_devise-1.4.0 spec/models/order_spec.rb
spree_auth_devise-3.1.0 spec/models/order_spec.rb
spree_auth_devise-3.0.6 spec/models/order_spec.rb
spree_auth_devise-3.0.5 spec/models/order_spec.rb