debian-mirror-gitlab/spec/features/variables_spec.rb

55 lines
1.3 KiB
Ruby
Raw Normal View History

2015-09-25 12:07:36 +05:30
require 'spec_helper'
2016-06-02 11:05:42 +05:30
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
2016-09-13 17:45:13 +05:30
it 'shows list of variables' do
2016-06-02 11:05:42 +05:30
page.within('.variables-table') do
expect(page).to have_content(variable.key)
end
end
2016-09-13 17:45:13 +05:30
it 'adds new variable' do
2016-06-02 11:05:42 +05:30
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
2016-09-13 17:45:13 +05:30
it 'deletes variable' do
2016-06-02 11:05:42 +05:30
page.within('.variables-table') do
find('.btn-variable-delete').click
end
expect(page).not_to have_selector('variables-table')
2016-06-02 11:05:42 +05:30
end
2016-09-13 17:45:13 +05:30
it 'edits variable' do
2016-06-02 11:05:42 +05:30
page.within('.variables-table') do
find('.btn-variable-edit').click
2015-09-25 12:07:36 +05:30
end
2016-09-13 17:45:13 +05:30
expect(page).to have_content('Update variable')
2016-06-02 11:05:42 +05:30
fill_in('variable_key', with: 'key')
fill_in('variable_value', with: 'key value')
click_button('Save variable')
2015-10-24 18:46:33 +05:30
2016-06-02 11:05:42 +05:30
page.within('.variables-table') do
expect(page).to have_content('key')
2015-09-25 12:07:36 +05:30
end
end
end