diff options
Diffstat (limited to 'spec/models/project_services/discord_service_spec.rb')
-rw-r--r-- | spec/models/project_services/discord_service_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/models/project_services/discord_service_spec.rb b/spec/models/project_services/discord_service_spec.rb index 96ac532dcd1..b5a54676dd7 100644 --- a/spec/models/project_services/discord_service_spec.rb +++ b/spec/models/project_services/discord_service_spec.rb @@ -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') |