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
Jérome Perrin
gitlab-ce
Commits
80a6d2fd
Commit
80a6d2fd
authored
Jan 24, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `:empty_project` where possible throughout spec/lib
parent
5f410001
Changes
65
Show whitespace changes
Inline
Side-by-side
Showing
65 changed files
with
114 additions
and
103 deletions
+114
-103
spec/lib/banzai/filter/commit_range_reference_filter_spec.rb
spec/lib/banzai/filter/commit_range_reference_filter_spec.rb
+7
-7
spec/lib/banzai/filter/commit_reference_filter_spec.rb
spec/lib/banzai/filter/commit_reference_filter_spec.rb
+5
-5
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
+1
-1
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
.../lib/banzai/filter/merge_request_reference_filter_spec.rb
+1
-1
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
+1
-1
spec/lib/banzai/filter/relative_link_filter_spec.rb
spec/lib/banzai/filter/relative_link_filter_spec.rb
+1
-1
spec/lib/banzai/filter/upload_link_filter_spec.rb
spec/lib/banzai/filter/upload_link_filter_spec.rb
+1
-1
spec/lib/banzai/filter/video_link_filter_spec.rb
spec/lib/banzai/filter/video_link_filter_spec.rb
+1
-1
spec/lib/banzai/reference_parser/user_parser_spec.rb
spec/lib/banzai/reference_parser/user_parser_spec.rb
+3
-3
spec/lib/constraints/project_url_constrainer_spec.rb
spec/lib/constraints/project_url_constrainer_spec.rb
+1
-1
spec/lib/event_filter_spec.rb
spec/lib/event_filter_spec.rb
+1
-1
spec/lib/extracts_path_spec.rb
spec/lib/extracts_path_spec.rb
+1
-1
spec/lib/gitlab/badge/build/metadata_spec.rb
spec/lib/gitlab/badge/build/metadata_spec.rb
+1
-1
spec/lib/gitlab/badge/build/status_spec.rb
spec/lib/gitlab/badge/build/status_spec.rb
+1
-1
spec/lib/gitlab/badge/coverage/metadata_spec.rb
spec/lib/gitlab/badge/coverage/metadata_spec.rb
+1
-1
spec/lib/gitlab/bitbucket_import/importer_spec.rb
spec/lib/gitlab/bitbucket_import/importer_spec.rb
+1
-1
spec/lib/gitlab/blame_spec.rb
spec/lib/gitlab/blame_spec.rb
+1
-1
spec/lib/gitlab/chat_commands/command_spec.rb
spec/lib/gitlab/chat_commands/command_spec.rb
+1
-1
spec/lib/gitlab/checks/change_access_spec.rb
spec/lib/gitlab/checks/change_access_spec.rb
+1
-1
spec/lib/gitlab/checks/force_push_spec.rb
spec/lib/gitlab/checks/force_push_spec.rb
+1
-1
spec/lib/gitlab/closing_issue_extractor_spec.rb
spec/lib/gitlab/closing_issue_extractor_spec.rb
+4
-4
spec/lib/gitlab/conflict/file_spec.rb
spec/lib/gitlab/conflict/file_spec.rb
+1
-1
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
+6
-4
spec/lib/gitlab/data_builder/note_spec.rb
spec/lib/gitlab/data_builder/note_spec.rb
+1
-1
spec/lib/gitlab/data_builder/pipeline_spec.rb
spec/lib/gitlab/data_builder/pipeline_spec.rb
+1
-1
spec/lib/gitlab/data_builder/push_spec.rb
spec/lib/gitlab/data_builder/push_spec.rb
+1
-1
spec/lib/gitlab/diff/file_spec.rb
spec/lib/gitlab/diff/file_spec.rb
+1
-1
spec/lib/gitlab/diff/highlight_spec.rb
spec/lib/gitlab/diff/highlight_spec.rb
+1
-1
spec/lib/gitlab/diff/line_mapper_spec.rb
spec/lib/gitlab/diff/line_mapper_spec.rb
+1
-1
spec/lib/gitlab/diff/parallel_diff_spec.rb
spec/lib/gitlab/diff/parallel_diff_spec.rb
+1
-1
spec/lib/gitlab/diff/position_spec.rb
spec/lib/gitlab/diff/position_spec.rb
+1
-1
spec/lib/gitlab/diff/position_tracer_spec.rb
spec/lib/gitlab/diff/position_tracer_spec.rb
+1
-1
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
+1
-1
spec/lib/gitlab/email/handler/create_note_handler_spec.rb
spec/lib/gitlab/email/handler/create_note_handler_spec.rb
+1
-1
spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb
spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb
+1
-1
spec/lib/gitlab/email/message/repository_push_spec.rb
spec/lib/gitlab/email/message/repository_push_spec.rb
+1
-1
spec/lib/gitlab/gfm/reference_rewriter_spec.rb
spec/lib/gitlab/gfm/reference_rewriter_spec.rb
+2
-2
spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
+2
-2
spec/lib/gitlab/git/hook_spec.rb
spec/lib/gitlab/git/hook_spec.rb
+1
-1
spec/lib/gitlab/git/rev_list_spec.rb
spec/lib/gitlab/git/rev_list_spec.rb
+1
-1
spec/lib/gitlab/git_access_spec.rb
spec/lib/gitlab/git_access_spec.rb
+9
-9
spec/lib/gitlab/git_access_wiki_spec.rb
spec/lib/gitlab/git_access_wiki_spec.rb
+1
-1
spec/lib/gitlab/github_import/branch_formatter_spec.rb
spec/lib/gitlab/github_import/branch_formatter_spec.rb
+1
-1
spec/lib/gitlab/github_import/comment_formatter_spec.rb
spec/lib/gitlab/github_import/comment_formatter_spec.rb
+1
-1
spec/lib/gitlab/github_import/issue_formatter_spec.rb
spec/lib/gitlab/github_import/issue_formatter_spec.rb
+1
-1
spec/lib/gitlab/github_import/label_formatter_spec.rb
spec/lib/gitlab/github_import/label_formatter_spec.rb
+1
-1
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
+1
-1
spec/lib/gitlab/github_import/release_formatter_spec.rb
spec/lib/gitlab/github_import/release_formatter_spec.rb
+1
-1
spec/lib/gitlab/google_code_import/importer_spec.rb
spec/lib/gitlab/google_code_import/importer_spec.rb
+1
-1
spec/lib/gitlab/graphs/commits_spec.rb
spec/lib/gitlab/graphs/commits_spec.rb
+1
-1
spec/lib/gitlab/highlight_spec.rb
spec/lib/gitlab/highlight_spec.rb
+1
-1
spec/lib/gitlab/import_export/import_export_spec.rb
spec/lib/gitlab/import_export/import_export_spec.rb
+1
-1
spec/lib/gitlab/import_export/members_mapper_spec.rb
spec/lib/gitlab/import_export/members_mapper_spec.rb
+1
-1
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+1
-0
spec/lib/gitlab/import_export/repo_bundler_spec.rb
spec/lib/gitlab/import_export/repo_bundler_spec.rb
+1
-1
spec/lib/gitlab/import_export/wiki_repo_bundler_spec.rb
spec/lib/gitlab/import_export/wiki_repo_bundler_spec.rb
+1
-1
spec/lib/gitlab/project_search_results_spec.rb
spec/lib/gitlab/project_search_results_spec.rb
+7
-5
spec/lib/gitlab/reference_extractor_spec.rb
spec/lib/gitlab/reference_extractor_spec.rb
+14
-8
spec/lib/gitlab/search_results_spec.rb
spec/lib/gitlab/search_results_spec.rb
+1
-1
spec/lib/gitlab/template/issue_template_spec.rb
spec/lib/gitlab/template/issue_template_spec.rb
+1
-1
spec/lib/gitlab/template/merge_request_template_spec.rb
spec/lib/gitlab/template/merge_request_template_spec.rb
+1
-1
spec/lib/gitlab/url_builder_spec.rb
spec/lib/gitlab/url_builder_spec.rb
+1
-1
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+1
-1
spec/lib/light_url_builder_spec.rb
spec/lib/light_url_builder_spec.rb
+1
-1
spec/lib/repository_cache_spec.rb
spec/lib/repository_cache_spec.rb
+1
-1
No files found.
spec/lib/banzai/filter/commit_range_reference_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Banzai
::
Filter
::
CommitRangeReferenceFilter
,
lib:
true
do
include
FilterSpecHelper
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:commit1
)
{
project
.
commit
(
"HEAD~2"
)
}
let
(
:commit2
)
{
project
.
commit
}
...
...
@@ -99,7 +99,7 @@ describe Banzai::Filter::CommitRangeReferenceFilter, lib: true do
end
context
'cross-project / cross-namespace complete reference'
do
let
(
:project2
)
{
create
(
:project
,
:public
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:reference
)
{
"
#{
project2
.
path_with_namespace
}
@
#{
commit1
.
id
}
...
#{
commit2
.
id
}
"
}
it
'links to a valid reference'
do
...
...
@@ -133,8 +133,8 @@ describe Banzai::Filter::CommitRangeReferenceFilter, lib: true do
context
'cross-project / same-namespace complete reference'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
path:
"same-namespace"
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
,
path:
"same-namespace"
,
namespace:
namespace
)
}
let
(
:reference
)
{
"
#{
project2
.
path
}
@
#{
commit1
.
id
}
...
#{
commit2
.
id
}
"
}
it
'links to a valid reference'
do
...
...
@@ -168,8 +168,8 @@ describe Banzai::Filter::CommitRangeReferenceFilter, lib: true do
context
'cross-project shorthand reference'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
path:
"same-namespace"
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
,
path:
"same-namespace"
,
namespace:
namespace
)
}
let
(
:reference
)
{
"
#{
project2
.
path
}
@
#{
commit1
.
id
}
...
#{
commit2
.
id
}
"
}
it
'links to a valid reference'
do
...
...
@@ -203,7 +203,7 @@ describe Banzai::Filter::CommitRangeReferenceFilter, lib: true do
context
'cross-project URL reference'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let
(
:range
)
{
CommitRange
.
new
(
"
#{
commit1
.
id
}
...master"
,
project
)
}
let
(
:reference
)
{
urls
.
namespace_project_compare_url
(
project2
.
namespace
,
project2
,
from:
commit1
.
id
,
to:
'master'
)
}
...
...
spec/lib/banzai/filter/commit_reference_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Banzai
::
Filter
::
CommitReferenceFilter
,
lib:
true
do
include
FilterSpecHelper
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
}
it
'requires project context'
do
...
...
@@ -96,7 +96,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
context
'cross-project / cross-namespace complete reference'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let
(
:commit
)
{
project2
.
commit
}
let
(
:reference
)
{
"
#{
project2
.
path_with_namespace
}
@
#{
commit
.
short_id
}
"
}
...
...
@@ -122,7 +122,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
context
'cross-project / same-namespace complete reference'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project
)
{
create
(
:empty_project
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let
(
:commit
)
{
project2
.
commit
}
let
(
:reference
)
{
"
#{
project2
.
path_with_namespace
}
@
#{
commit
.
short_id
}
"
}
...
...
@@ -148,7 +148,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
context
'cross-project shorthand reference'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project
)
{
create
(
:empty_project
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let
(
:commit
)
{
project2
.
commit
}
let
(
:reference
)
{
"
#{
project2
.
path_with_namespace
}
@
#{
commit
.
short_id
}
"
}
...
...
@@ -173,7 +173,7 @@ describe Banzai::Filter::CommitReferenceFilter, lib: true do
context
'cross-project URL reference'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let
(
:commit
)
{
project2
.
commit
}
let
(
:reference
)
{
urls
.
namespace_project_commit_url
(
project2
.
namespace
,
project2
,
commit
.
id
)
}
...
...
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Banzai
::
Filter
::
GollumTagsFilter
,
lib:
true
do
include
FilterSpecHelper
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:user
)
{
double
}
let
(
:project_wiki
)
{
ProjectWiki
.
new
(
project
,
user
)
}
...
...
spec/lib/banzai/filter/merge_request_reference_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -188,7 +188,7 @@ describe Banzai::Filter::MergeRequestReferenceFilter, lib: true do
context
'cross-project URL reference'
do
let
(
:namespace
)
{
create
(
:namespace
,
name:
'cross-reference'
)
}
let
(
:project2
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let
(
:project2
)
{
create
(
:
empty_
project
,
:public
,
namespace:
namespace
)
}
let
(
:merge
)
{
create
(
:merge_request
,
source_project:
project2
,
target_project:
project2
)
}
let
(
:reference
)
{
urls
.
namespace_project_merge_request_url
(
project2
.
namespace
,
project2
,
merge
)
+
'/diffs#note_123'
}
...
...
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Banzai
::
Filter
::
MilestoneReferenceFilter
,
lib:
true
do
include
FilterSpecHelper
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:reference
)
{
milestone
.
to_reference
}
...
...
spec/lib/banzai/filter/relative_link_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -25,7 +25,7 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
%(<a href="#{path}">#{path}</a>)
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project_path
)
{
project
.
path_with_namespace
}
let
(
:ref
)
{
'markdown'
}
let
(
:commit
)
{
project
.
commit
(
ref
)
}
...
...
spec/lib/banzai/filter/upload_link_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -29,7 +29,7 @@ describe Banzai::Filter::UploadLinkFilter, lib: true do
%(<div><a href="#{path}">#{path}</a></div>)
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
shared_examples
:preserve_unchanged
do
it
'does not modify any relative URL in anchor'
do
...
...
spec/lib/banzai/filter/video_link_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -13,7 +13,7 @@ describe Banzai::Filter::VideoLinkFilter, lib: true do
%(<img src="#{path}" />)
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
'when the element src has a video extension'
do
UploaderHelper
::
VIDEO_EXT
.
each
do
|
ext
|
...
...
spec/lib/banzai/reference_parser/user_parser_spec.rb
View file @
80a6d2fd
...
...
@@ -147,7 +147,7 @@ describe Banzai::ReferenceParser::UserParser, lib: true do
describe
'#nodes_user_can_reference'
do
context
'when the link has a data-author attribute'
do
it
'returns the nodes when the user is a member of the project'
do
other_project
=
create
(
:project
)
other_project
=
create
(
:
empty_
project
)
other_project
.
team
<<
[
user
,
:developer
]
link
[
'data-project'
]
=
other_project
.
id
.
to_s
...
...
@@ -164,7 +164,7 @@ describe Banzai::ReferenceParser::UserParser, lib: true do
end
it
'returns an empty Array when the user could not be found'
do
other_project
=
create
(
:project
)
other_project
=
create
(
:
empty_
project
)
link
[
'data-project'
]
=
other_project
.
id
.
to_s
link
[
'data-author'
]
=
''
...
...
@@ -173,7 +173,7 @@ describe Banzai::ReferenceParser::UserParser, lib: true do
end
it
'returns an empty Array when the user is not a team member'
do
other_project
=
create
(
:project
)
other_project
=
create
(
:
empty_
project
)
link
[
'data-project'
]
=
other_project
.
id
.
to_s
link
[
'data-author'
]
=
user
.
id
.
to_s
...
...
spec/lib/constraints/project_url_constrainer_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
ProjectUrlConstrainer
,
lib:
true
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:
empty_
project
)
}
let!
(
:namespace
)
{
project
.
namespace
}
describe
'#matches?'
do
...
...
spec/lib/event_filter_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
EventFilter
,
lib:
true
do
describe
'#apply_filter'
do
let
(
:source_user
)
{
create
(
:user
)
}
let!
(
:public_project
)
{
create
(
:project
,
:public
)
}
let!
(
:public_project
)
{
create
(
:
empty_
project
,
:public
)
}
let!
(
:push_event
)
{
create
(
:event
,
action:
Event
::
PUSHED
,
project:
public_project
,
target:
public_project
,
author:
source_user
)
}
let!
(
:merged_event
)
{
create
(
:event
,
action:
Event
::
MERGED
,
project:
public_project
,
target:
public_project
,
author:
source_user
)
}
...
...
spec/lib/extracts_path_spec.rb
View file @
80a6d2fd
...
...
@@ -24,7 +24,7 @@ describe ExtractsPath, lib: true do
let
(
:params
)
{
{
path:
sample_commit
[
:line_code_path
],
ref:
ref
}
}
before
do
@project
=
create
(
:project
)
@project
=
create
(
:project
,
:repository
)
end
it
"log tree path has no escape sequences"
do
...
...
spec/lib/gitlab/badge/build/metadata_spec.rb
View file @
80a6d2fd
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
require
'lib/gitlab/badge/shared/metadata'
describe
Gitlab
::
Badge
::
Build
::
Metadata
do
let
(
:badge
)
{
double
(
project:
create
(
:project
),
ref:
'feature'
)
}
let
(
:badge
)
{
double
(
project:
create
(
:
empty_
project
),
ref:
'feature'
)
}
let
(
:metadata
)
{
described_class
.
new
(
badge
)
}
it_behaves_like
'badge metadata'
...
...
spec/lib/gitlab/badge/build/status_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
Badge
::
Build
::
Status
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:sha
)
{
project
.
commit
.
sha
}
let
(
:branch
)
{
'master'
}
let
(
:badge
)
{
described_class
.
new
(
project
,
branch
)
}
...
...
spec/lib/gitlab/badge/coverage/metadata_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'lib/gitlab/badge/shared/metadata'
describe
Gitlab
::
Badge
::
Coverage
::
Metadata
do
let
(
:badge
)
do
double
(
project:
create
(
:project
),
ref:
'feature'
,
job:
'test'
)
double
(
project:
create
(
:
empty_
project
),
ref:
'feature'
,
job:
'test'
)
end
let
(
:metadata
)
{
described_class
.
new
(
badge
)
}
...
...
spec/lib/gitlab/bitbucket_import/importer_spec.rb
View file @
80a6d2fd
...
...
@@ -52,7 +52,7 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
let
(
:project
)
do
create
(
:project
,
:
empty_
project
,
import_source:
project_identifier
,
import_data:
ProjectImportData
.
new
(
credentials:
data
)
)
...
...
spec/lib/gitlab/blame_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
Blame
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:path
)
{
'files/ruby/popen.rb'
}
let
(
:commit
)
{
project
.
commit
(
'master'
)
}
let
(
:blob
)
{
project
.
repository
.
blob_at
(
commit
.
id
,
path
)
}
...
...
spec/lib/gitlab/chat_commands/command_spec.rb
View file @
80a6d2fd
...
...
@@ -11,7 +11,7 @@ describe Gitlab::ChatCommands::Command, service: true do
context
'when no command is available'
do
let
(
:params
)
{
{
text:
'issue show 1'
}
}
let
(
:project
)
{
create
(
:project
,
has_external_issue_tracker:
true
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
has_external_issue_tracker:
true
)
}
it
'displays 404 messages'
do
expect
(
subject
[
:response_type
]).
to
be
(
:ephemeral
)
...
...
spec/lib/gitlab/checks/change_access_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Checks
::
ChangeAccess
,
lib:
true
do
describe
'#exec'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user_access
)
{
Gitlab
::
UserAccess
.
new
(
user
,
project:
project
)
}
let
(
:changes
)
do
{
...
...
spec/lib/gitlab/checks/force_push_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
Checks
::
ChangeAccess
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
"exit code checking"
do
it
"does not raise a runtime error if the `popen` call to git returns a zero exit code"
do
...
...
spec/lib/gitlab/closing_issue_extractor_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
ClosingIssueExtractor
,
lib:
true
do
let
(
:project
)
{
create
(
:
project
)
}
let
(
:project2
)
{
create
(
:
project
)
}
let
(
:project
)
{
create
(
:empty_
project
)
}
let
(
:project2
)
{
create
(
:empty_
project
)
}
let
(
:forked_project
)
{
Projects
::
ForkService
.
new
(
project
,
project
.
creator
).
execute
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project2
)
}
...
...
spec/lib/gitlab/conflict/file_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
Conflict
::
File
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:rugged
)
{
repository
.
rugged
}
let
(
:their_commit
)
{
rugged
.
branches
[
'conflict-start'
].
target
}
...
...
spec/lib/gitlab/cycle_analytics/stage_summary_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
CycleAnalytics
::
StageSummary
,
models:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:from
)
{
1
.
day
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
described_class
.
new
(
project
,
from:
Time
.
now
,
current_user:
user
).
data
}
...
...
@@ -15,7 +15,7 @@ describe Gitlab::CycleAnalytics::StageSummary, models: true do
end
it
"doesn't find issues from other projects"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:project
))
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:
empty_
project
))
}
expect
(
subject
.
first
[
:value
]).
to
eq
(
0
)
end
...
...
@@ -30,7 +30,7 @@ describe Gitlab::CycleAnalytics::StageSummary, models: true do
end
it
"doesn't find commits from other projects"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create_commit
(
"Test message"
,
create
(
:project
),
user
,
'master'
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create_commit
(
"Test message"
,
create
(
:project
,
:repository
),
user
,
'master'
)
}
expect
(
subject
.
second
[
:value
]).
to
eq
(
0
)
end
...
...
@@ -51,7 +51,9 @@ describe Gitlab::CycleAnalytics::StageSummary, models: true do
end
it
"doesn't find commits from other projects"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:deployment
,
project:
create
(
:project
))
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
do
create
(
:deployment
,
project:
create
(
:project
,
:repository
))
end
expect
(
subject
.
third
[
:value
]).
to
eq
(
0
)
end
...
...
spec/lib/gitlab/data_builder/note_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
DataBuilder
::
Note
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:data
)
{
described_class
.
build
(
note
,
user
)
}
let
(
:fixed_time
)
{
Time
.
at
(
1425600000
)
}
# Avoid time precision errors
...
...
spec/lib/gitlab/data_builder/pipeline_spec.rb
View file @
80a6d2fd
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
DataBuilder
::
Pipeline
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
...
...
spec/lib/gitlab/data_builder/push_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
DataBuilder
::
Push
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
'.build_sample'
do
...
...
spec/lib/gitlab/diff/file_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Diff
::
File
,
lib:
true
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:diff
)
{
commit
.
raw_diffs
.
first
}
let
(
:diff_file
)
{
Gitlab
::
Diff
::
File
.
new
(
diff
,
diff_refs:
commit
.
diff_refs
,
repository:
project
.
repository
)
}
...
...
spec/lib/gitlab/diff/highlight_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Diff
::
Highlight
,
lib:
true
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:diff
)
{
commit
.
raw_diffs
.
first
}
let
(
:diff_file
)
{
Gitlab
::
Diff
::
File
.
new
(
diff
,
diff_refs:
commit
.
diff_refs
,
repository:
project
.
repository
)
}
...
...
spec/lib/gitlab/diff/line_mapper_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Diff
::
LineMapper
,
lib:
true
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:diffs
)
{
commit
.
raw_diffs
}
...
...
spec/lib/gitlab/diff/parallel_diff_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Diff
::
ParallelDiff
,
lib:
true
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:diffs
)
{
commit
.
raw_diffs
}
...
...
spec/lib/gitlab/diff/position_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Diff
::
Position
,
lib:
true
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
describe
"position for an added file"
do
let
(
:commit
)
{
project
.
commit
(
"2ea1f3dec713d940208fb5ce4a38765ecb5d3f73"
)
}
...
...
spec/lib/gitlab/diff/position_tracer_spec.rb
View file @
80a6d2fd
...
...
@@ -51,7 +51,7 @@ describe Gitlab::Diff::PositionTracer, lib: true do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:current_user
)
{
project
.
owner
}
let
(
:repository
)
{
project
.
repository
}
let
(
:file_name
)
{
"test-file"
}
...
...
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
View file @
80a6d2fd
...
...
@@ -13,7 +13,7 @@ describe Gitlab::Email::Handler::CreateIssueHandler, lib: true do
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_new_issue.eml'
)
}
let
(
:namespace
)
{
create
(
:namespace
,
path:
'gitlabhq'
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
namespace:
namespace
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
namespace
)
}
let!
(
:user
)
do
create
(
:user
,
...
...
spec/lib/gitlab/email/handler/create_note_handler_spec.rb
View file @
80a6d2fd
...
...
@@ -11,7 +11,7 @@ describe Gitlab::Email::Handler::CreateNoteHandler, lib: true do
end
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
project:
project
)
}
let
(
:noteable
)
{
note
.
noteable
}
...
...
spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb
View file @
80a6d2fd
...
...
@@ -10,7 +10,7 @@ describe Gitlab::Email::Handler::UnsubscribeHandler, lib: true do
end
let
(
:email_raw
)
{
fixture_file
(
'emails/valid_reply.eml'
).
gsub
(
mail_key
,
"
#{
mail_key
}
+unsubscribe"
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:noteable
)
{
create
(
:issue
,
project:
project
)
}
...
...
spec/lib/gitlab/email/message/repository_push_spec.rb
View file @
80a6d2fd
...
...
@@ -4,7 +4,7 @@ describe Gitlab::Email::Message::RepositoryPush do
include
RepoHelpers
let!
(
:group
)
{
create
(
:group
,
name:
'my_group'
)
}
let!
(
:project
)
{
create
(
:project
,
name:
'my_project'
,
namespace:
group
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
,
name:
'my_project'
,
namespace:
group
)
}
let!
(
:author
)
{
create
(
:author
,
name:
'Author'
)
}
let
(
:message
)
do
...
...
spec/lib/gitlab/gfm/reference_rewriter_spec.rb
View file @
80a6d2fd
...
...
@@ -2,8 +2,8 @@ require 'spec_helper'
describe
Gitlab
::
Gfm
::
ReferenceRewriter
do
let
(
:text
)
{
'some text'
}
let
(
:old_project
)
{
create
(
:
project
,
name:
'old
'
)
}
let
(
:new_project
)
{
create
(
:
project
,
name:
'new
'
)
}
let
(
:old_project
)
{
create
(
:
empty_project
,
name:
'old-project
'
)
}
let
(
:new_project
)
{
create
(
:
empty_project
,
name:
'new-project
'
)
}
let
(
:user
)
{
create
(
:user
)
}
before
{
old_project
.
team
<<
[
user
,
:reporter
]
}
...
...
spec/lib/gitlab/gfm/uploads_rewriter_spec.rb
View file @
80a6d2fd
...
...
@@ -2,8 +2,8 @@ require 'spec_helper'
describe
Gitlab
::
Gfm
::
UploadsRewriter
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:old_project
)
{
create
(
:project
)
}
let
(
:new_project
)
{
create
(
:project
)
}
let
(
:old_project
)
{
create
(
:
empty_
project
)
}
let
(
:new_project
)
{
create
(
:
empty_
project
)
}
let
(
:rewriter
)
{
described_class
.
new
(
text
,
old_project
,
user
)
}
context
'text contains links to uploads'
do
...
...
spec/lib/gitlab/git/hook_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'fileutils'
describe
Gitlab
::
Git
::
Hook
,
lib:
true
do
describe
"#trigger"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
def
create_hook
(
name
)
...
...
spec/lib/gitlab/git/rev_list_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
Git
::
RevList
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
context
"validations"
do
described_class
::
ALLOWED_VARIABLES
.
each
do
|
var
|
...
...
spec/lib/gitlab/git_access_spec.rb
View file @
80a6d2fd
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
GitAccess
,
lib:
true
do
let
(
:access
)
{
Gitlab
::
GitAccess
.
new
(
actor
,
project
,
'web'
,
authentication_abilities:
authentication_abilities
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:actor
)
{
user
}
let
(
:authentication_abilities
)
do
...
...
@@ -88,7 +88,7 @@ describe Gitlab::GitAccess, lib: true do
end
context
'when project is public'
do
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
let
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:guest_access
)
{
Gitlab
::
GitAccess
.
new
(
nil
,
public_project
,
'web'
,
authentication_abilities:
[])
}
subject
{
guest_access
.
check
(
'git-upload-pack'
,
'_any'
)
}
...
...
@@ -124,19 +124,19 @@ describe Gitlab::GitAccess, lib: true do
context
'when unauthorized'
do
context
'from public project'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
it
{
expect
(
subject
).
to
be_allowed
}
end
context
'from internal project'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:project
,
:internal
,
:repository
)
}
it
{
expect
(
subject
).
not_to
be_allowed
}
end
context
'from private project'
do
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
:repository
)
}
it
{
expect
(
subject
).
not_to
be_allowed
}
end
...
...
@@ -148,7 +148,7 @@ describe Gitlab::GitAccess, lib: true do
let
(
:authentication_abilities
)
{
build_authentication_abilities
}
describe
'owner'
do
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
context
'pull code'
do
it
{
expect
(
subject
).
to
be_allowed
}
...
...
@@ -364,19 +364,19 @@ describe Gitlab::GitAccess, lib: true do
context
'when unauthorized'
do
context
'to public project'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
it
{
expect
(
subject
).
not_to
be_allowed
}
end
context
'to internal project'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:project
,
:internal
,
:repository
)
}
it
{
expect
(
subject
).
not_to
be_allowed
}
end
context
'to private project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
:repository
)
}
it
{
expect
(
subject
).
not_to
be_allowed
}
end
...
...
spec/lib/gitlab/git_access_wiki_spec.rb
View file @
80a6d2fd
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
GitAccessWiki
,
lib:
true
do
let
(
:access
)
{
Gitlab
::
GitAccessWiki
.
new
(
user
,
project
,
'web'
,
authentication_abilities:
authentication_abilities
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:authentication_abilities
)
do
[
...
...
spec/lib/gitlab/github_import/branch_formatter_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
GithubImport
::
BranchFormatter
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:commit
)
{
create
(
:commit
,
project:
project
)
}
let
(
:repo
)
{
double
}
let
(
:raw
)
do
...
...
spec/lib/gitlab/github_import/comment_formatter_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
GithubImport
::
CommentFormatter
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:octocat
)
{
double
(
id:
123456
,
login:
'octocat'
)
}
let
(
:created_at
)
{
DateTime
.
strptime
(
'2013-04-10T20:09:31Z'
)
}
let
(
:updated_at
)
{
DateTime
.
strptime
(
'2014-03-03T18:58:10Z'
)
}
...
...
spec/lib/gitlab/github_import/issue_formatter_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
GithubImport
::
IssueFormatter
,
lib:
true
do
let!
(
:project
)
{
create
(
:project
,
namespace:
create
(
:namespace
,
path:
'octocat'
))
}
let!
(
:project
)
{
create
(
:
empty_
project
,
namespace:
create
(
:namespace
,
path:
'octocat'
))
}
let
(
:octocat
)
{
double
(
id:
123456
,
login:
'octocat'
)
}
let
(
:created_at
)
{
DateTime
.
strptime
(
'2011-01-26T19:01:12Z'
)
}
let
(
:updated_at
)
{
DateTime
.
strptime
(
'2011-01-27T19:01:12Z'
)
}
...
...
spec/lib/gitlab/github_import/label_formatter_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
GithubImport
::
LabelFormatter
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:raw
)
{
double
(
name:
'improvements'
,
color:
'e6e6e6'
)
}
subject
{
described_class
.
new
(
project
,
raw
)
}
...
...
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
GithubImport
::
PullRequestFormatter
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:source_sha
)
{
create
(
:commit
,
project:
project
).
id
}
let
(
:target_sha
)
{
create
(
:commit
,
project:
project
,
git_commit:
RepoHelpers
.
another_sample_commit
).
id
}
let
(
:repository
)
{
double
(
id:
1
,
fork:
false
)
}
...
...
spec/lib/gitlab/github_import/release_formatter_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
GithubImport
::
ReleaseFormatter
,
lib:
true
do
let!
(
:project
)
{
create
(
:project
,
namespace:
create
(
:namespace
,
path:
'octocat'
))
}
let!
(
:project
)
{
create
(
:
empty_
project
,
namespace:
create
(
:namespace
,
path:
'octocat'
))
}
let
(
:octocat
)
{
double
(
id:
123456
,
login:
'octocat'
)
}
let
(
:created_at
)
{
DateTime
.
strptime
(
'2011-01-26T19:01:12Z'
)
}
...
...
spec/lib/gitlab/google_code_import/importer_spec.rb
View file @
80a6d2fd
...
...
@@ -10,7 +10,7 @@ describe Gitlab::GoogleCodeImport::Importer, lib: true do
'user_map'
=>
{
'thilo...'
=>
"@
#{
mapped_user
.
username
}
"
}
}
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
subject
{
described_class
.
new
(
project
)
}
...
...
spec/lib/gitlab/graphs/commits_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
Graphs
::
Commits
,
lib:
true
do
let!
(
:project
)
{
create
(
:
project
,
:public
,
:empty_repo
)
}
let!
(
:project
)
{
create
(
:
empty_project
,
:public
)
}
let!
(
:commit1
)
{
create
(
:commit
,
git_commit:
RepoHelpers
.
sample_commit
,
project:
project
,
committed_date:
Time
.
now
)
}
let!
(
:commit1_yesterday
)
{
create
(
:commit
,
git_commit:
RepoHelpers
.
sample_commit
,
project:
project
,
committed_date:
1
.
day
.
ago
)}
...
...
spec/lib/gitlab/highlight_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
Highlight
,
lib:
true
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
...
...
spec/lib/gitlab/import_export/import_export_spec.rb
View file @
80a6d2fd
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
,
services:
true
do
describe
'export filename'
do
let
(
:project
)
{
create
(
:project
,
:public
,
path:
'project-path'
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
,
path:
'project-path'
)
}
it
'contains the project path'
do
expect
(
described_class
.
export_filename
(
project:
project
)).
to
include
(
project
.
path
)
...
...
spec/lib/gitlab/import_export/members_mapper_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
MembersMapper
,
services:
true
do
describe
'map members'
do
let
(
:user
)
{
create
(
:admin
,
authorized_projects_populated:
true
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
,
name:
'searchable_project'
)
}
let
(
:user2
)
{
create
(
:user
,
authorized_projects_populated:
true
)
}
let
(
:exported_user_id
)
{
99
}
let
(
:exported_members
)
do
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
80a6d2fd
...
...
@@ -151,6 +151,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
project
=
create
(
:project
,
:public
,
:repository
,
issues:
[
issue
],
snippets:
[
snippet
],
releases:
[
release
],
...
...
spec/lib/gitlab/import_export/repo_bundler_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
RepoSaver
,
services:
true
do
describe
'bundle a project Git repo'
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let!
(
:project
)
{
create
(
:
empty_
project
,
:public
,
name:
'searchable_project'
)
}
let
(
:export_path
)
{
"
#{
Dir
::
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
path_with_namespace
)
}
let
(
:bundler
)
{
described_class
.
new
(
project:
project
,
shared:
shared
)
}
...
...
spec/lib/gitlab/import_export/wiki_repo_bundler_spec.rb
View file @
80a6d2fd
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
WikiRepoSaver
,
services:
true
do
describe
'bundle a wiki Git repo'
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let!
(
:project
)
{
create
(
:
empty_
project
,
:public
,
name:
'searchable_project'
)
}
let
(
:export_path
)
{
"
#{
Dir
::
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
path_with_namespace
)
}
let
(
:wiki_bundler
)
{
described_class
.
new
(
project:
project
,
shared:
shared
)
}
...
...
spec/lib/gitlab/project_search_results_spec.rb
View file @
80a6d2fd
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
ProjectSearchResults
,
lib:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:query
)
{
'hello world'
}
describe
'initialize with empty ref'
do
...
...
@@ -22,6 +22,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
end
describe
'blob search'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:results
)
{
described_class
.
new
(
user
,
project
,
'files'
).
objects
(
'blobs'
)
}
it
'finds by name'
do
...
...
@@ -74,6 +75,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
end
describe
'confidential issues'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:query
)
{
'issue'
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:assignee
)
{
create
(
:user
)
}
...
...
@@ -187,7 +189,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
#
shared_examples
'access restricted commits'
do
context
'when project is internal'
do
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:project
)
{
create
(
:project
,
:internal
,
:repository
)
}
it
'does not search if user is not authenticated'
do
commits
=
described_class
.
new
(
nil
,
project
,
search_phrase
).
objects
(
'commits'
)
...
...
@@ -204,7 +206,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
context
'when project is private'
do
let!
(
:creator
)
{
create
(
:user
,
username:
'private-project-author'
)
}
let!
(
:private_project
)
{
create
(
:project
,
:private
,
creator:
creator
,
namespace:
creator
.
namespace
)
}
let!
(
:private_project
)
{
create
(
:project
,
:private
,
:repository
,
creator:
creator
,
namespace:
creator
.
namespace
)
}
let
(
:team_master
)
do
user
=
create
(
:user
,
username:
'private-project-master'
)
private_project
.
team
<<
[
user
,
:master
]
...
...
@@ -246,7 +248,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
describe
'commit search'
do
context
'by commit message'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:commit
)
{
project
.
repository
.
commit
(
'59e29889be61e6e0e5e223bfa9ac2721d31605b8'
)
}
let
(
:message
)
{
'Sorry, I did a mistake'
}
...
...
@@ -269,7 +271,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
end
context
'by commit hash'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:commit
)
{
project
.
repository
.
commit
(
'0b4bc9a'
)
}
commit_hashes
=
{
short:
'0b4bc9a'
,
full:
'0b4bc9a49b562e85de7cc9e834518ea6828729b9'
}
...
...
spec/lib/gitlab/reference_extractor_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
ReferenceExtractor
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
before
{
project
.
team
<<
[
project
.
creator
,
:developer
]
}
before
do
project
.
team
<<
[
project
.
creator
,
:developer
]
end
subject
{
Gitlab
::
ReferenceExtractor
.
new
(
project
,
project
.
creator
)
}
...
...
@@ -78,22 +80,27 @@ describe Gitlab::ReferenceExtractor, lib: true do
end
it
'accesses valid commits'
do
project
=
create
(
:project
,
:repository
)
{
|
p
|
p
.
add_developer
(
p
.
creator
)
}
commit
=
project
.
commit
(
'master'
)
subject
.
analyze
(
"this references commits
#{
commit
.
sha
[
0
..
6
]
}
and 012345"
)
extracted
=
subject
.
commits
extractor
=
described_class
.
new
(
project
,
project
.
creator
)
extractor
.
analyze
(
"this references commits
#{
commit
.
sha
[
0
..
6
]
}
and 012345"
)
extracted
=
extractor
.
commits
expect
(
extracted
.
size
).
to
eq
(
1
)
expect
(
extracted
[
0
].
sha
).
to
eq
(
commit
.
sha
)
expect
(
extracted
[
0
].
message
).
to
eq
(
commit
.
message
)
end
it
'accesses valid commit ranges'
do
project
=
create
(
:project
,
:repository
)
{
|
p
|
p
.
add_developer
(
p
.
creator
)
}
commit
=
project
.
commit
(
'master'
)
earlier_commit
=
project
.
commit
(
'master~2'
)
subject
.
analyze
(
"this references commits
#{
earlier_commit
.
sha
[
0
..
6
]
}
...
#{
commit
.
sha
[
0
..
6
]
}
"
)
extractor
=
described_class
.
new
(
project
,
project
.
creator
)
extractor
.
analyze
(
"this references commits
#{
earlier_commit
.
sha
[
0
..
6
]
}
...
#{
commit
.
sha
[
0
..
6
]
}
"
)
extracted
=
extractor
.
commit_ranges
extracted
=
subject
.
commit_ranges
expect
(
extracted
.
size
).
to
eq
(
1
)
expect
(
extracted
.
first
).
to
be_kind_of
(
CommitRange
)
expect
(
extracted
.
first
.
commit_from
).
to
eq
earlier_commit
...
...
@@ -102,7 +109,6 @@ describe Gitlab::ReferenceExtractor, lib: true do
context
'with an external issue tracker'
do
let
(
:project
)
{
create
(
:jira_project
)
}
subject
{
described_class
.
new
(
project
,
project
.
creator
)
}
it
'returns JIRA issues for a JIRA-integrated project'
do
subject
.
analyze
(
'JIRA-123 and FOOBAR-4567'
)
...
...
@@ -112,7 +118,7 @@ describe Gitlab::ReferenceExtractor, lib: true do
end
context
'with a project with an underscore'
do
let
(
:other_project
)
{
create
(
:project
,
path:
'test_project'
)
}
let
(
:other_project
)
{
create
(
:
empty_
project
,
path:
'test_project'
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
other_project
)
}
before
do
...
...
spec/lib/gitlab/search_results_spec.rb
View file @
80a6d2fd
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
SearchResults
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
name:
'foo'
)
}
let!
(
:project
)
{
create
(
:
empty_
project
,
name:
'foo'
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
title:
'foo'
)
}
let!
(
:merge_request
)
do
...
...
spec/lib/gitlab/template/issue_template_spec.rb
View file @
80a6d2fd
...
...
@@ -4,7 +4,7 @@ describe Gitlab::Template::IssueTemplate do
subject
{
described_class
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:file_path_1
)
{
'.gitlab/issue_templates/bug.md'
}
let
(
:file_path_2
)
{
'.gitlab/issue_templates/template_test.md'
}
let
(
:file_path_3
)
{
'.gitlab/issue_templates/feature_proposal.md'
}
...
...
spec/lib/gitlab/template/merge_request_template_spec.rb
View file @
80a6d2fd
...
...
@@ -4,7 +4,7 @@ describe Gitlab::Template::MergeRequestTemplate do
subject
{
described_class
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:file_path_1
)
{
'.gitlab/merge_request_templates/bug.md'
}
let
(
:file_path_2
)
{
'.gitlab/merge_request_templates/template_test.md'
}
let
(
:file_path_3
)
{
'.gitlab/merge_request_templates/feature_proposal.md'
}
...
...
spec/lib/gitlab/url_builder_spec.rb
View file @
80a6d2fd
...
...
@@ -99,7 +99,7 @@ describe Gitlab::UrlBuilder, lib: true do
context
'on another object'
do
it
'returns a proper URL'
do
project
=
build_stubbed
(
:project
)
project
=
build_stubbed
(
:
empty_
project
)
expect
{
described_class
.
build
(
project
)
}.
to
raise_error
(
NotImplementedError
,
'No URL builder defined for Project'
)
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
Gitlab
::
Workhorse
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
def
decode_workhorse_header
(
array
)
...
...
spec/lib/light_url_builder_spec.rb
View file @
80a6d2fd
...
...
@@ -99,7 +99,7 @@ describe Gitlab::UrlBuilder, lib: true do
context
'on another object'
do
it
'returns a proper URL'
do
project
=
build_stubbed
(
:project
)
project
=
build_stubbed
(
:
empty_
project
)
expect
{
described_class
.
build
(
project
)
}.
to
raise_error
(
NotImplementedError
,
'No URL builder defined for Project'
)
...
...
spec/lib/repository_cache_spec.rb
View file @
80a6d2fd
require
'spec_helper'
describe
RepositoryCache
,
lib:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:backend
)
{
double
(
'backend'
).
as_null_object
}
let
(
:cache
)
{
RepositoryCache
.
new
(
'example'
,
project
.
id
,
backend
)
}
...
...
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