Skip to content

Commit d6036f0

Browse files
committed
move activated? method to service
1 parent ce84e3f commit d6036f0

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

app/models/gitlab_ci_service.rb

-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ class GitlabCiService < Service
2323

2424
after_save :compose_service_hook, if: :activated?
2525

26-
def activated?
27-
active
28-
end
29-
3026
def compose_service_hook
3127
hook = service_hook || build_service_hook
3228
hook.url = [project_url, "/build", "?token=#{token}"].join("")

app/models/service.rb

+4
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ class Service < ActiveRecord::Base
2020
has_one :service_hook
2121

2222
validates :project_id, presence: true
23+
24+
def activated?
25+
active
26+
end
2327
end

spec/models/gitlab_ci_service_spec.rb

+4
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,9 @@
4242
describe :commit_status_path do
4343
it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"}
4444
end
45+
46+
describe :build_page do
47+
it { @service.build_page("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c"}
48+
end
4549
end
4650
end

0 commit comments

Comments
 (0)