From d6036f08aa94fa5a45b569fc8b9e80f064496bcf Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 3 Jan 2013 09:52:14 +0200 Subject: [PATCH] move activated? method to service --- app/models/gitlab_ci_service.rb | 4 ---- app/models/service.rb | 4 ++++ spec/models/gitlab_ci_service_spec.rb | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/gitlab_ci_service.rb b/app/models/gitlab_ci_service.rb index a2f5634a..0b0b65e2 100644 --- a/app/models/gitlab_ci_service.rb +++ b/app/models/gitlab_ci_service.rb @@ -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("") diff --git a/app/models/service.rb b/app/models/service.rb index 17a7a656..d3486d29 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -20,4 +20,8 @@ class Service < ActiveRecord::Base has_one :service_hook validates :project_id, presence: true + + def activated? + active + end end diff --git a/spec/models/gitlab_ci_service_spec.rb b/spec/models/gitlab_ci_service_spec.rb index 566dbd25..ec43d46b 100644 --- a/spec/models/gitlab_ci_service_spec.rb +++ b/spec/models/gitlab_ci_service_spec.rb @@ -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