feat: Add support for template variables in messages content (#6215)

Fixes: #6078

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Muhsin Keloth
2023-01-10 16:00:34 +05:30
committed by GitHub
parent e7a52c3a46
commit 078ff615ee
8 changed files with 177 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
require 'rails_helper'
describe ::ContactDrop do
subject(:contact_drop) { described_class.new(contact) }
let!(:contact) { create(:contact) }
context 'when first name' do
it 'returns first name' do
contact.update!(name: 'John Doe')
expect(subject.first_name).to eq 'John'
end
end
context 'when last name' do
it 'returns the last name' do
contact.update!(name: 'John Doe')
expect(subject.last_name).to eq 'Doe'
end
it 'returns empty when last name not present' do
contact.update!(name: 'John')
expect(subject.last_name).to be_nil
end
end
end

View File

@@ -0,0 +1,26 @@
require 'rails_helper'
describe ::UserDrop do
subject(:user_drop) { described_class.new(user) }
let!(:user) { create(:user) }
context 'when first name' do
it 'returns first name' do
user.update!(name: 'John Doe')
expect(subject.first_name).to eq 'John'
end
end
context 'when last name' do
it 'returns the last name' do
user.update!(name: 'John Doe')
expect(subject.last_name).to eq 'Doe'
end
it 'returns empty when last name not present' do
user.update!(name: 'John')
expect(subject.last_name).to be_nil
end
end
end