Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
99428f19
Commit
99428f19
authored
Apr 27, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated project variable tests
parent
bda2c44a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
19 deletions
+48
-19
app/views/projects/variables/_table.html.haml
app/views/projects/variables/_table.html.haml
+3
-3
spec/features/variables_spec.rb
spec/features/variables_spec.rb
+45
-16
No files found.
app/views/projects/variables/_table.html.haml
View file @
99428f19
.table-responsive
.table-responsive
.variables-table
%table
.table
%colgroup
%col
...
...
@@ -14,11 +14,11 @@
%td
=
variable
.
key
%td
=
variable
.
value
%td
=
link_to
namespace_project_variable_path
(
@project
.
namespace
,
@project
,
variable
),
class:
"btn btn-transparent"
do
=
link_to
namespace_project_variable_path
(
@project
.
namespace
,
@project
,
variable
),
class:
"btn btn-transparent
btn-variable-edit
"
do
%span
.sr-only
Update
=
icon
(
"pencil"
)
=
link_to
namespace_project_variable_path
(
@project
.
namespace
,
@project
,
variable
),
class:
"btn btn-transparent"
,
method: :delete
,
data:
{
confirm:
"Are you sure?"
}
do
=
link_to
namespace_project_variable_path
(
@project
.
namespace
,
@project
,
variable
),
class:
"btn btn-transparent
btn-variable-delete
"
,
method: :delete
,
data:
{
confirm:
"Are you sure?"
}
do
%span
.sr-only
Remove
=
icon
(
"trash"
)
spec/features/variables_spec.rb
View file @
99428f19
require
'spec_helper'
describe
"Variables"
do
let
(
:user
)
{
create
(
:user
)
}
before
{
login_as
(
user
)
}
describe
"specific runners"
do
before
do
@project
=
FactoryGirl
.
create
:empty_project
@project
.
team
<<
[
user
,
:master
]
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
end
it
"creates variable"
,
js:
true
do
visit
namespace_project_variables_path
(
@project
.
namespace
,
@project
)
click_on
"Add a variable"
fill_in
"Key"
,
with:
"SECRET_KEY"
fill_in
"Value"
,
with:
"SECRET_VALUE"
click_on
"Save changes"
fill_in
(
'variable_key'
,
with:
'key'
)
fill_in
(
'variable_value'
,
with:
'key value'
)
click_button
(
'Save variable'
)
expect
(
page
).
to
have_content
(
"Variables were successfully updated."
)
expect
(
@project
.
variables
.
count
).
to
eq
(
1
)
page
.
within
(
'.variables-table'
)
do
expect
(
page
).
to
have_content
(
'key'
)
end
end
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