BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
55805701
Unverified
Commit
55805701
authored
Feb 01, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract variable parameters in VariablesController specs
parent
c95c3ffc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
28 deletions
+28
-28
variables_controller_spec.rb
spec/controllers/groups/variables_controller_spec.rb
+14
-14
variables_controller_spec.rb
spec/controllers/projects/variables_controller_spec.rb
+14
-14
No files found.
spec/controllers/groups/variables_controller_spec.rb
View file @
55805701
...
...
@@ -25,16 +25,22 @@ describe Groups::VariablesController do
describe
'POST #update'
do
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
subject
do
patch
:update
,
group_id:
group
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
value:
'other_value'
,
protected:
variable
.
protected?
.
to_s
},
{
key:
'..?'
,
value:
'dummy_value'
,
protected:
'false'
}],
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
new_variable_attributes
.
merge
(
key:
'..?'
)],
format: :json
end
...
...
@@ -57,11 +63,8 @@ describe Groups::VariablesController do
subject
do
patch
:update
,
group_id:
group
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
value:
'other_value'
,
protected:
variable
.
protected?
.
to_s
},
{
key:
'new_key'
,
value:
'dummy_value'
,
protected:
'false'
}],
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
new_variable_attributes
],
format: :json
end
...
...
@@ -90,10 +93,7 @@ describe Groups::VariablesController do
subject
do
patch
:update
,
group_id:
group
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
value:
variable
.
value
,
protected:
variable
.
protected?
.
to_s
,
_destroy:
'true'
}],
variables_attributes:
[
variable_attributes
.
merge
(
_destroy:
'true'
)],
format: :json
end
...
...
spec/controllers/projects/variables_controller_spec.rb
View file @
55805701
...
...
@@ -30,6 +30,15 @@ describe Projects::VariablesController do
describe
'POST #update'
do
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
project
.
variables
<<
variable
...
...
@@ -39,11 +48,8 @@ describe Projects::VariablesController do
subject
do
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
value:
'other_value'
,
protected:
variable
.
protected?
.
to_s
},
{
key:
'..?'
,
value:
'dummy_value'
,
protected:
'false'
}],
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
new_variable_attributes
.
merge
(
key:
'..?'
)],
format: :json
end
...
...
@@ -66,11 +72,8 @@ describe Projects::VariablesController do
subject
do
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
value:
'other_value'
,
protected:
variable
.
protected?
.
to_s
},
{
key:
'new_key'
,
value:
'dummy_value'
,
protected:
'false'
}],
variables_attributes:
[
variable_attributes
.
merge
(
value:
'other_value'
),
new_variable_attributes
],
format: :json
end
...
...
@@ -99,10 +102,7 @@ describe Projects::VariablesController do
subject
do
patch
:update
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
variables_attributes:
[{
id:
variable
.
id
,
key:
variable
.
key
,
value:
variable
.
value
,
protected:
variable
.
protected?
.
to_s
,
_destroy:
'true'
}],
variables_attributes:
[
variable_attributes
.
merge
(
_destroy:
'true'
)],
format: :json
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment