Chatwoot/spec/models/note_spec.rb

24 lines
677 B
Ruby
Raw Permalink Normal View History

2021-06-21 09:46:26 +00:00
require 'rails_helper'
RSpec.describe Note, type: :model do
describe 'validations' do
it { is_expected.to validate_presence_of(:content) }
it { is_expected.to validate_presence_of(:account_id) }
it { is_expected.to validate_presence_of(:user_id) }
it { is_expected.to validate_presence_of(:contact_id) }
end
describe 'associations' do
it { is_expected.to belong_to(:account) }
it { is_expected.to belong_to(:user) }
it { is_expected.to belong_to(:contact) }
end
describe 'validates_factory' do
it 'creates valid note object' do
note = create(:note)
expect(note.content).to eq 'Hey welcome to chatwoot'
end
end
end