Add admin support contact form

This commit is contained in:
Paul Chavard 2018-11-28 15:19:12 +01:00
parent 5053d4a7d9
commit b9af07b845
7 changed files with 155 additions and 4 deletions

View file

@ -66,5 +66,45 @@ describe Helpscout::FormAdapter do
.with(conversation_id, nil, nil)
end
end
context 'add_phone' do
before do
allow(api).to receive(:create_conversation)
.and_return(
double(
success?: true,
headers: {
'Resource-ID' => conversation_id
}
)
)
described_class.new(params, api).send_form
end
let(:params) {
{
email: email,
subject: subject,
text: text,
phone: '0666666666'
}
}
let(:phone) { '0666666666' }
let(:email) { 'paul.chavard@beta.gouv.fr' }
let(:subject) { 'Bonjour' }
let(:text) { "J'ai un problem" }
let(:tags) { ['info demarche'] }
let(:conversation_id) { '123' }
it 'should call method' do
expect(api).to have_received(:create_conversation)
.with(email, subject, text, nil)
expect(api).to have_received(:add_phone_number)
.with(email, phone)
expect(api).to have_received(:add_custom_fields)
.with(conversation_id, nil, nil)
end
end
end
end