2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Projects::VariablesController do
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'GET #show' do
|
|
|
|
let!(:variable) { create(:ci_variable, project: project) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
subject do
|
|
|
|
get :show, namespace_id: project.namespace.to_param, project_id: project, format: :json
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
include_examples 'GET #show lists all variables'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe 'PATCH #update' do
|
|
|
|
let!(:variable) { create(:ci_variable, project: project) }
|
|
|
|
let(:owner) { project }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
subject do
|
|
|
|
patch :update,
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project,
|
|
|
|
variables_attributes: variables_attributes,
|
|
|
|
format: :json
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
include_examples 'PATCH #update updates variables'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|