Commit d7568727 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #8283 from cardoe/hipchat-private-server

HipChat custom server support
parents 10d36475 1353f9aa
...@@ -134,7 +134,7 @@ gem "redis-rails" ...@@ -134,7 +134,7 @@ gem "redis-rails"
gem 'tinder', '~> 1.9.2' gem 'tinder', '~> 1.9.2'
# HipChat integration # HipChat integration
gem "hipchat", "~> 0.14.0" gem "hipchat", "~> 1.4.0"
# Flowdock integration # Flowdock integration
gem "gitlab-flowdock-git-hook", "~> 0.4.2" gem "gitlab-flowdock-git-hook", "~> 0.4.2"
......
...@@ -235,8 +235,7 @@ GEM ...@@ -235,8 +235,7 @@ GEM
railties (>= 4.0.1) railties (>= 4.0.1)
hashie (2.1.2) hashie (2.1.2)
hike (1.2.3) hike (1.2.3)
hipchat (0.14.0) hipchat (1.4.0)
httparty
httparty httparty
html-pipeline (1.11.0) html-pipeline (1.11.0)
activesupport (>= 2) activesupport (>= 2)
...@@ -636,7 +635,7 @@ DEPENDENCIES ...@@ -636,7 +635,7 @@ DEPENDENCIES
guard-rspec guard-rspec
guard-spinach guard-spinach
haml-rails haml-rails
hipchat (~> 0.14.0) hipchat (~> 1.4.0)
html-pipeline-gitlab (~> 0.1.0) html-pipeline-gitlab (~> 0.1.0)
httparty httparty
jasmine (= 2.0.2) jasmine (= 2.0.2)
......
...@@ -42,7 +42,7 @@ class Projects::ServicesController < Projects::ApplicationController ...@@ -42,7 +42,7 @@ class Projects::ServicesController < Projects::ApplicationController
:title, :token, :type, :active, :api_key, :subdomain, :title, :token, :type, :active, :api_key, :subdomain,
:room, :recipients, :project_url, :webhook, :room, :recipients, :project_url, :webhook,
:user_key, :device, :priority, :sound, :bamboo_url, :username, :password, :user_key, :device, :priority, :sound, :bamboo_url, :username, :password,
:build_key :build_key, :server
) )
end end
end end
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
class HipchatService < Service class HipchatService < Service
MAX_COMMITS = 3 MAX_COMMITS = 3
prop_accessor :token, :room prop_accessor :token, :room, :server
validates :token, presence: true, if: :activated? validates :token, presence: true, if: :activated?
def title def title
'Hipchat' 'HipChat'
end end
def description def description
...@@ -33,7 +33,9 @@ class HipchatService < Service ...@@ -33,7 +33,9 @@ class HipchatService < Service
def fields def fields
[ [
{ type: 'text', name: 'token', placeholder: '' }, { type: 'text', name: 'token', placeholder: '' },
{ type: 'text', name: 'room', placeholder: '' } { type: 'text', name: 'room', placeholder: '' },
{ type: 'text', name: 'server',
placeholder: 'Leave blank for default. https://chat.hipchat.com' }
] ]
end end
...@@ -44,7 +46,9 @@ class HipchatService < Service ...@@ -44,7 +46,9 @@ class HipchatService < Service
private private
def gate def gate
@gate ||= HipChat::Client.new(token) options = { api_version: 'v2' }
options[:server_url] = server unless server.nil?
@gate ||= HipChat::Client.new(token, options)
end end
def create_message(push) def create_message(push)
......
...@@ -19,6 +19,12 @@ Feature: Project Services ...@@ -19,6 +19,12 @@ Feature: Project Services
And I fill hipchat settings And I fill hipchat settings
Then I should see hipchat service settings saved Then I should see hipchat service settings saved
Scenario: Activate hipchat service with custom server
When I visit project "Shop" services page
And I click hipchat service link
And I fill hipchat settings with custom server
Then I should see hipchat service settings with custom server saved
Scenario: Activate pivotaltracker service Scenario: Activate pivotaltracker service
When I visit project "Shop" services page When I visit project "Shop" services page
And I click pivotaltracker service link And I click pivotaltracker service link
......
...@@ -10,7 +10,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps ...@@ -10,7 +10,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
step 'I should see list of available services' do step 'I should see list of available services' do
page.should have_content 'Project services' page.should have_content 'Project services'
page.should have_content 'Campfire' page.should have_content 'Campfire'
page.should have_content 'Hipchat' page.should have_content 'HipChat'
page.should have_content 'GitLab CI' page.should have_content 'GitLab CI'
page.should have_content 'Assembla' page.should have_content 'Assembla'
page.should have_content 'Pushover' page.should have_content 'Pushover'
...@@ -33,7 +33,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps ...@@ -33,7 +33,7 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
end end
step 'I click hipchat service link' do step 'I click hipchat service link' do
click_link 'Hipchat' click_link 'HipChat'
end end
step 'I fill hipchat settings' do step 'I fill hipchat settings' do
...@@ -47,6 +47,17 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps ...@@ -47,6 +47,17 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
find_field('Room').value.should == 'gitlab' find_field('Room').value.should == 'gitlab'
end end
step 'I fill hipchat settings with custom server' do
check 'Active'
fill_in 'Room', with: 'gitlab_custom'
fill_in 'Token', with: 'secretCustom'
fill_in 'Server', with: 'https://chat.example.com'
click_button 'Save'
end
step 'I should see hipchat service settings with custom server saved' do
find_field('Server').value.should == 'https://chat.example.com'
end
step 'I click pivotaltracker service link' do step 'I click pivotaltracker service link' do
click_link 'PivotalTracker' click_link 'PivotalTracker'
......
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