Sha256: dae39c45d29739fc4180982d0655ff9365ad7ae00d743aad26b750985ffa991a

Contents?: true

Size: 862 Bytes

Versions: 7

Compression:

Stored size: 862 Bytes

Contents

require 'spec_helper'

describe Product do
  describe 'schema' do
    it { expect(subject).to have_db_column(:name).of_type(:string) }
    it { expect(subject).to have_db_column(:category_id).of_type(:integer) }
    it { expect(subject).to have_db_column(:slug).of_type(:string) }
    it { expect(subject).to have_db_column(:description).of_type(:text) }
    it { expect(subject).to have_db_column(:price).of_type(:float) }
    it { expect(subject).to have_db_column(:description).of_type(:text) }
  end

  describe 'associations' do
    it { expect(subject).to belong_to(:category) }
    it { expect(subject).to have_many(:images) }
  end

  describe 'validations' do
    it { expect(subject).to validate_presence_of(:name) }
    it { expect(subject).to validate_presence_of(:category_id) }
    it { expect(subject).to validate_presence_of(:price) }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
power_shop-0.2.4 spec/models/product_spec.rb
power_shop-0.2.3 spec/models/product_spec.rb
power_shop-0.2.2 spec/models/product_spec.rb
power_shop-0.2.1 spec/models/product_spec.rb
power_shop-0.2.0 spec/models/product_spec.rb
power_shop-0.1.1 spec/models/product_spec.rb
power_shop-0.1.0 spec/models/product_spec.rb