test(support): add contact-admin spec
This commit is contained in:
parent
a9aab27589
commit
7f1764fa66
1 changed files with 25 additions and 0 deletions
|
@ -149,4 +149,29 @@ describe SupportController, type: :controller do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'contact admin' do
|
||||
subject do
|
||||
post :create, params: params
|
||||
end
|
||||
|
||||
let(:params) { { admin: "true", email: "email@pro.fr", subject: 'bonjour', text: 'un message' } }
|
||||
|
||||
describe "when form is filled" do
|
||||
it "creates a conversation on HelpScout" do
|
||||
expect_any_instance_of(Helpscout::FormAdapter).to receive(:send_form).and_return(true)
|
||||
subject
|
||||
expect(flash[:notice]).to match('Votre message a été envoyé.')
|
||||
end
|
||||
end
|
||||
|
||||
describe "when invisible captcha is filled" do
|
||||
let(:params) { super().merge(InvisibleCaptcha.honeypots.sample => 'boom') }
|
||||
|
||||
it 'does not create a conversation on HelpScout' do
|
||||
subject
|
||||
expect(flash[:alert]).to eq(I18n.t('invisible_captcha.sentence_for_humans'))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue