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
7e6ff8ca
Commit
7e6ff8ca
authored
Jan 19, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert most MergeRequest model specs to use `:empty_project`
parent
1502d564
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+22
-22
No files found.
spec/models/merge_request_spec.rb
View file @
7e6ff8ca
...
@@ -65,7 +65,7 @@ describe MergeRequest, models: true do
...
@@ -65,7 +65,7 @@ describe MergeRequest, models: true do
end
end
describe
'#target_branch_sha'
do
describe
'#target_branch_sha'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
subject
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
...
@@ -150,7 +150,7 @@ describe MergeRequest, models: true do
...
@@ -150,7 +150,7 @@ describe MergeRequest, models: true do
end
end
it
'supports a cross-project reference'
do
it
'supports a cross-project reference'
do
another_project
=
build
(
:project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
another_project
=
build
(
:
empty_
project
,
name:
'another-project'
,
namespace:
project
.
namespace
)
expect
(
merge_request
.
to_reference
(
another_project
)).
to
eq
"sample-project!1"
expect
(
merge_request
.
to_reference
(
another_project
)).
to
eq
"sample-project!1"
end
end
...
@@ -245,8 +245,8 @@ describe MergeRequest, models: true do
...
@@ -245,8 +245,8 @@ describe MergeRequest, models: true do
describe
'#for_fork?'
do
describe
'#for_fork?'
do
it
'returns true if the merge request is for a fork'
do
it
'returns true if the merge request is for a fork'
do
subject
.
source_project
=
create
(
:
project
,
namespace:
create
(
:group
))
subject
.
source_project
=
build_stubbed
(
:empty_
project
,
namespace:
create
(
:group
))
subject
.
target_project
=
create
(
:
project
,
namespace:
create
(
:group
))
subject
.
target_project
=
build_stubbed
(
:empty_
project
,
namespace:
create
(
:group
))
expect
(
subject
.
for_fork?
).
to
be_truthy
expect
(
subject
.
for_fork?
).
to
be_truthy
end
end
...
@@ -501,8 +501,8 @@ describe MergeRequest, models: true do
...
@@ -501,8 +501,8 @@ describe MergeRequest, models: true do
end
end
describe
'#diverged_commits_count'
do
describe
'#diverged_commits_count'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:project
,
:repository
,
forked_from_project:
project
)
}
context
'when the target branch does not exist anymore'
do
context
'when the target branch does not exist anymore'
do
subject
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
...
@@ -727,7 +727,7 @@ describe MergeRequest, models: true do
...
@@ -727,7 +727,7 @@ describe MergeRequest, models: true do
end
end
describe
'#participants'
do
describe
'#participants'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:mr
)
do
let
(
:mr
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
...
@@ -768,7 +768,7 @@ describe MergeRequest, models: true do
...
@@ -768,7 +768,7 @@ describe MergeRequest, models: true do
end
end
describe
'#check_if_can_be_merged'
do
describe
'#check_if_can_be_merged'
do
let
(
:project
)
{
create
(
:project
,
only_allow_merge_if_build_succeeds:
true
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
only_allow_merge_if_build_succeeds:
true
)
}
subject
{
create
(
:merge_request
,
source_project:
project
,
merge_status: :unchecked
)
}
subject
{
create
(
:merge_request
,
source_project:
project
,
merge_status: :unchecked
)
}
...
@@ -810,7 +810,7 @@ describe MergeRequest, models: true do
...
@@ -810,7 +810,7 @@ describe MergeRequest, models: true do
end
end
describe
'#mergeable?'
do
describe
'#mergeable?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
...
@@ -830,7 +830,7 @@ describe MergeRequest, models: true do
...
@@ -830,7 +830,7 @@ describe MergeRequest, models: true do
end
end
describe
'#mergeable_state?'
do
describe
'#mergeable_state?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
subject
{
create
(
:merge_request
,
source_project:
project
)
}
...
@@ -957,7 +957,7 @@ describe MergeRequest, models: true do
...
@@ -957,7 +957,7 @@ describe MergeRequest, models: true do
let
(
:merge_request
)
{
create
(
:merge_request_with_diff_notes
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diff_notes
,
source_project:
project
)
}
context
'when project.only_allow_merge_if_all_discussions_are_resolved == true'
do
context
'when project.only_allow_merge_if_all_discussions_are_resolved == true'
do
let
(
:project
)
{
create
(
:project
,
only_allow_merge_if_all_discussions_are_resolved:
true
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
only_allow_merge_if_all_discussions_are_resolved:
true
)
}
context
'with all discussions resolved'
do
context
'with all discussions resolved'
do
before
do
before
do
...
@@ -991,7 +991,7 @@ describe MergeRequest, models: true do
...
@@ -991,7 +991,7 @@ describe MergeRequest, models: true do
end
end
context
'when project.only_allow_merge_if_all_discussions_are_resolved == false'
do
context
'when project.only_allow_merge_if_all_discussions_are_resolved == false'
do
let
(
:project
)
{
create
(
:project
,
only_allow_merge_if_all_discussions_are_resolved:
false
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
only_allow_merge_if_all_discussions_are_resolved:
false
)
}
context
'with unresolved discussions'
do
context
'with unresolved discussions'
do
before
do
before
do
...
@@ -1006,7 +1006,7 @@ describe MergeRequest, models: true do
...
@@ -1006,7 +1006,7 @@ describe MergeRequest, models: true do
end
end
describe
"#environments"
do
describe
"#environments"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
context
'with multiple environments'
do
context
'with multiple environments'
do
...
@@ -1024,7 +1024,7 @@ describe MergeRequest, models: true do
...
@@ -1024,7 +1024,7 @@ describe MergeRequest, models: true do
context
'with environments on source project'
do
context
'with environments on source project'
do
let
(
:source_project
)
do
let
(
:source_project
)
do
create
(
:project
)
do
|
fork_project
|
create
(
:project
,
:repository
)
do
|
fork_project
|
fork_project
.
create_forked_project_link
(
forked_to_project_id:
fork_project
.
id
,
forked_from_project_id:
project
.
id
)
fork_project
.
create_forked_project_link
(
forked_to_project_id:
fork_project
.
id
,
forked_from_project_id:
project
.
id
)
end
end
end
end
...
@@ -1401,8 +1401,8 @@ describe MergeRequest, models: true do
...
@@ -1401,8 +1401,8 @@ describe MergeRequest, models: true do
end
end
describe
"#source_project_missing?"
do
describe
"#source_project_missing?"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:
empty_
project
,
forked_from_project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:unlink_project
)
{
Projects
::
UnlinkForkService
.
new
(
fork_project
,
user
)
}
let
(
:unlink_project
)
{
Projects
::
UnlinkForkService
.
new
(
fork_project
,
user
)
}
...
@@ -1439,8 +1439,8 @@ describe MergeRequest, models: true do
...
@@ -1439,8 +1439,8 @@ describe MergeRequest, models: true do
end
end
describe
"#closed_without_fork?"
do
describe
"#closed_without_fork?"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
)
}
let
(
:fork_project
)
{
create
(
:
empty_
project
,
forked_from_project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:unlink_project
)
{
Projects
::
UnlinkForkService
.
new
(
fork_project
,
user
)
}
let
(
:unlink_project
)
{
Projects
::
UnlinkForkService
.
new
(
fork_project
,
user
)
}
...
@@ -1485,9 +1485,9 @@ describe MergeRequest, models: true do
...
@@ -1485,9 +1485,9 @@ describe MergeRequest, models: true do
end
end
context
'forked project'
do
context
'forked project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
,
namespace:
user
.
namespace
)
}
let
(
:fork_project
)
{
create
(
:
empty_
project
,
forked_from_project:
project
,
namespace:
user
.
namespace
)
}
let!
(
:merge_request
)
do
let!
(
:merge_request
)
do
create
(
:closed_merge_request
,
create
(
:closed_merge_request
,
...
@@ -1531,7 +1531,7 @@ describe MergeRequest, models: true do
...
@@ -1531,7 +1531,7 @@ describe MergeRequest, models: true do
status:
status
)
status:
status
)
end
end
let
(
:project
)
{
create
(
:project
,
:public
,
only_allow_merge_if_build_succeeds:
true
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
only_allow_merge_if_build_succeeds:
true
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
...
...
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