diff options
author | Rémy Coutable <remy@rymai.me> | 2017-02-22 16:12:26 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-22 16:12:26 +0300 |
commit | b3bece948d9ca4708cf6bc441317dbf7f7534e73 (patch) | |
tree | 4dc58e980c8657091850a54af33d371638d4cc95 /spec | |
parent | 9aaf38d6cfc67652f0239b25eae36ab6517ea02f (diff) | |
parent | 4f115a090a931c3999f6b51d9fa027165b96b618 (diff) |
Merge branch 'lnovy/gitlab-ce-empty-variables' into 'master'
UI: Allow a project variable to be set to an empty value
See merge request !9414
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/variables_spec.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index 9a4bc027004..a362d6fd3b6 100644 --- a/spec/features/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'Project variables', js: true do let(:user) { create(:user) } let(:project) { create(:project) } - let(:variable) { create(:ci_variable, key: 'test') } + let(:variable) { create(:ci_variable, key: 'test_key', value: 'test value') } before do login_as(user) @@ -24,11 +24,23 @@ describe 'Project variables', js: true do fill_in('variable_value', with: 'key value') click_button('Add new variable') + expect(page).to have_content('Variables were successfully updated.') page.within('.variables-table') do expect(page).to have_content('key') end end + it 'adds empty variable' do + fill_in('variable_key', with: 'new_key') + fill_in('variable_value', with: '') + click_button('Add new variable') + + expect(page).to have_content('Variables were successfully updated.') + page.within('.variables-table') do + expect(page).to have_content('new_key') + end + end + it 'reveals and hides new variable' do fill_in('variable_key', with: 'key') fill_in('variable_value', with: 'key value') @@ -72,8 +84,20 @@ describe 'Project variables', js: true do fill_in('variable_value', with: 'key value') click_button('Save variable') + expect(page).to have_content('Variable was successfully updated.') + expect(project.variables.first.value).to eq('key value') + end + + it 'edits variable with empty value' do page.within('.variables-table') do - expect(page).to have_content('key') + find('.btn-variable-edit').click end + + expect(page).to have_content('Update variable') + fill_in('variable_value', with: '') + click_button('Save variable') + + expect(page).to have_content('Variable was successfully updated.') + expect(project.variables.first.value).to eq('') end end |