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
Boxiang Sun
gitlab-ce
Commits
db3c5a04
Commit
db3c5a04
authored
Aug 15, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use merge_request_diff instead of doubles for testing pipelines for Merge Requests
parent
aa8cb00b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
20 deletions
+15
-20
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+5
-5
spec/features/merge_requests/pipelines_spec.rb
spec/features/merge_requests/pipelines_spec.rb
+2
-2
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+8
-13
No files found.
app/views/projects/merge_requests/_show.html.haml
View file @
db3c5a04
...
@@ -45,24 +45,24 @@
...
@@ -45,24 +45,24 @@
-
if
@commits_count
.
nonzero?
-
if
@commits_count
.
nonzero?
%ul
.merge-request-tabs.nav-links.no-top.no-bottom
%ul
.merge-request-tabs.nav-links.no-top.no-bottom
%li
.notes-tab
%li
.notes-tab
=
link_to
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#notes'
,
action:
'notes'
,
toggle:
'tab'
}
do
=
link_to
namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#notes'
,
action:
'notes'
,
toggle:
'tab'
}
do
Discussion
Discussion
%span
.badge
=
@merge_request
.
mr_and_commit_notes
.
user
.
count
%span
.badge
=
@merge_request
.
mr_and_commit_notes
.
user
.
count
%li
.commits-tab
%li
.commits-tab
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
Commits
Commits
%span
.badge
=
@commits_count
%span
.badge
=
@commits_count
-
if
@pipeline
-
if
@pipeline
%li
.pipelines-tab
%li
.pipelines-tab
=
link_to
pipelines_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#pipelines'
,
action:
'pipelines'
,
toggle:
'tab'
}
do
=
link_to
pipelines_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#pipelines'
,
action:
'pipelines'
,
toggle:
'tab'
}
do
Pipelines
Pipelines
%span
.badge
%span
.badge
%li
.builds-tab
%li
.builds-tab
=
link_to
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#builds'
,
action:
'builds'
,
toggle:
'tab'
}
do
=
link_to
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#builds'
,
action:
'builds'
,
toggle:
'tab'
}
do
Builds
Builds
%span
.badge
=
@statuses
.
size
%span
.badge
=
@statuses
.
size
%li
.diffs-tab
%li
.diffs-tab
=
link_to
diffs_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#diffs'
,
action:
'diffs'
,
toggle:
'tab'
}
do
=
link_to
diffs_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#diffs'
,
action:
'diffs'
,
toggle:
'tab'
}
do
Changes
Changes
%span
.badge
=
@merge_request
.
diff_size
%span
.badge
=
@merge_request
.
diff_size
...
...
spec/features/merge_requests/pipelines_spec.rb
View file @
db3c5a04
...
@@ -24,7 +24,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do
...
@@ -24,7 +24,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
end
end
scenario
'
does click a pipeline tab and sees a list of pipelines
'
do
scenario
'
user visits merge request pipelines tab
'
do
page
.
within
(
'.merge-request-tabs'
)
do
page
.
within
(
'.merge-request-tabs'
)
do
click_link
(
'Pipelines'
)
click_link
(
'Pipelines'
)
end
end
...
@@ -39,7 +39,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do
...
@@ -39,7 +39,7 @@ feature 'Pipelines for Merge Requests', feature: true, js: true do
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
end
end
scenario
'
does not find a pipeline link
'
do
scenario
'
user visits merge request page
'
do
page
.
within
(
'.merge-request-tabs'
)
do
page
.
within
(
'.merge-request-tabs'
)
do
expect
(
page
).
not_to
have_link
(
'Pipelines'
)
expect
(
page
).
not_to
have_link
(
'Pipelines'
)
end
end
...
...
spec/models/merge_request_spec.rb
View file @
db3c5a04
...
@@ -425,7 +425,7 @@ describe MergeRequest, models: true do
...
@@ -425,7 +425,7 @@ describe MergeRequest, models: true do
let
(
:commit2
)
{
double
(
'commit2'
,
sha:
'sha3'
)
}
let
(
:commit2
)
{
double
(
'commit2'
,
sha:
'sha3'
)
}
before
do
before
do
allow
(
subject
).
to
receive
(
:commits
).
and_return
([
commit0
,
commit1
,
commit2
])
allow
(
subject
.
merge_request_diff
).
to
receive
(
:commits
).
and_return
([
commit0
,
commit1
,
commit2
])
end
end
it
'returns sha of commits'
do
it
'returns sha of commits'
do
...
@@ -458,20 +458,15 @@ describe MergeRequest, models: true do
...
@@ -458,20 +458,15 @@ describe MergeRequest, models: true do
end
end
describe
'#all_pipelines'
do
describe
'#all_pipelines'
do
let
(
:commit0
)
{
double
(
'commit0'
,
sha:
'sha1'
)
}
let!
(
:pipelines
)
do
let
(
:commit1
)
{
double
(
'commit1'
,
sha:
'sha2'
)
}
subject
.
merge_request_diff
.
commits
.
map
do
|
commit
|
let
(
:commit2
)
{
double
(
'commit2'
,
sha:
'sha3'
)
}
create
(
:ci_empty_pipeline
,
project:
subject
.
source_project
,
sha:
commit
.
id
,
ref:
subject
.
source_branch
)
let!
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
subject
.
source_project
,
sha:
'sha1'
,
ref:
subject
.
source_branch
)
}
end
let!
(
:pipeline2
)
{
create
(
:ci_empty_pipeline
,
project:
subject
.
source_project
,
sha:
'sha1'
,
ref:
subject
.
source_branch
)
}
let!
(
:pipeline3
)
{
create
(
:ci_empty_pipeline
,
project:
subject
.
source_project
,
sha:
'sha2'
,
ref:
subject
.
source_branch
)
}
let!
(
:pipeline4
)
{
create
(
:ci_empty_pipeline
,
project:
subject
.
target_project
,
sha:
'sha1'
,
ref:
subject
.
target_branch
)
}
before
do
allow
(
subject
).
to
receive
(
:commits
).
and_return
([
commit0
,
commit1
,
commit2
])
end
end
it
'returns a pipelines from source projects'
do
it
'returns a pipelines from source projects with proper ordering'
do
expect
(
subject
.
all_pipelines
).
to
eq
([
pipeline3
,
pipeline2
,
pipeline
])
expect
(
subject
.
all_pipelines
).
not_to
be_empty
expect
(
subject
.
all_pipelines
).
to
eq
(
pipelines
.
reverse
)
end
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