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
37540943
Commit
37540943
authored
Oct 23, 2020
by
Nicolas Dular
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use snowplow test helper
This changes more specs to use the snowplow spec helper.
parent
798f5542
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
29 deletions
+19
-29
.rubocop_todo.yml
.rubocop_todo.yml
+0
-6
ee/spec/requests/api/visual_review_discussions_spec.rb
ee/spec/requests/api/visual_review_discussions_spec.rb
+8
-8
ee/spec/services/epics/issue_promote_service_spec.rb
ee/spec/services/epics/issue_promote_service_spec.rb
+6
-4
spec/controllers/groups/registry/repositories_controller_spec.rb
...ntrollers/groups/registry/repositories_controller_spec.rb
+2
-3
spec/support/shared_examples/requests/api/discussions_shared_examples.rb
...ared_examples/requests/api/discussions_shared_examples.rb
+3
-8
No files found.
.rubocop_todo.yml
View file @
37540943
...
@@ -186,18 +186,12 @@ RSpec/ExpectChange:
...
@@ -186,18 +186,12 @@ RSpec/ExpectChange:
# Offense count: 47
# Offense count: 47
RSpec/ExpectGitlabTracking
:
RSpec/ExpectGitlabTracking
:
Exclude
:
Exclude
:
-
'
ee/spec/controllers/projects/settings/operations_controller_spec.rb'
-
'
ee/spec/requests/api/visual_review_discussions_spec.rb'
-
'
ee/spec/services/epics/issue_promote_service_spec.rb'
-
'
spec/controllers/groups/registry/repositories_controller_spec.rb'
-
'
spec/controllers/projects/registry/repositories_controller_spec.rb'
-
'
spec/controllers/projects/registry/repositories_controller_spec.rb'
-
'
spec/controllers/projects/registry/tags_controller_spec.rb'
-
'
spec/controllers/projects/registry/tags_controller_spec.rb'
-
'
spec/controllers/projects/settings/operations_controller_spec.rb'
-
'
spec/controllers/projects/settings/operations_controller_spec.rb'
-
'
spec/controllers/registrations_controller_spec.rb'
-
'
spec/lib/api/helpers_spec.rb'
-
'
spec/lib/api/helpers_spec.rb'
-
'
spec/requests/api/project_container_repositories_spec.rb'
-
'
spec/requests/api/project_container_repositories_spec.rb'
-
'
spec/support/shared_examples/controllers/trackable_shared_examples.rb'
-
'
spec/support/shared_examples/controllers/trackable_shared_examples.rb'
-
'
spec/support/shared_examples/requests/api/container_repositories_shared_examples.rb'
-
'
spec/support/shared_examples/requests/api/discussions_shared_examples.rb'
-
'
spec/support/shared_examples/requests/api/discussions_shared_examples.rb'
-
'
spec/support/shared_examples/requests/api/packages_shared_examples.rb'
-
'
spec/support/shared_examples/requests/api/packages_shared_examples.rb'
-
'
spec/support/shared_examples/requests/api/tracking_shared_examples.rb'
-
'
spec/support/shared_examples/requests/api/tracking_shared_examples.rb'
...
...
ee/spec/requests/api/visual_review_discussions_spec.rb
View file @
37540943
...
@@ -42,15 +42,15 @@ RSpec.describe API::VisualReviewDiscussions do
...
@@ -42,15 +42,15 @@ RSpec.describe API::VisualReviewDiscussions do
expect
{
request
}.
to
change
(
merge_request
.
notes
,
:count
).
by
(
1
)
expect
{
request
}.
to
change
(
merge_request
.
notes
,
:count
).
by
(
1
)
end
end
it
'tracks a visual review feedback event'
do
it
'tracks a visual review feedback event'
,
:snowplow
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
do
|
category
,
action
,
data
|
expect
(
category
).
to
eq
(
'Notes::CreateService'
)
expect
(
action
).
to
eq
(
'execute'
)
expect
(
data
[
:label
]).
to
eq
(
'anonymous_visual_review_note'
)
expect
(
data
[
:value
]).
to
be_an
(
Integer
)
end
request
request
expect_snowplow_event
(
category:
'Notes::CreateService'
,
action:
'execute'
,
label:
'anonymous_visual_review_note'
,
value:
merge_request
.
notes
.
last
.
id
)
end
end
context
'with notes_create_service_tracking feature flag disabled'
do
context
'with notes_create_service_tracking feature flag disabled'
do
...
...
ee/spec/services/epics/issue_promote_service_spec.rb
View file @
37540943
...
@@ -57,15 +57,16 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
...
@@ -57,15 +57,16 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
end
end
end
end
context
'when promoting issue'
do
context
'when promoting issue'
,
:snowplow
do
let!
(
:issue_mentionable_note
)
{
create
(
:note
,
noteable:
issue
,
author:
user
,
project:
project
,
note:
"note with mention
#{
user
.
to_reference
}
"
)
}
let!
(
:issue_mentionable_note
)
{
create
(
:note
,
noteable:
issue
,
author:
user
,
project:
project
,
note:
"note with mention
#{
user
.
to_reference
}
"
)
}
let!
(
:issue_note
)
{
create
(
:note
,
noteable:
issue
,
author:
user
,
project:
project
,
note:
"note without mention"
)
}
let!
(
:issue_note
)
{
create
(
:note
,
noteable:
issue
,
author:
user
,
project:
project
,
note:
"note without mention"
)
}
before
do
before
do
allow
(
Gitlab
::
Tracking
).
to
receive
(
:event
).
with
(
'epics'
,
'promote'
,
an_instance_of
(
Hash
))
allow
(
ProductAnalytics
::
Tracker
).
to
receive
(
:event
).
with
(
'epics'
,
'promote'
,
an_instance_of
(
Hash
))
allow
(
ProductAnalytics
::
Tracker
).
to
receive
(
:event
).
with
(
'epics'
,
'promote'
,
an_instance_of
(
Hash
))
subject
.
execute
(
issue
)
subject
.
execute
(
issue
)
expect_snowplow_event
(
category:
'epics'
,
action:
'promote'
,
property:
'issue_id'
,
value:
issue
.
id
)
end
end
it
'creates a new epic with correct attributes'
do
it
'creates a new epic with correct attributes'
do
...
@@ -188,9 +189,8 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
...
@@ -188,9 +189,8 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
end
end
end
end
context
'when issue has notes'
do
context
'when issue has notes'
,
:snowplow
do
before
do
before
do
allow
(
Gitlab
::
Tracking
).
to
receive
(
:event
).
with
(
'epics'
,
'promote'
,
an_instance_of
(
Hash
))
allow
(
ProductAnalytics
::
Tracker
).
to
receive
(
:event
).
with
(
'epics'
,
'promote'
,
an_instance_of
(
Hash
))
allow
(
ProductAnalytics
::
Tracker
).
to
receive
(
:event
).
with
(
'epics'
,
'promote'
,
an_instance_of
(
Hash
))
issue
.
reload
issue
.
reload
end
end
...
@@ -202,6 +202,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
...
@@ -202,6 +202,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
expect
(
epic
.
notes
.
count
).
to
eq
(
issue
.
notes
.
count
)
expect
(
epic
.
notes
.
count
).
to
eq
(
issue
.
notes
.
count
)
expect
(
epic
.
notes
.
where
(
discussion_id:
discussion
.
discussion_id
).
count
).
to
eq
(
0
)
expect
(
epic
.
notes
.
where
(
discussion_id:
discussion
.
discussion_id
).
count
).
to
eq
(
0
)
expect
(
issue
.
notes
.
where
(
discussion_id:
discussion
.
discussion_id
).
count
).
to
eq
(
1
)
expect
(
issue
.
notes
.
where
(
discussion_id:
discussion
.
discussion_id
).
count
).
to
eq
(
1
)
expect_snowplow_event
(
category:
'epics'
,
action:
'promote'
,
property:
'issue_id'
,
value:
issue
.
id
)
end
end
it
'copies note attachments'
do
it
'copies note attachments'
do
...
@@ -210,6 +211,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
...
@@ -210,6 +211,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
epic
=
subject
.
execute
(
issue
)
epic
=
subject
.
execute
(
issue
)
expect
(
epic
.
notes
.
user
.
first
.
attachment
).
to
be_kind_of
(
AttachmentUploader
)
expect
(
epic
.
notes
.
user
.
first
.
attachment
).
to
be_kind_of
(
AttachmentUploader
)
expect_snowplow_event
(
category:
'epics'
,
action:
'promote'
,
property:
'issue_id'
,
value:
issue
.
id
)
end
end
end
end
...
...
spec/controllers/groups/registry/repositories_controller_spec.rb
View file @
37540943
...
@@ -64,12 +64,11 @@ RSpec.describe Groups::Registry::RepositoriesController do
...
@@ -64,12 +64,11 @@ RSpec.describe Groups::Registry::RepositoriesController do
context
'html format'
do
context
'html format'
do
let
(
:format
)
{
:html
}
let
(
:format
)
{
:html
}
it
'show index page'
do
it
'show index page'
,
:snowplow
do
expect
(
Gitlab
::
Tracking
).
not_to
receive
(
:event
)
subject
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect_no_snowplow_event
end
end
end
end
...
...
spec/support/shared_examples/requests/api/discussions_shared_examples.rb
View file @
37540943
...
@@ -117,15 +117,10 @@ RSpec.shared_examples 'discussions API' do |parent_type, noteable_type, id_name,
...
@@ -117,15 +117,10 @@ RSpec.shared_examples 'discussions API' do |parent_type, noteable_type, id_name,
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
end
it
'tracks a Notes::CreateService event'
do
it
'tracks a Notes::CreateService event'
,
:snowplow
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
do
|
category
,
action
,
data
|
expect
(
category
).
to
eq
(
'Notes::CreateService'
)
expect
(
action
).
to
eq
(
'execute'
)
expect
(
data
[
:label
]).
to
eq
(
'note'
)
expect
(
data
[
:value
]).
to
be_an
(
Integer
)
end
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/discussions"
,
user
),
params:
{
body:
'hi!'
}
post
api
(
"/
#{
parent_type
}
/
#{
parent
.
id
}
/
#{
noteable_type
}
/
#{
noteable
[
id_name
]
}
/discussions"
,
user
),
params:
{
body:
'hi!'
}
expect_snowplow_event
(
category:
'Notes::CreateService'
,
action:
'execute'
,
label:
'note'
,
value:
anything
)
end
end
context
'with notes_create_service_tracking feature flag disabled'
do
context
'with notes_create_service_tracking feature flag disabled'
do
...
...
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