26 lines
570 B
Ruby
26 lines
570 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: categories
|
|
#
|
|
# id :bigint not null, primary key
|
|
# name :string
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_categories_on_name (name) UNIQUE
|
|
#
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe(Category, type: :model) do
|
|
describe "associations" do
|
|
it { is_expected.to(have_many(:subjects)) }
|
|
end
|
|
|
|
describe "validations" do
|
|
it { is_expected.to(validate_presence_of(:name)) }
|
|
it { is_expected.to(validate_uniqueness_of(:name)) }
|
|
end
|
|
end
|