diff options
author | Lukáš Nový <lukas.novy@pirati.cz> | 2016-08-26 00:56:32 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-21 16:33:06 +0300 |
commit | 71270f80dd42e524a904a3c19f23217e8766e282 (patch) | |
tree | 002762809e69b30f2ea9c35f2da2036fd6c84f63 /spec | |
parent | 459a97d46812fecc59c973bad356935422c7f60e (diff) |
UI: Allow a project variable to be set to an empty value
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/variables_spec.rb | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index 9a4bc027004..a07eba2f01e 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) @@ -16,16 +16,28 @@ describe 'Project variables', js: true do it 'shows list of variables' do page.within('.variables-table') do expect(page).to have_content(variable.key) + expect(page).to have_content(variable.value) end end it 'adds new variable' do - fill_in('variable_key', with: 'key') - fill_in('variable_value', with: 'key value') + fill_in('variable_key', with: 'new_key') + fill_in('variable_value', with: 'new value') click_button('Add new variable') page.within('.variables-table') do - expect(page).to have_content('key') + expect(page).to have_content('new_key') + expect(page).to have_content('new value') + end + end + + it 'adds empty variable' do + fill_in('variable_key', with: 'new_key') + fill_in('variable_value', with: '') + click_button('Add new variable') + + page.within('.variables-table') do + expect(page).to have_content('new_key') end end @@ -68,12 +80,30 @@ describe 'Project variables', js: true do end expect(page).to have_content('Update variable') - fill_in('variable_key', with: 'key') - fill_in('variable_value', with: 'key value') + fill_in('variable_key', with: 'new_key') + fill_in('variable_value', with: 'new value') click_button('Save variable') page.within('.variables-table') do - expect(page).to have_content('key') + expect(page).not_to have_content(variable.key) + expect(page).not_to have_content(variable.value) + expect(page).to have_content('new_key') + expect(page).to have_content('new value') + end + end + + it 'edits variable with empty value' do + page.within('.variables-table') do + find('.btn-variable-edit').click + end + + expect(page).to have_content('Update variable') + fill_in('variable_value', with: '') + click_button('Save variable') + + page.within('.variables-table') do + expect(page).to have_content(variable.key) + expect(page).not_to have_content(variable.value) end end end |