summaryrefslogtreecommitdiff
path: root/spec/features/variables_spec.rb
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-05-23 23:08:00 +0300
committerFatih Acet <acetfatih@gmail.com>2016-05-23 23:08:00 +0300
commitaa2a7dad59c0db8b15aadbb58a861237a36c95ee (patch)
treed55ab82ba5c5195b003f9b29c2c17646fffbdae6 /spec/features/variables_spec.rb
parentb99471ca5de6e867c44ea21bf85252cd174ccec7 (diff)
parentc002a560afae7db6a5c778bc78028243c2fc945a (diff)
downloadgitlab-ce-aa2a7dad59c0db8b15aadbb58a861237a36c95ee.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into #15643
# Conflicts: # app/assets/stylesheets/pages/issuable.scss
Diffstat (limited to 'spec/features/variables_spec.rb')
-rw-r--r--spec/features/variables_spec.rb61
1 files changed, 45 insertions, 16 deletions
diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb
index afea1840cd7..48e2dae4884 100644
--- a/spec/features/variables_spec.rb
+++ b/spec/features/variables_spec.rb
@@ -1,24 +1,53 @@
require 'spec_helper'
-describe "Variables" do
- let(:user) { create(:user) }
- before { login_as(user) }
-
- describe "specific runners" do
- before do
- @project = FactoryGirl.create :empty_project
- @project.team << [user, :master]
+describe 'Project variables', js: true do
+ let(:user) { create(:user) }
+ let(:project) { create(:project) }
+ let(:variable) { create(:ci_variable, key: 'test') }
+
+ before do
+ login_as(user)
+ project.team << [user, :master]
+ project.variables << variable
+
+ visit namespace_project_variables_path(project.namespace, project)
+ end
+
+ it 'should show list of variables' do
+ page.within('.variables-table') do
+ expect(page).to have_content(variable.key)
+ end
+ end
+
+ it 'should add new variable' do
+ fill_in('variable_key', with: 'key')
+ fill_in('variable_value', with: 'key value')
+ click_button('Add new variable')
+
+ page.within('.variables-table') do
+ expect(page).to have_content('key')
+ end
+ end
+
+ it 'should delete variable' do
+ page.within('.variables-table') do
+ find('.btn-variable-delete').click
+ end
+
+ expect(page).to_not have_selector('variables-table')
+ end
+
+ it 'should edit variable' do
+ page.within('.variables-table') do
+ find('.btn-variable-edit').click
end
- it "creates variable", js: true do
- visit namespace_project_variables_path(@project.namespace, @project)
- click_on "Add a variable"
- fill_in "Key", with: "SECRET_KEY"
- fill_in "Value", with: "SECRET_VALUE"
- click_on "Save changes"
+ fill_in('variable_key', with: 'key')
+ fill_in('variable_value', with: 'key value')
+ click_button('Save variable')
- expect(page).to have_content("Variables were successfully updated.")
- expect(@project.variables.count).to eq(1)
+ page.within('.variables-table') do
+ expect(page).to have_content('key')
end
end
end