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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0bf21d6a
Commit
0bf21d6a
authored
Feb 03, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed merge request widget tests
parent
2bc956cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
27 deletions
+62
-27
spec/features/merge_requests/environments_link_spec.rb
spec/features/merge_requests/environments_link_spec.rb
+0
-23
spec/features/merge_requests/widget_spec.rb
spec/features/merge_requests/widget_spec.rb
+57
-0
spec/javascripts/merge_request_widget/merge_request_widget_spec.js
...scripts/merge_request_widget/merge_request_widget_spec.js
+5
-4
No files found.
spec/features/merge_requests/environments_link_spec.rb
deleted
100644 → 0
View file @
2bc956cf
require
'spec_helper'
feature
'Merge request environments'
,
:feature
,
:js
do
include
WaitForAjax
it
'shows environments link'
do
project
=
create
(
:project
)
merge_request
=
create
(
:merge_request
,
source_project:
project
)
environment
=
create
(
:environment
,
project:
project
)
create
(
:deployment
,
environment:
environment
,
ref:
'feature'
,
sha:
merge_request
.
diff_head_sha
)
login_as
:admin
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
wait_for_ajax
page
.
within
(
'.mr-widget-heading'
)
do
expect
(
page
).
to
have_content
(
"Deployed to
#{
environment
.
name
}
"
)
expect
(
find
(
'.js-environment-link'
)[
:href
]).
to
include
(
environment
.
formatted_external_url
)
end
end
end
spec/features/merge_requests/widget_spec.rb
0 → 100644
View file @
0bf21d6a
require
'rails_helper'
describe
'Merge request'
,
:feature
,
:js
do
include
WaitForAjax
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
context
'new merge request'
do
before
do
visit
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request:
{
source_project_id:
project
.
id
,
target_project_id:
project
.
id
,
source_branch:
'feature'
,
target_branch:
'master'
}
)
end
it
'shows widget status after creating new merge request'
do
click_button
'Submit merge request'
expect
(
find
(
'.mr-state-widget'
)).
to
have_content
(
'Checking ability to merge automatically'
)
wait_for_ajax
expect
(
page
).
to
have_selector
(
'.accept_merge_request'
)
end
end
context
'view merge request'
do
let!
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
ref:
'feature'
,
sha:
merge_request
.
diff_head_sha
)
}
before
do
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
end
it
'shows environments link'
do
wait_for_ajax
page
.
within
(
'.mr-widget-heading'
)
do
expect
(
page
).
to
have_content
(
"Deployed to
#{
environment
.
name
}
"
)
expect
(
find
(
'.js-environment-link'
)[
:href
]).
to
include
(
environment
.
formatted_external_url
)
end
end
end
end
spec/javascripts/merge_request_widget/merge_request_widget_spec.js
View file @
0bf21d6a
/* eslint-disable space-before-function-paren, quotes, comma-dangle, dot-notation, quote-props, no-var, max-len */
/*= require smart_interval */
/*= require merge_request_widget */
/*= require lib/utils/datetime_utility */
...
...
@@ -73,7 +74,7 @@
}
it
(
'
should render less than a minute ago text
'
,
function
()
{
spyOn
(
this
.
class
.
$widgetBody
,
'
before
'
).
and
.
callFake
(
function
(
template
)
{
spyOn
(
$
(
'
.mr-widget-body
'
)
,
'
before
'
).
and
.
callFake
(
function
(
template
)
{
expect
(
getTimeagoText
(
template
)).
toBe
(
'
less than a minute ago.
'
);
});
...
...
@@ -85,7 +86,7 @@
oneHourAgo
.
setHours
(
oneHourAgo
.
getHours
()
-
1
);
this
.
environments
[
0
].
deployed_at
=
oneHourAgo
.
toISOString
();
spyOn
(
this
.
class
.
$widgetBody
,
'
before
'
).
and
.
callFake
(
function
(
template
)
{
spyOn
(
$
(
'
.mr-widget-body
'
)
,
'
before
'
).
and
.
callFake
(
function
(
template
)
{
expect
(
getTimeagoText
(
template
)).
toBe
(
'
about an hour ago.
'
);
});
...
...
@@ -97,7 +98,7 @@
twoHoursAgo
.
setHours
(
twoHoursAgo
.
getHours
()
-
2
);
this
.
environments
[
0
].
deployed_at
=
twoHoursAgo
.
toISOString
();
spyOn
(
this
.
class
.
$widgetBody
,
'
before
'
).
and
.
callFake
(
function
(
template
)
{
spyOn
(
$
(
'
.mr-widget-body
'
)
,
'
before
'
).
and
.
callFake
(
function
(
template
)
{
expect
(
getTimeagoText
(
template
)).
toBe
(
'
about 2 hours ago.
'
);
});
...
...
@@ -108,7 +109,7 @@
describe
(
'
mergeInProgress
'
,
function
()
{
it
(
'
should display error with h4 tag
'
,
function
()
{
spyOn
(
this
.
class
.
$widgetBody
,
'
html
'
).
and
.
callFake
(
function
(
html
)
{
spyOn
(
$
(
'
.mr-widget-body
'
)
,
'
html
'
).
and
.
callFake
(
function
(
html
)
{
expect
(
html
).
toBe
(
'
<h4>Sorry, something went wrong.</h4>
'
);
});
spyOn
(
$
,
'
ajax
'
).
and
.
callFake
(
function
(
e
)
{
...
...
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