2015-08-25 21:42:46 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-04-27 07:17:17 -04:00
|
|
|
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-07-25 14:16:19 -04:00
|
|
|
it 'shows list of variables' do
|
2016-04-27 07:17:17 -04:00
|
|
|
page.within('.variables-table') do
|
|
|
|
expect(page).to have_content(variable.key)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'adds new variable' do
|
2016-04-27 07:17:17 -04:00
|
|
|
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-07-25 14:16:19 -04:00
|
|
|
it 'deletes variable' do
|
2016-04-27 07:17:17 -04:00
|
|
|
page.within('.variables-table') do
|
|
|
|
find('.btn-variable-delete').click
|
|
|
|
end
|
|
|
|
|
2016-05-23 19:37:59 -04:00
|
|
|
expect(page).not_to have_selector('variables-table')
|
2016-04-27 07:17:17 -04:00
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'edits variable' do
|
2016-04-27 07:17:17 -04:00
|
|
|
page.within('.variables-table') do
|
|
|
|
find('.btn-variable-edit').click
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
2016-08-11 12:48:32 -04:00
|
|
|
expect(page).to have_content('Update variable')
|
2016-04-27 07:17:17 -04:00
|
|
|
fill_in('variable_key', with: 'key')
|
|
|
|
fill_in('variable_value', with: 'key value')
|
|
|
|
click_button('Save variable')
|
2015-09-28 11:19:20 -04:00
|
|
|
|
2016-04-27 07:17:17 -04:00
|
|
|
page.within('.variables-table') do
|
|
|
|
expect(page).to have_content('key')
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|