1
0
mirror of https://github.com/danbee/danbarberphoto synced 2025-03-04 08:49:07 +00:00
danbarberphoto/spec/models/category_spec.rb
Dan Barber cb8ce557ae Fix all the things!
* Update factories
* Switch to Firefox headless with Selenium
* Fix shoulda setup
2021-07-17 16:28:32 -05:00

16 lines
504 B
Ruby

require "spec_helper"
describe Category, type: :model do
it { is_expected.to have_and_belong_to_many(:photos) }
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:slug) }
it { is_expected.to validate_uniqueness_of(:name) }
it { is_expected.to validate_uniqueness_of(:slug) }
let(:category) { create(:category, name: "A Test Category") }
it "should have a slug generated from name" do
expect(category.slug).to eql("a-test-category")
end
end