diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-17 13:07:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-17 13:07:47 +0300 |
commit | d670c3006e6e44901bce0d53cc4768d1d80ffa92 (patch) | |
tree | 8f65743c232e5b76850c4cc264ba15e1185815ff /spec/models/integrations | |
parent | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-ee
Diffstat (limited to 'spec/models/integrations')
-rw-r--r-- | spec/models/integrations/emails_on_push_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/integrations/flowdock_spec.rb | 20 |
2 files changed, 15 insertions, 13 deletions
diff --git a/spec/models/integrations/emails_on_push_spec.rb b/spec/models/integrations/emails_on_push_spec.rb index ca060f4155e..c82d4bdff9b 100644 --- a/spec/models/integrations/emails_on_push_spec.rb +++ b/spec/models/integrations/emails_on_push_spec.rb @@ -88,7 +88,7 @@ RSpec.describe Integrations::EmailsOnPush do describe '#execute' do let(:push_data) { { object_kind: 'push' } } let(:project) { create(:project, :repository) } - let(:service) { create(:emails_on_push_service, project: project) } + let(:integration) { create(:emails_on_push_integration, project: project) } let(:recipients) { 'test@gitlab.com' } before do @@ -105,7 +105,7 @@ RSpec.describe Integrations::EmailsOnPush do it 'sends email' do expect(EmailsOnPushWorker).not_to receive(:perform_async) - service.execute(push_data) + integration.execute(push_data) end end @@ -119,7 +119,7 @@ RSpec.describe Integrations::EmailsOnPush do it 'does not send email' do expect(EmailsOnPushWorker).not_to receive(:perform_async) - service.execute(push_data) + integration.execute(push_data) end end @@ -128,7 +128,7 @@ RSpec.describe Integrations::EmailsOnPush do expect(project).to receive(:emails_disabled?).and_return(true) expect(EmailsOnPushWorker).not_to receive(:perform_async) - service.execute(push_data) + integration.execute(push_data) end end diff --git a/spec/models/integrations/flowdock_spec.rb b/spec/models/integrations/flowdock_spec.rb index 2de6f7dd2f1..189831fa32d 100644 --- a/spec/models/integrations/flowdock_spec.rb +++ b/spec/models/integrations/flowdock_spec.rb @@ -29,27 +29,29 @@ RSpec.describe Integrations::Flowdock do describe "Execute" do let(:user) { create(:user) } let(:project) { create(:project, :repository) } + let(:sample_data) { Gitlab::DataBuilder::Push.build_sample(project, user) } + let(:api_url) { 'https://api.flowdock.com/v1/messages' } + + subject(:flowdock_integration) { described_class.new } before do - @flowdock_service = described_class.new - allow(@flowdock_service).to receive_messages( + allow(flowdock_integration).to receive_messages( project_id: project.id, project: project, service_hook: true, token: 'verySecret' ) - @sample_data = Gitlab::DataBuilder::Push.build_sample(project, user) - @api_url = 'https://api.flowdock.com/v1/messages' - WebMock.stub_request(:post, @api_url) + WebMock.stub_request(:post, api_url) end it "calls FlowDock API" do - @flowdock_service.execute(@sample_data) - @sample_data[:commits].each do |commit| + flowdock_integration.execute(sample_data) + + sample_data[:commits].each do |commit| # One request to Flowdock per new commit - next if commit[:id] == @sample_data[:before] + next if commit[:id] == sample_data[:before] - expect(WebMock).to have_requested(:post, @api_url).with( + expect(WebMock).to have_requested(:post, api_url).with( body: /#{commit[:id]}.*#{project.path}/ ).once end |