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
Léo-Paul Géneau
gitlab-ce
Commits
842de4ef
Commit
842de4ef
authored
Jul 21, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests refactoring for trigger variables
parent
79c29a67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
spec/factories/ci/trigger_requests.rb
spec/factories/ci/trigger_requests.rb
+2
-1
spec/views/projects/builds/show.html.haml_spec.rb
spec/views/projects/builds/show.html.haml_spec.rb
+10
-7
No files found.
spec/factories/ci/trigger_requests.rb
View file @
842de4ef
...
...
@@ -5,7 +5,8 @@ FactoryGirl.define do
variables
do
{
TRIGGER_KEY
:
'TRIGGER_VALUE'
TRIGGER_KEY_1
:
'TRIGGER_VALUE_1'
,
TRIGGER_KEY_2
:
'TRIGGER_VALUE_2'
}
end
end
...
...
spec/views/projects/builds/show.html.haml_spec.rb
View file @
842de4ef
...
...
@@ -51,19 +51,22 @@ describe 'projects/builds/show' do
end
describe
'shows trigger variables in sidebar'
do
let
(
:trigger
)
{
create
(
:ci_trigger
,
project:
project
)
}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
,
trigger:
trigger
)
}
let
(
:trigger_request
)
{
create
(
:ci_trigger_request_with_variables
,
pipeline:
pipeline
)
}
before
do
build
.
trigger_request
=
trigger_request
render
end
it
'shows trigger variables in separate lines'
do
trigger_request
.
update_attributes
(
variables:
{
TRIGGER_KEY
:
'TRIGGER_VALUE'
,
TRIGGER_KEY_1
:
'TRIGGER_VALUE_1'
})
render
expect
(
rendered
).
to
have_css
(
'code'
,
text:
/\A
#{
Regexp
.
escape
(
'TRIGGER_KEY=TRIGGER_VALUE'
)
}
\Z/
)
expect
(
rendered
).
to
have_css
(
'code'
,
text:
/\A
#{
Regexp
.
escape
(
'TRIGGER_KEY_1=TRIGGER_VALUE_1'
)
}
\Z/
)
expect
(
rendered
).
to
have_css
(
'code'
,
text:
variable_regexp
(
'TRIGGER_KEY_1'
,
'TRIGGER_VALUE_1'
))
expect
(
rendered
).
to
have_css
(
'code'
,
text:
variable_regexp
(
'TRIGGER_KEY_2'
,
'TRIGGER_VALUE_2'
))
end
end
private
def
variable_regexp
(
key
,
value
)
/\A
#{
Regexp
.
escape
(
"
#{
key
}
=
#{
value
}
"
)
}
\Z/
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