From 36753b78c065a54d7501f37f69fb49506f26688c Mon Sep 17 00:00:00 2001
From: Tomasz Maczukin <tomasz@maczukin.pl>
Date: Mon, 26 Feb 2018 16:35:08 +0100
Subject: [PATCH] Replace user_readable with human_readable

---
 app/models/ci/build.rb                                  | 2 +-
 app/models/ci/runner.rb                                 | 4 ++--
 app/serializers/build_details_entity.rb                 | 2 +-
 app/views/admin/runners/_runner.html.haml               | 2 +-
 app/views/projects/runners/_form.html.haml              | 4 ++--
 app/views/projects/runners/_runner.html.haml            | 2 +-
 app/views/projects/runners/show.html.haml               | 2 +-
 spec/models/concerns/chronic_duration_attribute_spec.rb | 4 ++--
 8 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 5b9e06ab203..f47cbe0a206 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -91,7 +91,7 @@ module Ci
     after_commit :update_project_statistics_after_save, on: [:create, :update]
     after_commit :update_project_statistics, on: :destroy
 
-    chronic_duration_attr_reader :used_timeout_user_readable, :used_timeout
+    chronic_duration_attr_reader :used_timeout_human_readable, :used_timeout
 
     class << self
       # This is needed for url_for to work,
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index f95afd4c40c..baf57423682 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -9,7 +9,7 @@ module Ci
     ONLINE_CONTACT_TIMEOUT = 1.hour
     UPDATE_DB_RUNNER_INFO_EVERY = 40.minutes
     AVAILABLE_SCOPES = %w[specific shared active paused online].freeze
-    FORM_EDITABLE = %i[description tag_list active run_untagged locked access_level maximum_job_timeout_user_readable].freeze
+    FORM_EDITABLE = %i[description tag_list active run_untagged locked access_level maximum_job_timeout_human_readable].freeze
 
     has_many :builds
     has_many :runner_projects, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
@@ -52,7 +52,7 @@ module Ci
 
     cached_attr_reader :version, :revision, :platform, :architecture, :contacted_at, :ip_address
 
-    chronic_duration_attr :maximum_job_timeout_user_readable, :maximum_job_timeout
+    chronic_duration_attr :maximum_job_timeout_human_readable, :maximum_job_timeout
 
     # Searches for runners matching the given query.
     #
diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb
index d1a4a9561d2..17769790371 100644
--- a/app/serializers/build_details_entity.rb
+++ b/app/serializers/build_details_entity.rb
@@ -6,7 +6,7 @@ class BuildDetailsEntity < JobEntity
   expose :pipeline, using: PipelineEntity
 
   expose :timeout, if: -> (*) { !build.used_timeout.nil? } do |build|
-    { value: build.used_timeout_user_readable,
+    { value: build.used_timeout_human_readable,
       source: build.timeout_source }
   end
 
diff --git a/app/views/admin/runners/_runner.html.haml b/app/views/admin/runners/_runner.html.haml
index 5f0fb5079d9..fc6ad6dfe95 100644
--- a/app/views/admin/runners/_runner.html.haml
+++ b/app/views/admin/runners/_runner.html.haml
@@ -20,7 +20,7 @@
     = runner.ip_address
   %td
     - if runner.defines_maximum_job_timeout?
-      = runner.maximum_job_timeout_user_readable
+      = runner.maximum_job_timeout_human_readable
     - else
       n/a
   %td
diff --git a/app/views/projects/runners/_form.html.haml b/app/views/projects/runners/_form.html.haml
index 8fb8e6e0ebf..7e9435e0110 100644
--- a/app/views/projects/runners/_form.html.haml
+++ b/app/views/projects/runners/_form.html.haml
@@ -40,10 +40,10 @@
     .col-sm-10
       = f.text_field :description, class: 'form-control'
   .form-group
-    = label_tag :maximum_job_timeout_user_readable, class: 'control-label' do
+    = label_tag :maximum_job_timeout_human_readable, class: 'control-label' do
       Maximum job timeout
     .col-sm-10
-      = f.text_field :maximum_job_timeout_user_readable, class: 'form-control'
+      = f.text_field :maximum_job_timeout_human_readable, class: 'form-control'
       .help-block This timeout will take precedence when lower than Project-defined timeout
   .form-group
     = label_tag :tag_list, class: 'control-label' do
diff --git a/app/views/projects/runners/_runner.html.haml b/app/views/projects/runners/_runner.html.haml
index f7c41fe44c0..91d6b172566 100644
--- a/app/views/projects/runners/_runner.html.haml
+++ b/app/views/projects/runners/_runner.html.haml
@@ -37,7 +37,7 @@
     %p.runner-description
       = runner.description
   - if runner.defines_maximum_job_timeout?
-    %p Maximum job timeout: #{runner.maximum_job_timeout_user_readable}
+    %p Maximum job timeout: #{runner.maximum_job_timeout_human_readable}
   - if runner.tag_list.present?
     %p
       - runner.tag_list.sort.each do |tag|
diff --git a/app/views/projects/runners/show.html.haml b/app/views/projects/runners/show.html.haml
index 0d39236680c..67084e3d66a 100644
--- a/app/views/projects/runners/show.html.haml
+++ b/app/views/projects/runners/show.html.haml
@@ -57,7 +57,7 @@
       %td= @runner.description
     %tr
       %td Maximum job timeout
-      %td= @runner.maximum_job_timeout_user_readable
+      %td= @runner.maximum_job_timeout_human_readable
     %tr
       %td Last contact
       %td
diff --git a/spec/models/concerns/chronic_duration_attribute_spec.rb b/spec/models/concerns/chronic_duration_attribute_spec.rb
index 85adfaf4487..0d9b45e36e8 100644
--- a/spec/models/concerns/chronic_duration_attribute_spec.rb
+++ b/spec/models/concerns/chronic_duration_attribute_spec.rb
@@ -26,7 +26,7 @@ end
 
 describe 'ChronicDurationAttribute' do
   let(:source_field) {:maximum_job_timeout}
-  let(:virtual_field) {:maximum_job_timeout_user_readable}
+  let(:virtual_field) {:maximum_job_timeout_human_readable}
   subject {Ci::Runner.new}
 
   it_behaves_like 'ChronicDurationAttribute reader'
@@ -35,7 +35,7 @@ end
 
 describe 'ChronicDurationAttribute - reader' do
   let(:source_field) {:used_timeout}
-  let(:virtual_field) {:used_timeout_user_readable}
+  let(:virtual_field) {:used_timeout_human_readable}
   subject {Ci::Build.new}
 
   it "doesn't contain dynamically created writer method" do
-- 
2.30.9