feat: Enable template variables in channel greeting messages (#6971)
This commit is contained in:
@@ -8,5 +8,26 @@ describe ::MessageTemplates::Template::Greeting do
|
||||
described_class.new(conversation: conversation).perform
|
||||
expect(conversation.messages.count).to eq(1)
|
||||
end
|
||||
|
||||
it 'creates the greeting messages with template variable' do
|
||||
conversation.inbox.update!(greeting_message: 'Hey, {{contact.name}} welcome to our board.')
|
||||
described_class.new(conversation: conversation).perform
|
||||
expect(conversation.messages.count).to eq(1)
|
||||
expect(conversation.messages.last.content).to eq("Hey, #{conversation.contact.name} welcome to our board.")
|
||||
end
|
||||
|
||||
it 'creates the greeting messages with more than one variable strings' do
|
||||
conversation.inbox.update!(greeting_message: 'Hey, {{contact.name}} welcome to our board. - from {{account.name}}')
|
||||
described_class.new(conversation: conversation).perform
|
||||
expect(conversation.messages.count).to eq(1)
|
||||
expect(conversation.messages.last.content).to eq("Hey, #{conversation.contact.name} welcome to our board. - from #{conversation.account.name}")
|
||||
end
|
||||
|
||||
it 'creates the greeting messages' do
|
||||
conversation.inbox.update!(greeting_message: 'Hello welcome to our board.')
|
||||
described_class.new(conversation: conversation).perform
|
||||
expect(conversation.messages.count).to eq(1)
|
||||
expect(conversation.messages.last.content).to eq('Hello welcome to our board.')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,5 +9,22 @@ describe ::MessageTemplates::Template::OutOfOffice do
|
||||
expect(conversation.messages.template.count).to eq(1)
|
||||
expect(conversation.messages.template.first.content).to eq(conversation.inbox.out_of_office_message)
|
||||
end
|
||||
|
||||
it 'creates the out of office messages with template variable' do
|
||||
conversation.inbox.update!(out_of_office_message: 'Hey, {{contact.name}} we are unavailable at the moment.')
|
||||
described_class.new(conversation: conversation).perform
|
||||
expect(conversation.messages.count).to eq(1)
|
||||
expect(conversation.messages.last.content).to eq("Hey, #{conversation.contact.name} we are unavailable at the moment.")
|
||||
end
|
||||
|
||||
it 'creates the out of office messages with more than one variable strings' do
|
||||
conversation.inbox.update!(out_of_office_message:
|
||||
'Hey, {{contact.name}} we are unavailable at the moment. - from {{account.name}}')
|
||||
described_class.new(conversation: conversation).perform
|
||||
expect(conversation.messages.count).to eq(1)
|
||||
expect(conversation.messages.last.content).to eq(
|
||||
"Hey, #{conversation.contact.name} we are unavailable at the moment. - from #{conversation.account.name}"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user