diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-05-19 15:12:50 -0500 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-05-19 15:12:50 -0500 |
commit | a08e3c675a35d9d4a9ba8f2b8dac3750f43cea97 (patch) | |
tree | 8fe92b68c7fae2f5deab8a5e95d8bd95ef1f97af /spec/features/variables_spec.rb | |
parent | c22544998e66a66c427ad4b2f9024950c5390f18 (diff) | |
parent | e4a1af83532006f2b11a323cdabfcf8f042fa3c7 (diff) | |
download | gitlab-ce-a08e3c675a35d9d4a9ba8f2b8dac3750f43cea97.tar.gz |
Merge branch 'master' into 8-8-stable
Diffstat (limited to 'spec/features/variables_spec.rb')
-rw-r--r-- | spec/features/variables_spec.rb | 61 |
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 |