Sha256: 79d858dbaddab513f423c7e03ac1f5d657e0f2e9d27ec7b20f54468af41111a9

Contents?: true

Size: 767 Bytes

Versions: 33

Compression:

Stored size: 767 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

33 entries across 33 versions & 1 rubygems

Version Path
spree_auth_devise-4.6.3 spec/models/order_spec.rb
spree_auth_devise-4.6.2 spec/models/order_spec.rb
spree_auth_devise-4.6.1 spec/models/order_spec.rb
spree_auth_devise-4.6.0 spec/models/order_spec.rb
spree_auth_devise-4.5.0 spec/models/order_spec.rb
spree_auth_devise-4.4.2 spec/models/order_spec.rb
spree_auth_devise-4.0.1 spec/models/order_spec.rb
spree_auth_devise-4.1.1 spec/models/order_spec.rb
spree_auth_devise-4.2.1 spec/models/order_spec.rb
spree_auth_devise-4.4.1 spec/models/order_spec.rb
spree_auth_devise-4.4.0 spec/models/order_spec.rb
spree_auth_devise-4.3.4 spec/models/order_spec.rb
spree_auth_devise-4.3.3 spec/models/order_spec.rb
spree_auth_devise-4.3.2 spec/models/order_spec.rb
spree_auth_devise-4.3.1 spec/models/order_spec.rb
spree_auth_devise-4.3.0 spec/models/order_spec.rb
spree_auth_devise-4.2.0 spec/models/order_spec.rb
spree_auth_devise-4.1.0 spec/models/order_spec.rb
spree_auth_devise-4.1.0.rc1 spec/models/order_spec.rb
spree_auth_devise-4.0.0 spec/models/order_spec.rb