Commit 1353f9aa authored by Daniel Aquino's avatar Daniel Aquino Committed by Doug Goldstein

HipChat service: support custom servers

HipChat allows users to run their own private servers and to be able to
support those we must connect to the correct URL when using one of these
custom servers.
parent 2f3df4cb
...@@ -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,7 +15,7 @@ ...@@ -15,7 +15,7 @@
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
...@@ -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
...@@ -45,6 +47,7 @@ class HipchatService < Service ...@@ -45,6 +47,7 @@ class HipchatService < Service
def gate def gate
options = { api_version: 'v2' } options = { api_version: 'v2' }
options[:server_url] = server unless server.nil?
@gate ||= HipChat::Client.new(token, options) @gate ||= HipChat::Client.new(token, options)
end end
......
...@@ -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
......
...@@ -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