Fix tests and rubocop offense

This commit is contained in:
Lin Jen-Shin 2017-05-25 20:53:03 +08:00
parent ef10f4c531
commit 7f01167681
3 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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')