Sha256: a1ee0c4a260e60158339119da200ffe4ebfe4bcc625e68728c9a88f3a56e3164

Contents?: true

Size: 551 Bytes

Versions: 3

Compression:

Stored size: 551 Bytes

Contents

require 'rails_helper'

module ShoppingCart
  RSpec.describe Order, type: :model do
    context 'associations' do
      %i[coupon delivery user].each do |field|
        it { is_expected.to belong_to(field) }
      end
      %i[shipping_address billing_address credit_card].each do |field|
        it { is_expected.to have_one(field).dependent(:destroy) }
      end
      it { is_expected.to have_many(:order_items).dependent(:destroy) }
    end

    context 'validations' do
      it { is_expected.to validate_presence_of(:status) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loker-shopping-cart-0.1.3 spec/models/shopping_cart/order_spec.rb
loker-shopping-cart-0.1.2 spec/models/shopping_cart/order_spec.rb
loker-shopping-cart-0.1.1 spec/models/shopping_cart/order_spec.rb