Commit e2cbc4ed authored by Arturo Herrero's avatar Arturo Herrero

Add discord spec to check the embed parameters

parent ba8c4c63
......@@ -31,6 +31,24 @@ describe DiscordService do
WebMock.stub_request(:post, webhook_url)
end
it 'uses the right embed parameters' do
builder = Discordrb::Webhooks::Builder.new
allow_next_instance_of(Discordrb::Webhooks::Client) do |client|
allow(client).to receive(:execute).and_yield(builder)
end
subject.execute(sample_data)
expect(builder.to_json_hash[:embeds].first).to include(
description: start_with("#{user.name} pushed to branch [master](http://localhost/#{project.namespace.path}/#{project.path}/commits/master) of"),
author: hash_including(
icon_url: start_with('https://www.gravatar.com/avatar/'),
name: user.name
)
)
end
context 'DNS rebind to local address' do
before do
stub_dns(webhook_url, ip_address: '192.168.2.120')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment