summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoyan Tabakov <boyan.tabakov@futurice.com>2015-08-14 15:31:11 +0200
committerBoyan Tabakov <boyan.tabakov@futurice.com>2015-08-14 16:45:23 +0200
commit88ab815b3844ce5c611d0ee5a1e8aaacb6c92faa (patch)
tree073f602bcad00cd1b26a03c236819010ce3d1a12
parentb6bdd650a54306c3f56f8332a64a3f5194ee793d (diff)
downloadgitlab-ce-88ab815b3844ce5c611d0ee5a1e8aaacb6c92faa.tar.gz
Update Flowdock integration to support new Flowdock API
Requires that users create a Git source in their flows and update the configured token to the Git source token. The old flow tokens can't be used.
-rw-r--r--CHANGELOG1
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock10
-rw-r--r--app/models/project_services/flowdock_service.rb2
-rw-r--r--spec/models/project_services/flowdock_service_spec.rb12
5 files changed, 18 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index f4abb5f5eb5..b5cf393c6a6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -56,6 +56,7 @@ v 7.14.0 (unreleased)
- Detect .mkd and .mkdn files as markdown (Ben Boeckel)
- Fix: User search feature in admin area does not respect filters
- Set max-width for README, issue and merge request description for easier read on big screens
+ - Update Flowdock integration to support new Flowdock API (Boyan Tabakov)
v 7.13.5
- Satellites reverted
diff --git a/Gemfile b/Gemfile
index 2483a7d24a3..6933930e253 100644
--- a/Gemfile
+++ b/Gemfile
@@ -150,7 +150,7 @@ gem 'tinder', '~> 1.9.2'
gem 'hipchat', '~> 1.5.0'
# Flowdock integration
-gem "gitlab-flowdock-git-hook", "~> 0.4.2"
+gem "gitlab-flowdock-git-hook", "~> 1.0.1"
# Gemnasium integration
gem "gemnasium-gitlab-service", "~> 0.2"
diff --git a/Gemfile.lock b/Gemfile.lock
index bff605df65e..043364a9689 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -183,6 +183,9 @@ GEM
ffi (1.9.8)
fission (0.5.0)
CFPropertyList (~> 2.2)
+ flowdock (0.7.0)
+ httparty (~> 0.7)
+ multi_json
fog (1.25.0)
fog-brightbox (~> 0.4)
fog-core (~> 1.25)
@@ -255,7 +258,8 @@ GEM
racc
github-markup (1.3.1)
posix-spawn (~> 0.3.8)
- gitlab-flowdock-git-hook (0.4.2.2)
+ gitlab-flowdock-git-hook (1.0.1)
+ flowdock (~> 0.7)
gitlab-grit (>= 2.4.1)
multi_json
gitlab-grack (2.0.2)
@@ -779,7 +783,7 @@ DEPENDENCIES
fuubar (~> 2.0.0)
gemnasium-gitlab-service (~> 0.2)
github-markup
- gitlab-flowdock-git-hook (~> 0.4.2)
+ gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-grack (~> 2.0.2)
gitlab-linguist (~> 3.0.1)
gitlab_emoji (~> 0.1)
@@ -875,4 +879,4 @@ DEPENDENCIES
wikicloth (= 0.8.1)
BUNDLED WITH
- 1.10.5
+ 1.10.6
diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb
index bf801ba61ad..27fc19379f1 100644
--- a/app/models/project_services/flowdock_service.rb
+++ b/app/models/project_services/flowdock_service.rb
@@ -38,7 +38,7 @@ class FlowdockService < Service
def fields
[
- { type: 'text', name: 'token', placeholder: '' }
+ { type: 'text', name: 'token', placeholder: 'Flowdock Git source token' }
]
end
diff --git a/spec/models/project_services/flowdock_service_spec.rb b/spec/models/project_services/flowdock_service_spec.rb
index 7e5b15cb09e..16296607a94 100644
--- a/spec/models/project_services/flowdock_service_spec.rb
+++ b/spec/models/project_services/flowdock_service_spec.rb
@@ -39,15 +39,19 @@ describe FlowdockService do
token: 'verySecret'
)
@sample_data = Gitlab::PushDataBuilder.build_sample(project, user)
- @api_url = 'https://api.flowdock.com/v1/git/verySecret'
+ @api_url = 'https://api.flowdock.com/v1/messages'
WebMock.stub_request(:post, @api_url)
end
it "should call FlowDock API" do
@flowdock_service.execute(@sample_data)
- expect(WebMock).to have_requested(:post, @api_url).with(
- body: /#{@sample_data[:before]}.*#{@sample_data[:after]}.*#{project.path}/
- ).once
+ @sample_data[:commits].each do |commit|
+ # One request to Flowdock per new commit
+ next if commit[:id] == @sample_data[:before]
+ expect(WebMock).to have_requested(:post, @api_url).with(
+ body: /#{commit[:id]}.*#{project.path}/
+ ).once
+ end
end
end
end