chore: Add contact note model (#2462)
This commit is contained in:
10
spec/factories/notes.rb
Normal file
10
spec/factories/notes.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
FactoryBot.define do
|
||||
factory :note do
|
||||
content { 'Hey welcome to chatwoot' }
|
||||
account
|
||||
user
|
||||
contact
|
||||
end
|
||||
end
|
||||
23
spec/models/note_spec.rb
Normal file
23
spec/models/note_spec.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
Reference in New Issue
Block a user