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/flowdock_spec.rb | |
parent | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-ee
Diffstat (limited to 'spec/models/integrations/flowdock_spec.rb')
-rw-r--r-- | spec/models/integrations/flowdock_spec.rb | 20 |
1 files changed, 11 insertions, 9 deletions
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 |