Sha256: a05d1bdb3015495dcd727009fda87c23361151dd4445aae0c880eb179f23f802

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

require 'rails_helper'

module Shopper
  RSpec.describe OrderItem, type: :model do
    describe 'Associations' do
      it { should belong_to(:order) }
      it { should belong_to(:product) }
    end

    describe 'Validation' do
      it { should validate_presence_of(:order) }
      it { should validate_presence_of(:product) }
      it { should validate_presence_of(:quantity) }

      it { should validate_numericality_of(:quantity).only_integer.is_greater_than_or_equal_to(1) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoppper-0.1.0 spec/models/shopper/order_item_spec.rb