mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 15:05:26 +08:00
28 lines
739 B
Ruby
28 lines
739 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe ViewState, type: :model do
|
|
it 'should be of class ViewState' do
|
|
expect(subject.class).to eq ViewState
|
|
end
|
|
|
|
describe 'Database table' do
|
|
it { should have_db_column :state }
|
|
it { should have_db_column :user_id }
|
|
it { should have_db_column :viewable_type }
|
|
it { should have_db_column :viewable_id }
|
|
it { should have_db_column :created_at }
|
|
it { should have_db_column :updated_at }
|
|
end
|
|
|
|
describe 'Relations' do
|
|
it { should belong_to :user }
|
|
it { should belong_to :viewable }
|
|
end
|
|
|
|
describe 'Should be a valid object' do
|
|
it { should validate_presence_of :user }
|
|
it { should validate_presence_of :viewable }
|
|
end
|
|
end
|