Skip to content
Snippets Groups Projects
Commit 4b6e583c authored by Tiago Botelho's avatar Tiago Botelho
Browse files

adds test suite

parent cd51af1a
No related branches found
No related tags found
No related merge requests found
Showing
with 2 additions and 99 deletions
Loading
@@ -26,4 +26,6 @@ module ServicesHelper
Loading
@@ -26,4 +26,6 @@ module ServicesHelper
event = event.pluralize if %w[merge_request issue confidential_issue].include?(event) event = event.pluralize if %w[merge_request issue confidential_issue].include?(event)
"#{event}_events" "#{event}_events"
end end
extend self
end end
Loading
@@ -48,10 +48,6 @@ http://app.asana.com/-/account_api'
Loading
@@ -48,10 +48,6 @@ http://app.asana.com/-/account_api'
%w(push) %w(push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def client def client
@_client ||= begin @_client ||= begin
Asana::Client.new do |c| Asana::Client.new do |c|
Loading
Loading
Loading
@@ -27,10 +27,6 @@ class AssemblaService < Service
Loading
@@ -27,10 +27,6 @@ class AssemblaService < Service
%w(push) %w(push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
   
Loading
Loading
Loading
@@ -56,10 +56,6 @@ class BambooService < CiService
Loading
@@ -56,10 +56,6 @@ class BambooService < CiService
] ]
end end
   
def self.supported_events
%w(push)
end
def build_page(sha, ref) def build_page(sha, ref)
with_reactive_cache(sha, ref) {|cached| cached[:build_page] } with_reactive_cache(sha, ref) {|cached| cached[:build_page] }
end end
Loading
Loading
Loading
@@ -22,12 +22,4 @@ class BugzillaService < IssueTrackerService
Loading
@@ -22,12 +22,4 @@ class BugzillaService < IssueTrackerService
def self.to_param def self.to_param
'bugzilla' 'bugzilla'
end end
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end end
Loading
@@ -24,14 +24,6 @@ class BuildkiteService < CiService
Loading
@@ -24,14 +24,6 @@ class BuildkiteService < CiService
hook.save hook.save
end end
   
def self.supported_events
%w(push)
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
   
Loading
Loading
Loading
@@ -27,10 +27,6 @@ class BuildsEmailService < Service
Loading
@@ -27,10 +27,6 @@ class BuildsEmailService < Service
%w(build) %w(build)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(push_data) def execute(push_data)
return unless supported_events.include?(push_data[:object_kind]) return unless supported_events.include?(push_data[:object_kind])
return unless should_build_be_notified?(push_data) return unless should_build_be_notified?(push_data)
Loading
Loading
Loading
@@ -28,10 +28,6 @@ class CampfireService < Service
Loading
@@ -28,10 +28,6 @@ class CampfireService < Service
%w(push) %w(push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
   
Loading
Loading
Loading
@@ -12,9 +12,6 @@ class CiService < Service
Loading
@@ -12,9 +12,6 @@ class CiService < Service
%w(push) %w(push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
# Return complete url to build page # Return complete url to build page
# #
# Ex. # Ex.
Loading
Loading
Loading
@@ -36,12 +36,4 @@ class CustomIssueTrackerService < IssueTrackerService
Loading
@@ -36,12 +36,4 @@ class CustomIssueTrackerService < IssueTrackerService
{ type: 'text', name: 'new_issue_url', placeholder: 'New Issue url' } { type: 'text', name: 'new_issue_url', placeholder: 'New Issue url' }
] ]
end end
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end end
Loading
@@ -20,10 +20,6 @@ class EmailsOnPushService < Service
Loading
@@ -20,10 +20,6 @@ class EmailsOnPushService < Service
%w(push tag_push) %w(push tag_push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(push_data) def execute(push_data)
return unless supported_events.include?(push_data[:object_kind]) return unless supported_events.include?(push_data[:object_kind])
   
Loading
Loading
Loading
@@ -33,8 +33,4 @@ class ExternalWikiService < Service
Loading
@@ -33,8 +33,4 @@ class ExternalWikiService < Service
def self.supported_events def self.supported_events
%w() %w()
end end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end end
Loading
@@ -26,10 +26,6 @@ class FlowdockService < Service
Loading
@@ -26,10 +26,6 @@ class FlowdockService < Service
%w(push) %w(push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
   
Loading
Loading
Loading
@@ -27,10 +27,6 @@ class GemnasiumService < Service
Loading
@@ -27,10 +27,6 @@ class GemnasiumService < Service
%w(push) %w(push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
   
Loading
Loading
Loading
@@ -49,10 +49,6 @@ class HipchatService < Service
Loading
@@ -49,10 +49,6 @@ class HipchatService < Service
%w(push issue confidential_issue merge_request note tag_push build) %w(push issue confidential_issue merge_request note tag_push build)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
message = create_message(data) message = create_message(data)
Loading
Loading
Loading
@@ -25,10 +25,6 @@ class IrkerService < Service
Loading
@@ -25,10 +25,6 @@ class IrkerService < Service
%w(push) %w(push)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
   
Loading
Loading
Loading
@@ -16,10 +16,6 @@ class JiraService < IssueTrackerService
Loading
@@ -16,10 +16,6 @@ class JiraService < IssueTrackerService
%w(commit merge_request) %w(commit merge_request)
end end
   
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
# {PROJECT-KEY}-{NUMBER} Examples: JIRA-1, PROJECT-1 # {PROJECT-KEY}-{NUMBER} Examples: JIRA-1, PROJECT-1
def reference_pattern def reference_pattern
@reference_pattern ||= %r{(?<issue>\b([A-Z][A-Z0-9_]+-)\d+)} @reference_pattern ||= %r{(?<issue>\b([A-Z][A-Z0-9_]+-)\d+)}
Loading
Loading
Loading
@@ -158,14 +158,6 @@ class KubernetesService < DeploymentService
Loading
@@ -158,14 +158,6 @@ class KubernetesService < DeploymentService
opts opts
end end
   
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
def kubeclient_auth_options def kubeclient_auth_options
{ bearer_token: token } { bearer_token: token }
end end
Loading
Loading
Loading
@@ -38,12 +38,4 @@ class MattermostService < ChatNotificationService
Loading
@@ -38,12 +38,4 @@ class MattermostService < ChatNotificationService
def default_channel_placeholder def default_channel_placeholder
"#town-square" "#town-square"
end end
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end end
Loading
@@ -48,12 +48,4 @@ class MattermostSlashCommandsService < ChatSlashCommandsService
Loading
@@ -48,12 +48,4 @@ class MattermostSlashCommandsService < ChatSlashCommandsService
method: 'P', method: 'P',
username: 'GitLab') username: 'GitLab')
end end
def self.supported_events
%w()
end
def self.event_names
self.supported_events.map { |event| "#{event}_events" }
end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment