mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-25 20:46:12 +10:00
move activated? method to service
This commit is contained in:
@@ -23,10 +23,6 @@ class GitlabCiService < Service
|
||||
|
||||
after_save :compose_service_hook, if: :activated?
|
||||
|
||||
def activated?
|
||||
active
|
||||
end
|
||||
|
||||
def compose_service_hook
|
||||
hook = service_hook || build_service_hook
|
||||
hook.url = [project_url, "/build", "?token=#{token}"].join("")
|
||||
|
||||
@@ -20,4 +20,8 @@ class Service < ActiveRecord::Base
|
||||
has_one :service_hook
|
||||
|
||||
validates :project_id, presence: true
|
||||
|
||||
def activated?
|
||||
active
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,5 +42,9 @@ describe GitlabCiService do
|
||||
describe :commit_status_path do
|
||||
it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"}
|
||||
end
|
||||
|
||||
describe :build_page do
|
||||
it { @service.build_page("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user