2018-10-10 22:11:52 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe ViewState, type: :model do
|
2019-06-10 18:19:10 +08:00
|
|
|
let(:view_state) { build :view_state, :team }
|
2019-05-08 21:28:07 +08:00
|
|
|
|
|
|
|
it 'is valid' do
|
|
|
|
expect(view_state).to be_valid
|
|
|
|
end
|
|
|
|
|
2018-10-10 22:11:52 +08:00
|
|
|
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
|
|
|
|
end
|