From 7f0116768188118d9291de3dc2f62af2d40795b9 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 25 May 2017 20:53:03 +0800 Subject: [PATCH] Fix tests and rubocop offense --- app/models/ci/build.rb | 2 +- spec/features/variables_spec.rb | 4 ++-- spec/lib/gitlab/utils_spec.rb | 6 +++++- 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')