summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-08-29 20:39:27 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-08-29 20:39:27 +0300
commit0130cdebf6d51814e4a2f616ff2a8488ef5f00ef (patch)
treeb012549fe324201612d6547d89a733fb81c52def
parent95635d0c2034d8bed96d38ec08f441b1b909ef0c (diff)
parent02de28592f9da956e4d9c3aa9cb813519268a50e (diff)
downloadgitlab-ci-0130cdebf6d51814e4a2f616ff2a8488ef5f00ef.tar.gz
Merge branch 'master' of github.com:gitlabhq/gitlab-ci
-rw-r--r--app/models/runner.rb17
-rw-r--r--app/views/runner_projects/index.html.haml4
-rw-r--r--spec/models/runner_spec.rb28
3 files changed, 36 insertions, 13 deletions
diff --git a/app/models/runner.rb b/app/models/runner.rb
index 3c3362d..178a4c3 100644
--- a/app/models/runner.rb
+++ b/app/models/runner.rb
@@ -2,11 +2,12 @@
#
# Table name: runners
#
-# id :integer not null, primary key
-# token :string(255)
-# public_key :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# id :integer not null, primary key
+# token :string(255)
+# public_key :text
+# created_at :datetime not null
+# updated_at :datetime not null
+# description :string(255)
#
class Runner < ActiveRecord::Base
@@ -42,4 +43,10 @@ class Runner < ActiveRecord::Base
logger.warn "Assign runner to project failed: #{ex}"
false
end
+
+ def display_name
+ return token unless !description.blank?
+
+ description
+ end
end
diff --git a/app/views/runner_projects/index.html.haml b/app/views/runner_projects/index.html.haml
index 98611d5..eb9395d 100644
--- a/app/views/runner_projects/index.html.haml
+++ b/app/views/runner_projects/index.html.haml
@@ -7,7 +7,7 @@
%table.table
%tr
%th Runner ID
- %th Runner Token
+ %th Runner Description
%th Last build
%th Builds Stats
%th Registered
@@ -20,7 +20,7 @@
%td
%span.badge.badge-info= runner.id
%td
- = runner.token
+ = runner.display_name
%td
- last_build = builds.last
- if last_build
diff --git a/spec/models/runner_spec.rb b/spec/models/runner_spec.rb
index 97d5e54..3703de0 100644
--- a/spec/models/runner_spec.rb
+++ b/spec/models/runner_spec.rb
@@ -2,15 +2,31 @@
#
# Table name: runners
#
-# id :integer not null, primary key
-# token :string(255)
-# public_key :text
-# created_at :datetime not null
-# updated_at :datetime not null
+# id :integer not null, primary key
+# token :string(255)
+# public_key :text
+# created_at :datetime not null
+# updated_at :datetime not null
+# description :string(255)
#
require 'spec_helper'
describe Runner do
- pending "add some examples to (or delete) #{__FILE__}"
+ describe '#display_name' do
+ it 'should return the description if it has a value' do
+ runner = FactoryGirl.build(:runner, description: 'Linux/Ruby-1.9.3-p448')
+ expect(runner.display_name).to eq 'Linux/Ruby-1.9.3-p448'
+ end
+
+ it 'should return the token if it does not have a description' do
+ runner = FactoryGirl.build(:runner)
+ expect(runner.display_name).to eq runner.token
+ end
+
+ it 'should return the token if the description is an empty string' do
+ runner = FactoryGirl.build(:runner, description: '')
+ expect(runner.display_name).to eq runner.token
+ end
+ end
end