Commit d6036f08aa94fa5a45b569fc8b9e80f064496bcf
1 parent
ce84e3f4
Exists in
master
and in
4 other branches
move activated? method to service
Showing
3 changed files
with
8 additions
and
4 deletions
Show diff stats
app/models/gitlab_ci_service.rb
| @@ -23,10 +23,6 @@ class GitlabCiService < Service | @@ -23,10 +23,6 @@ class GitlabCiService < Service | ||
| 23 | 23 | ||
| 24 | after_save :compose_service_hook, if: :activated? | 24 | after_save :compose_service_hook, if: :activated? |
| 25 | 25 | ||
| 26 | - def activated? | ||
| 27 | - active | ||
| 28 | - end | ||
| 29 | - | ||
| 30 | def compose_service_hook | 26 | def compose_service_hook |
| 31 | hook = service_hook || build_service_hook | 27 | hook = service_hook || build_service_hook |
| 32 | hook.url = [project_url, "/build", "?token=#{token}"].join("") | 28 | hook.url = [project_url, "/build", "?token=#{token}"].join("") |
app/models/service.rb
| @@ -20,4 +20,8 @@ class Service < ActiveRecord::Base | @@ -20,4 +20,8 @@ class Service < ActiveRecord::Base | ||
| 20 | has_one :service_hook | 20 | has_one :service_hook |
| 21 | 21 | ||
| 22 | validates :project_id, presence: true | 22 | validates :project_id, presence: true |
| 23 | + | ||
| 24 | + def activated? | ||
| 25 | + active | ||
| 26 | + end | ||
| 23 | end | 27 | end |
spec/models/gitlab_ci_service_spec.rb
| @@ -42,5 +42,9 @@ describe GitlabCiService do | @@ -42,5 +42,9 @@ describe GitlabCiService do | ||
| 42 | describe :commit_status_path do | 42 | describe :commit_status_path do |
| 43 | it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"} | 43 | it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"} |
| 44 | end | 44 | end |
| 45 | + | ||
| 46 | + describe :build_page do | ||
| 47 | + it { @service.build_page("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c"} | ||
| 48 | + end | ||
| 45 | end | 49 | end |
| 46 | end | 50 | end |