summaryrefslogtreecommitdiff
path: root/spec/features/variables_spec.rb
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2017-02-22 17:32:41 +0000
committerRobert Schilling <rschilling@student.tugraz.at>2017-02-22 17:32:41 +0000
commit931db7963ee9fa145d8fe2fb5eea209215227db7 (patch)
treea85ddfcf479ea09237c54a6ce9b0557925f583ff /spec/features/variables_spec.rb
parent0b402e11e355dc8d834fbc139f4bca810a9f766e (diff)
parent33e4294fc884c7bd2a7fb86baf4731daf87db7bb (diff)
downloadgitlab-ce-api-notes-entity-fields.tar.gz
Merge branch 'master' into 'api-notes-entity-fields'api-notes-entity-fields
# Conflicts: # doc/api/v3_to_v4.md
Diffstat (limited to 'spec/features/variables_spec.rb')
-rw-r--r--spec/features/variables_spec.rb28
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