Sha256: 20631bec12aa6487bd384c478c24abf7ac03395e46f2416d0954628453c72e0e

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

require 'rails_helper'

module ShoppingCart
  RSpec.describe Address, type: :model do
    context 'associations' do
      it { is_expected.to belong_to(:order) }
    end

    context 'validations' do
      %i[first_name last_name address city zip country phone].each do |field|
        it { is_expected.to validate_presence_of(field) }
      end

      %i[first_name last_name address city].each do |field|
        it { is_expected.to validate_length_of(field).is_at_most(50) }
      end
    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/address_spec.rb
loker-shopping-cart-0.1.2 spec/models/shopping_cart/address_spec.rb
loker-shopping-cart-0.1.1 spec/models/shopping_cart/address_spec.rb