summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-05-25 20:53:03 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-05-25 20:53:03 +0800
commit7f0116768188118d9291de3dc2f62af2d40795b9 (patch)
tree5d93729f8cfa2cdfeb993ae2f09d36cc1fe7b946
parentef10f4c53139ead567b12a2daf8832f02240d0fa (diff)
downloadgitlab-ce-7f0116768188118d9291de3dc2f62af2d40795b9.tar.gz
Fix tests and rubocop offense
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--spec/features/variables_spec.rb4
-rw-r--r--spec/lib/gitlab/utils_spec.rb6
3 files changed, 8 insertions, 4 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index a43c8243bcb..81be74a5f23 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -188,7 +188,7 @@ module Ci
variables += project.secret_variables
variables += project.protected_variables if
ProtectedBranch.protected?(project, ref) ||
- ProtectedTag.protected?(project, ref)
+ ProtectedTag.protected?(project, ref)
variables += trigger_request.user_variables if trigger_request
variables
end
diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb
index 08a2df63a40..5a5922d5f02 100644
--- a/spec/features/variables_spec.rb
+++ b/spec/features/variables_spec.rb
@@ -136,10 +136,10 @@ describe 'Project variables', js: true do
end
expect(page).to have_content('Update variable')
- check('Protected')
+ uncheck('Protected')
click_button('Save variable')
expect(page).to have_content('Variable was successfully updated.')
- expect(project.variables.first).not_to be_protected
+ expect(project.reload.variables.first).not_to be_protected
end
end
diff --git a/spec/lib/gitlab/utils_spec.rb b/spec/lib/gitlab/utils_spec.rb
index b1959550a4a..00941aec380 100644
--- a/spec/lib/gitlab/utils_spec.rb
+++ b/spec/lib/gitlab/utils_spec.rb
@@ -1,5 +1,7 @@
+require 'spec_helper'
+
describe Gitlab::Utils, lib: true do
- delegate :to_boolean, to: :described_class
+ delegate :to_boolean, :boolean_to_yes_no, to: :described_class
describe '.to_boolean' do
it 'accepts booleans' do
@@ -29,7 +31,9 @@ describe Gitlab::Utils, lib: true do
expect(to_boolean('')).to be_nil
expect(to_boolean(nil)).to be_nil
end
+ end
+ describe '.boolean_to_yes_no' do
it 'converts booleans to Yes or No' do
expect(boolean_to_yes_no(true)).to eq('Yes')
expect(boolean_to_yes_no(false)).to eq('No')