blob: d9d0c6464c4afa6b3ae69bd5a39c38901ce28d68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Product, type: :model do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:unitary_price) }
it { should validate_presence_of(:bulk_price) }
it { should validate_presence_of(:available_quantity) }
it { should have_one_attached(:picture) }
it { should belong_to(:company) }
it { should serialize(:categories) }
describe '#to_param' do
it "describes the param the product's routes expect" do
product = create(:product, public_id: SecureRandom.hex(12))
expect(product.to_param).to eq(product.public_id)
end
end
end
|