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
Hide 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:
# Offense count: 47
RSpec/ExpectGitlabTracking
:
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/tags_controller_spec.rb'
-
'
spec/controllers/projects/settings/operations_controller_spec.rb'
-
'
spec/controllers/registrations_controller_spec.rb'
-
'
spec/lib/api/helpers_spec.rb'
-
'
spec/requests/api/project_container_repositories_spec.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/packages_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
expect
{
request
}.
to
change
(
merge_request
.
notes
,
:count
).
by
(
1
)
end
it
'tracks a visual review feedback event'
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
it
'tracks a visual review feedback event'
,
:snowplow
do
request
expect_snowplow_event
(
category:
'Notes::CreateService'
,
action:
'execute'
,
label:
'anonymous_visual_review_note'
,
value:
merge_request
.
notes
.
last
.
id
)
end
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
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_note
)
{
create
(
:note
,
noteable:
issue
,
author:
user
,
project:
project
,
note:
"note without mention"
)
}
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
))
subject
.
execute
(
issue
)
expect_snowplow_event
(
category:
'epics'
,
action:
'promote'
,
property:
'issue_id'
,
value:
issue
.
id
)
end
it
'creates a new epic with correct attributes'
do
...
...
@@ -188,9 +189,8 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
end
end
context
'when issue has notes'
do
context
'when issue has notes'
,
:snowplow
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
))
issue
.
reload
end
...
...
@@ -202,6 +202,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
expect
(
epic
.
notes
.
count
).
to
eq
(
issue
.
notes
.
count
)
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_snowplow_event
(
category:
'epics'
,
action:
'promote'
,
property:
'issue_id'
,
value:
issue
.
id
)
end
it
'copies note attachments'
do
...
...
@@ -210,6 +211,7 @@ RSpec.describe Epics::IssuePromoteService, :aggregate_failures do
epic
=
subject
.
execute
(
issue
)
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
...
...
spec/controllers/groups/registry/repositories_controller_spec.rb
View file @
37540943
...
...
@@ -64,12 +64,11 @@ RSpec.describe Groups::Registry::RepositoriesController do
context
'html format'
do
let
(
:format
)
{
:html
}
it
'show index page'
do
expect
(
Gitlab
::
Tracking
).
not_to
receive
(
:event
)
it
'show index page'
,
:snowplow
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect_no_snowplow_event
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,
expect
(
response
).
to
have_gitlab_http_status
(
:unauthorized
)
end
it
'tracks a Notes::CreateService event'
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
it
'tracks a Notes::CreateService event'
,
:snowplow
do
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
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