scinote-web/spec/models/result_text_spec.rb

32 lines
691 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-08-30 00:49:07 +08:00
require 'rails_helper'
describe ResultText, type: :model do
let(:result_text) { build :result_text }
it 'is valid' do
expect(result_text).to be_valid
end
2017-08-30 00:49:07 +08:00
it 'should be of class ResultText' do
expect(subject.class).to eq ResultText
end
describe 'Database table' do
it { should have_db_column :result_id }
it { should have_db_column :text }
end
describe 'Relations' do
it { should belong_to :result }
it { should have_many :tiny_mce_assets }
end
describe 'Validations' do
describe '#text' do
it { is_expected.to validate_length_of(:text).is_at_most(Constants::RICH_TEXT_MAX_LENGTH) }
end
2017-08-30 00:49:07 +08:00
end
end