summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-05-25 19:31:21 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-05-25 19:31:21 +0800
commitefebdba21db9e11b876ecb54db48358e13b08ad3 (patch)
tree44c63974c56c24af642c5b6b358dbb137b307595 /spec/features
parent9f6dc8b2b5fe3d4790d67f13660eb8bfabd4dbca (diff)
downloadgitlab-ce-efebdba21db9e11b876ecb54db48358e13b08ad3.tar.gz
Frontend implementation, tests, and changelog
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/variables_spec.rb44
1 files changed, 43 insertions, 1 deletions
diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb
index b83a230c1f8..08a2df63a40 100644
--- a/spec/features/variables_spec.rb
+++ b/spec/features/variables_spec.rb
@@ -19,7 +19,7 @@ describe 'Project variables', js: true do
end
end
- it 'adds new variable' do
+ it 'adds new secret variable' do
fill_in('variable_key', with: 'key')
fill_in('variable_value', with: 'key value')
click_button('Add new variable')
@@ -27,6 +27,7 @@ describe 'Project variables', js: true do
expect(page).to have_content('Variables were successfully updated.')
page.within('.variables-table') do
expect(page).to have_content('key')
+ expect(page).to have_content('No')
end
end
@@ -41,6 +42,19 @@ describe 'Project variables', js: true do
end
end
+ it 'adds new protected variable' do
+ fill_in('variable_key', with: 'key')
+ fill_in('variable_value', with: 'value')
+ check('Protected')
+ 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')
+ expect(page).to have_content('Yes')
+ end
+ end
+
it 'reveals and hides new variable' do
fill_in('variable_key', with: 'key')
fill_in('variable_value', with: 'key value')
@@ -100,4 +114,32 @@ describe 'Project variables', js: true do
expect(page).to have_content('Variable was successfully updated.')
expect(project.variables.first.value).to eq('')
end
+
+ it 'edits variable to be protected' do
+ page.within('.variables-table') do
+ find('.btn-variable-edit').click
+ end
+
+ expect(page).to have_content('Update variable')
+ check('Protected')
+ click_button('Save variable')
+
+ expect(page).to have_content('Variable was successfully updated.')
+ expect(project.variables.first).to be_protected
+ end
+
+ it 'edits variable to be unprotected' do
+ project.variables.first.update(protected: true)
+
+ page.within('.variables-table') do
+ find('.btn-variable-edit').click
+ end
+
+ expect(page).to have_content('Update variable')
+ check('Protected')
+ click_button('Save variable')
+
+ expect(page).to have_content('Variable was successfully updated.')
+ expect(project.variables.first).not_to be_protected
+ end
end