Commit 7f011676 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Fix tests and rubocop offense

parent ef10f4c5
...@@ -188,7 +188,7 @@ module Ci ...@@ -188,7 +188,7 @@ module Ci
variables += project.secret_variables variables += project.secret_variables
variables += project.protected_variables if variables += project.protected_variables if
ProtectedBranch.protected?(project, ref) || ProtectedBranch.protected?(project, ref) ||
ProtectedTag.protected?(project, ref) ProtectedTag.protected?(project, ref)
variables += trigger_request.user_variables if trigger_request variables += trigger_request.user_variables if trigger_request
variables variables
end end
......
...@@ -136,10 +136,10 @@ describe 'Project variables', js: true do ...@@ -136,10 +136,10 @@ describe 'Project variables', js: true do
end end
expect(page).to have_content('Update variable') expect(page).to have_content('Update variable')
check('Protected') uncheck('Protected')
click_button('Save variable') click_button('Save variable')
expect(page).to have_content('Variable was successfully updated.') 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
end end
require 'spec_helper'
describe Gitlab::Utils, lib: true do 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 describe '.to_boolean' do
it 'accepts booleans' do it 'accepts booleans' do
...@@ -29,7 +31,9 @@ describe Gitlab::Utils, lib: true do ...@@ -29,7 +31,9 @@ describe Gitlab::Utils, lib: true do
expect(to_boolean('')).to be_nil expect(to_boolean('')).to be_nil
expect(to_boolean(nil)).to be_nil expect(to_boolean(nil)).to be_nil
end end
end
describe '.boolean_to_yes_no' do
it 'converts booleans to Yes or No' do it 'converts booleans to Yes or No' do
expect(boolean_to_yes_no(true)).to eq('Yes') expect(boolean_to_yes_no(true)).to eq('Yes')
expect(boolean_to_yes_no(false)).to eq('No') expect(boolean_to_yes_no(false)).to eq('No')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment