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
f4736531
Commit
f4736531
authored
Mar 25, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace set to let_it_be in spec
Get rids of `set` in specs
parent
085a1a2f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
68 additions
and
71 deletions
+68
-71
spec/frontend/fixtures/autocomplete_sources.rb
spec/frontend/fixtures/autocomplete_sources.rb
+4
-4
spec/frontend/fixtures/commit.rb
spec/frontend/fixtures/commit.rb
+3
-3
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+3
-3
spec/requests/api/internal/base_spec.rb
spec/requests/api/internal/base_spec.rb
+4
-5
spec/requests/lfs_http_spec.rb
spec/requests/lfs_http_spec.rb
+3
-3
spec/services/metrics/dashboard/update_dashboard_service_spec.rb
...rvices/metrics/dashboard/update_dashboard_service_spec.rb
+3
-3
spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb
.../shared_contexts/finders/issues_finder_shared_contexts.rb
+17
-17
spec/support/shared_contexts/finders/merge_requests_finder_shared_contexts.rb
...contexts/finders/merge_requests_finder_shared_contexts.rb
+9
-10
spec/support/shared_contexts/finders/users_finder_shared_contexts.rb
...t/shared_contexts/finders/users_finder_shared_contexts.rb
+4
-4
spec/support/shared_contexts/mailers/notify_shared_context.rb
.../support/shared_contexts/mailers/notify_shared_context.rb
+4
-5
spec/support/shared_contexts/policies/project_policy_shared_context.rb
...shared_contexts/policies/project_policy_shared_context.rb
+6
-6
spec/support/shared_examples/finders/snippet_visibility_shared_examples.rb
...ed_examples/finders/snippet_visibility_shared_examples.rb
+5
-5
spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb
...ctions/issuable/issuable_quick_actions_shared_examples.rb
+2
-2
spec/support/shared_examples/requests/api/boards_shared_examples.rb
...rt/shared_examples/requests/api/boards_shared_examples.rb
+1
-1
No files found.
spec/frontend/fixtures/autocomplete_sources.rb
View file @
f4736531
...
...
@@ -5,10 +5,10 @@ require 'spec_helper'
describe
Projects
::
AutocompleteSourcesController
,
'(JavaScript fixtures)'
,
type: :controller
do
include
JavaScriptFixturesHelpers
set
(
:admin
)
{
create
(
:admin
)
}
set
(
:group
)
{
create
(
:group
,
name:
'frontend-fixtures'
)
}
set
(
:project
)
{
create
(
:project
,
namespace:
group
,
path:
'autocomplete-sources-project'
)
}
set
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:admin
)
{
create
(
:admin
)
}
let_it_be
(
:group
)
{
create
(
:group
,
name:
'frontend-fixtures'
)
}
let_it_be
(
:project
)
{
create
(
:project
,
namespace:
group
,
path:
'autocomplete-sources-project'
)
}
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
before
(
:all
)
do
clean_frontend_fixtures
(
'autocomplete_sources/'
)
...
...
spec/frontend/fixtures/commit.rb
View file @
f4736531
...
...
@@ -5,9 +5,9 @@ require 'spec_helper'
describe
Projects
::
CommitController
,
'(JavaScript fixtures)'
,
type: :controller
do
include
JavaScriptFixturesHelpers
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
render_views
...
...
spec/mailers/notify_spec.rb
View file @
f4736531
...
...
@@ -13,9 +13,9 @@ describe Notify do
let
(
:current_user_sanitized
)
{
'www_example_com'
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:current_user
)
{
create
(
:user
,
email:
"current@email.com"
,
name:
'www.example.com'
)
}
let_it_be
(
:assignee
)
{
create
(
:user
,
email:
'assignee@example.com'
,
name:
'John Doe'
)
}
let_it_be
(
:user
,
reload:
true
)
{
create
(
:user
)
}
let_it_be
(
:current_user
,
reload:
true
)
{
create
(
:user
,
email:
"current@email.com"
,
name:
'www.example.com'
)
}
let_it_be
(
:assignee
,
reload:
true
)
{
create
(
:user
,
email:
'assignee@example.com'
,
name:
'John Doe'
)
}
let_it_be
(
:merge_request
)
do
create
(
:merge_request
,
source_project:
project
,
...
...
spec/requests/api/internal/base_spec.rb
View file @
f4736531
...
...
@@ -3,15 +3,14 @@
require
'spec_helper'
describe
API
::
Internal
::
Base
do
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
,
reload:
true
)
{
create
(
:user
)
}
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
,
:repository
,
:wiki_repo
)
}
let_it_be
(
:personal_snippet
)
{
create
(
:personal_snippet
,
:repository
,
author:
user
)
}
let_it_be
(
:project_snippet
)
{
create
(
:project_snippet
,
:repository
,
author:
user
,
project:
project
)
}
let
(
:key
)
{
create
(
:key
,
user:
user
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
:wiki_repo
)
}
let
(
:secret_token
)
{
Gitlab
::
Shell
.
secret_token
}
let
(
:gl_repository
)
{
"project-
#{
project
.
id
}
"
}
let
(
:reference_counter
)
{
double
(
'ReferenceCounter'
)
}
let_it_be
(
:personal_snippet
)
{
create
(
:personal_snippet
,
:repository
,
author:
user
)
}
let_it_be
(
:project_snippet
)
{
create
(
:project_snippet
,
:repository
,
author:
user
,
project:
project
)
}
let
(
:snippet_changes
)
{
"
#{
TestEnv
::
BRANCH_SHA
[
'snippet/single-file'
]
}
#{
TestEnv
::
BRANCH_SHA
[
'snippet/edit-file'
]
}
refs/heads/snippet/edit-file"
}
describe
"GET /internal/check"
do
...
...
spec/requests/lfs_http_spec.rb
View file @
f4736531
...
...
@@ -6,9 +6,9 @@ describe 'Git LFS API and storage' do
include
ProjectForksHelper
include
WorkhorseHelpers
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:other_project
)
{
create
(
:project
,
:repository
)
}
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:other_project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let!
(
:lfs_object
)
{
create
(
:lfs_object
,
:with_file
)
}
let
(
:headers
)
do
...
...
spec/services/metrics/dashboard/update_dashboard_service_spec.rb
View file @
f4736531
...
...
@@ -5,9 +5,9 @@ require 'spec_helper'
describe
Metrics
::
Dashboard
::
UpdateDashboardService
,
:use_clean_rails_memory_store_caching
do
include
MetricsDashboardHelpers
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
describe
'#execute'
do
subject
(
:service_call
)
{
described_class
.
new
(
project
,
user
,
params
).
execute
}
...
...
spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb
View file @
f4736531
# frozen_string_literal: true
RSpec
.
shared_context
'IssuesFinder context'
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:user2
)
{
create
(
:user
)
}
set
(
:group
)
{
create
(
:group
)
}
set
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
set
(
:project1
)
{
create
(
:project
,
group:
group
)
}
set
(
:project2
)
{
create
(
:project
)
}
set
(
:project3
)
{
create
(
:project
,
group:
subgroup
)
}
set
(
:milestone
)
{
create
(
:milestone
,
project:
project1
)
}
set
(
:label
)
{
create
(
:label
,
project:
project2
)
}
set
(
:label2
)
{
create
(
:label
,
project:
project2
)
}
set
(
:issue1
)
{
create
(
:issue
,
author:
user
,
assignees:
[
user
],
project:
project1
,
milestone:
milestone
,
title:
'gitlab'
,
created_at:
1
.
week
.
ago
,
updated_at:
1
.
week
.
ago
)
}
set
(
:issue2
)
{
create
(
:issue
,
author:
user
,
assignees:
[
user
],
project:
project2
,
description:
'gitlab'
,
created_at:
1
.
week
.
from_now
,
updated_at:
1
.
week
.
from_now
)
}
set
(
:issue3
)
{
create
(
:issue
,
author:
user2
,
assignees:
[
user2
],
project:
project2
,
title:
'tanuki'
,
description:
'tanuki'
,
created_at:
2
.
weeks
.
from_now
,
updated_at:
2
.
weeks
.
from_now
)
}
set
(
:issue4
)
{
create
(
:issue
,
project:
project3
)
}
set
(
:award_emoji1
)
{
create
(
:award_emoji
,
name:
'thumbsup'
,
user:
user
,
awardable:
issue1
)
}
set
(
:award_emoji2
)
{
create
(
:award_emoji
,
name:
'thumbsup'
,
user:
user2
,
awardable:
issue2
)
}
set
(
:award_emoji3
)
{
create
(
:award_emoji
,
name:
'thumbsdown'
,
user:
user
,
awardable:
issue3
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user2
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let_it_be
(
:project1
,
reload:
true
)
{
create
(
:project
,
group:
group
)
}
let_it_be
(
:project2
,
reload:
true
)
{
create
(
:project
)
}
let_it_be
(
:project3
,
reload:
true
)
{
create
(
:project
,
group:
subgroup
)
}
let_it_be
(
:milestone
)
{
create
(
:milestone
,
project:
project1
)
}
let_it_be
(
:label
)
{
create
(
:label
,
project:
project2
)
}
let_it_be
(
:label2
)
{
create
(
:label
,
project:
project2
)
}
let_it_be
(
:issue1
,
reload:
true
)
{
create
(
:issue
,
author:
user
,
assignees:
[
user
],
project:
project1
,
milestone:
milestone
,
title:
'gitlab'
,
created_at:
1
.
week
.
ago
,
updated_at:
1
.
week
.
ago
)
}
let_it_be
(
:issue2
,
reload:
true
)
{
create
(
:issue
,
author:
user
,
assignees:
[
user
],
project:
project2
,
description:
'gitlab'
,
created_at:
1
.
week
.
from_now
,
updated_at:
1
.
week
.
from_now
)
}
let_it_be
(
:issue3
,
reload:
true
)
{
create
(
:issue
,
author:
user2
,
assignees:
[
user2
],
project:
project2
,
title:
'tanuki'
,
description:
'tanuki'
,
created_at:
2
.
weeks
.
from_now
,
updated_at:
2
.
weeks
.
from_now
)
}
let_it_be
(
:issue4
,
reload:
true
)
{
create
(
:issue
,
project:
project3
)
}
let_it_be
(
:award_emoji1
)
{
create
(
:award_emoji
,
name:
'thumbsup'
,
user:
user
,
awardable:
issue1
)
}
let_it_be
(
:award_emoji2
)
{
create
(
:award_emoji
,
name:
'thumbsup'
,
user:
user2
,
awardable:
issue2
)
}
let_it_be
(
:award_emoji3
)
{
create
(
:award_emoji
,
name:
'thumbsdown'
,
user:
user
,
awardable:
issue3
)
}
end
RSpec
.
shared_context
'IssuesFinder#execute context'
do
...
...
spec/support/shared_contexts/finders/merge_requests_finder_shared_contexts.rb
View file @
f4736531
...
...
@@ -13,15 +13,14 @@ RSpec.shared_context 'MergeRequestsFinder multiple projects with merge requests
end
end
set
(
:user
)
{
create
(
:user
)
}
set
(
:user2
)
{
create
(
:user
)
}
set
(
:group
)
{
create
(
:group
)
}
set
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
set
(
:project1
)
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user2
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let_it_be
(
:project1
,
reload:
true
)
do
allow_gitaly_n_plus_1
{
create
(
:project
,
:public
,
group:
group
)
}
end
# We cannot use `
set
` here otherwise we get:
# We cannot use `
let_it_be
` here otherwise we get:
# Failure/Error: allow(RepositoryForkWorker).to receive(:perform_async).and_return(true)
# The use of doubles or partial doubles from rspec-mocks outside of the per-test lifecycle is not supported.
let
(
:project2
)
do
...
...
@@ -36,13 +35,13 @@ RSpec.shared_context 'MergeRequestsFinder multiple projects with merge requests
end
end
end
set
(
:project4
)
do
let_it_be
(
:project4
,
reload:
true
)
do
allow_gitaly_n_plus_1
{
create
(
:project
,
:repository
,
group:
subgroup
)
}
end
set
(
:project5
)
do
let_it_be
(
:project5
,
reload:
true
)
do
allow_gitaly_n_plus_1
{
create
(
:project
,
group:
subgroup
)
}
end
set
(
:project6
)
do
let_it_be
(
:project6
,
reload:
true
)
do
allow_gitaly_n_plus_1
{
create
(
:project
,
group:
subgroup
)
}
end
...
...
spec/support/shared_contexts/finders/users_finder_shared_contexts.rb
View file @
f4736531
# frozen_string_literal: true
RSpec
.
shared_context
'UsersFinder#execute filter by project context'
do
set
(
:normal_user
)
{
create
(
:user
,
username:
'johndoe'
)
}
set
(
:blocked_user
)
{
create
(
:user
,
:blocked
,
username:
'notsorandom'
)
}
set
(
:external_user
)
{
create
(
:user
,
:external
)
}
set
(
:omniauth_user
)
{
create
(
:omniauth_user
,
provider:
'twitter'
,
extern_uid:
'123456'
)
}
let_it_be
(
:normal_user
)
{
create
(
:user
,
username:
'johndoe'
)
}
let_it_be
(
:blocked_user
)
{
create
(
:user
,
:blocked
,
username:
'notsorandom'
)
}
let_it_be
(
:external_user
)
{
create
(
:user
,
:external
)
}
let_it_be
(
:omniauth_user
)
{
create
(
:omniauth_user
,
provider:
'twitter'
,
extern_uid:
'123456'
)
}
end
spec/support/shared_contexts/mailers/notify_shared_context.rb
View file @
f4736531
# frozen_string_literal: true
RSpec
.
shared_context
'gitlab email notification'
do
set
(
:group
)
{
create
(
:group
)
}
set
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
set
(
:project
)
{
create
(
:project
,
:repository
,
name:
'a-known-name'
,
group:
group
)
}
set
(
:recipient
)
{
create
(
:user
,
email:
'recipient@example.com'
)
}
let_it_be
(
:group
,
reload:
true
)
{
create
(
:group
)
}
let_it_be
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let_it_be
(
:project
,
reload:
true
)
{
create
(
:project
,
:repository
,
name:
'a-known-name'
,
group:
group
)
}
let_it_be
(
:recipient
,
reload:
true
)
{
create
(
:user
,
email:
'recipient@example.com'
)
}
let
(
:gitlab_sender_display_name
)
{
Gitlab
.
config
.
gitlab
.
email_display_name
}
let
(
:gitlab_sender
)
{
Gitlab
.
config
.
gitlab
.
email_from
}
let
(
:gitlab_sender_reply_to
)
{
Gitlab
.
config
.
gitlab
.
email_reply_to
}
...
...
spec/support/shared_contexts/policies/project_policy_shared_context.rb
View file @
f4736531
# frozen_string_literal: true
RSpec
.
shared_context
'ProjectPolicy context'
do
set
(
:guest
)
{
create
(
:user
)
}
set
(
:reporter
)
{
create
(
:user
)
}
set
(
:developer
)
{
create
(
:user
)
}
set
(
:maintainer
)
{
create
(
:user
)
}
set
(
:owner
)
{
create
(
:user
)
}
set
(
:admin
)
{
create
(
:admin
)
}
let_it_be
(
:guest
)
{
create
(
:user
)
}
let_it_be
(
:reporter
)
{
create
(
:user
)
}
let_it_be
(
:developer
)
{
create
(
:user
)
}
let_it_be
(
:maintainer
)
{
create
(
:user
)
}
let_it_be
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:admin
)
{
create
(
:admin
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
owner
.
namespace
)
}
let
(
:base_guest_permissions
)
do
...
...
spec/support/shared_examples/finders/snippet_visibility_shared_examples.rb
View file @
f4736531
...
...
@@ -8,12 +8,12 @@ RSpec.shared_examples 'snippet visibility' do
DatabaseCleaner
.
clean_with
(
:truncation
)
end
set
(
:author
)
{
create
(
:user
)
}
set
(
:member
)
{
create
(
:user
)
}
set
(
:external
)
{
create
(
:user
,
:external
)
}
set
(
:non_member
)
{
create
(
:user
)
}
let_it_be
(
:author
)
{
create
(
:user
)
}
let_it_be
(
:member
)
{
create
(
:user
)
}
let_it_be
(
:external
)
{
create
(
:user
,
:external
)
}
let_it_be
(
:non_member
)
{
create
(
:user
)
}
set
(
:project
)
do
let_it_be
(
:project
,
reload:
true
)
do
create
(
:project
).
tap
do
|
project
|
project
.
add_developer
(
author
)
project
.
add_developer
(
member
)
...
...
spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb
View file @
f4736531
...
...
@@ -224,7 +224,7 @@ RSpec.shared_examples 'issuable quick actions' do
end
context
'when user can update issuable'
do
set
(
:developer
)
{
create
(
:user
)
}
let_it_be
(
:developer
)
{
create
(
:user
)
}
let
(
:note_author
)
{
developer
}
before
do
...
...
@@ -251,7 +251,7 @@ RSpec.shared_examples 'issuable quick actions' do
end
context
'when user cannot update issuable'
do
set
(
:non_member
)
{
create
(
:user
)
}
let_it_be
(
:non_member
)
{
create
(
:user
)
}
let
(
:note_author
)
{
non_member
}
it
'applies commands that user can execute'
do
...
...
spec/support/shared_examples/requests/api/boards_shared_examples.rb
View file @
f4736531
...
...
@@ -165,7 +165,7 @@ RSpec.shared_examples 'group and project boards' do |route_definition, ee = fals
end
context
"when the user is parent owner"
do
set
(
:owner
)
{
create
(
:user
)
}
let_it_be
(
:owner
,
reload:
true
)
{
create
(
:user
)
}
before
do
if
board_parent
.
try
(
:namespace
)
...
...
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