Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
55805701
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
55805701
编写于
2月 01, 2018
作者:
M
Matija Čupić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract variable parameters in VariablesController specs
上级
c95c3ffc
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
28 addition
and
28 deletion
+28
-28
spec/controllers/groups/variables_controller_spec.rb
spec/controllers/groups/variables_controller_spec.rb
+14
-14
spec/controllers/projects/variables_controller_spec.rb
spec/controllers/projects/variables_controller_spec.rb
+14
-14
未找到文件。
spec/controllers/groups/variables_controller_spec.rb
浏览文件 @
55805701
...
@@ -25,16 +25,22 @@ describe Groups::VariablesController do
...
@@ -25,16 +25,22 @@ describe Groups::VariablesController do
describe
'POST #update'
do
describe
'POST #update'
do
let!
(
:variable
)
{
create
(
:ci_group_variable
,
group:
group
)
}
let!
(
:variable
)
{
create
(
:ci_group_variable
,
group:
group
)
}
let
(
:variable_attributes
)
do
{
id:
variable
.
id
,
key:
variable
.
key
,
value:
variable
.
value
,
protected:
variable
.
protected?
.
to_s
}
end
let
(
:new_variable_attributes
)
do
{
key:
'new_key'
,
value:
'dummy_value'
,
protected:
'false'
}
end
context
'with invalid new variable parameters'
do
context
'with invalid new variable parameters'
do
subject
do
subject
do
patch
:update
,
patch
:update
,
group_id:
group
,
group_id:
group
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
value:
'other_value'
,
new_variable_attributes
.
merge
(
key:
'..?'
)],
protected:
variable
.
protected?
.
to_s
},
{
key:
'..?'
,
value:
'dummy_value'
,
protected:
'false'
}],
format: :json
format: :json
end
end
...
@@ -57,11 +63,8 @@ describe Groups::VariablesController do
...
@@ -57,11 +63,8 @@ describe Groups::VariablesController do
subject
do
subject
do
patch
:update
,
patch
:update
,
group_id:
group
,
group_id:
group
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
value:
'other_value'
,
new_variable_attributes
],
protected:
variable
.
protected?
.
to_s
},
{
key:
'new_key'
,
value:
'dummy_value'
,
protected:
'false'
}],
format: :json
format: :json
end
end
...
@@ -90,10 +93,7 @@ describe Groups::VariablesController do
...
@@ -90,10 +93,7 @@ describe Groups::VariablesController do
subject
do
subject
do
patch
:update
,
patch
:update
,
group_id:
group
,
group_id:
group
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
variables_attributes:
[
variable_attributes
.
merge
(
_destroy:
'true'
)],
value:
variable
.
value
,
protected:
variable
.
protected?
.
to_s
,
_destroy:
'true'
}],
format: :json
format: :json
end
end
...
...
spec/controllers/projects/variables_controller_spec.rb
浏览文件 @
55805701
...
@@ -30,6 +30,15 @@ describe Projects::VariablesController do
...
@@ -30,6 +30,15 @@ describe Projects::VariablesController do
describe
'POST #update'
do
describe
'POST #update'
do
let
(
:variable
)
{
create
(
:ci_variable
)
}
let
(
:variable
)
{
create
(
:ci_variable
)
}
let
(
:variable_attributes
)
do
{
id:
variable
.
id
,
key:
variable
.
key
,
value:
variable
.
value
,
protected:
variable
.
protected?
.
to_s
}
end
let
(
:new_variable_attributes
)
do
{
key:
'new_key'
,
value:
'dummy_value'
,
protected:
'false'
}
end
before
do
before
do
project
.
variables
<<
variable
project
.
variables
<<
variable
...
@@ -39,11 +48,8 @@ describe Projects::VariablesController do
...
@@ -39,11 +48,8 @@ describe Projects::VariablesController do
subject
do
subject
do
patch
:update
,
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
value:
'other_value'
,
new_variable_attributes
.
merge
(
key:
'..?'
)],
protected:
variable
.
protected?
.
to_s
},
{
key:
'..?'
,
value:
'dummy_value'
,
protected:
'false'
}],
format: :json
format: :json
end
end
...
@@ -66,11 +72,8 @@ describe Projects::VariablesController do
...
@@ -66,11 +72,8 @@ describe Projects::VariablesController do
subject
do
subject
do
patch
:update
,
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
value:
'other_value'
,
new_variable_attributes
],
protected:
variable
.
protected?
.
to_s
},
{
key:
'new_key'
,
value:
'dummy_value'
,
protected:
'false'
}],
format: :json
format: :json
end
end
...
@@ -99,10 +102,7 @@ describe Projects::VariablesController do
...
@@ -99,10 +102,7 @@ describe Projects::VariablesController do
subject
do
subject
do
patch
:update
,
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
variables_attributes:
[
variable_attributes
.
merge
(
_destroy:
'true'
)],
value:
variable
.
value
,
protected:
variable
.
protected?
.
to_s
,
_destroy:
'true'
}],
format: :json
format: :json
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录