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
|
|
|
|
|
|
|
|
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
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
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
|