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
b0b3ce40
Commit
b0b3ce40
authored
Mar 11, 2022
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use stubbed objects in error_tracking_helper spec
parent
3e060e01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
spec/factories/projects.rb
spec/factories/projects.rb
+4
-0
spec/helpers/projects/error_tracking_helper_spec.rb
spec/helpers/projects/error_tracking_helper_spec.rb
+11
-12
No files found.
spec/factories/projects.rb
View file @
b0b3ce40
...
@@ -388,6 +388,10 @@ FactoryBot.define do
...
@@ -388,6 +388,10 @@ FactoryBot.define do
service_desk_enabled
{
true
}
service_desk_enabled
{
true
}
end
end
trait
:with_error_tracking_setting
do
error_tracking_setting
{
association
:project_error_tracking_setting
}
end
# Project with empty repository
# Project with empty repository
#
#
# This is a case when you just created a project
# This is a case when you just created a project
...
...
spec/helpers/projects/error_tracking_helper_spec.rb
View file @
b0b3ce40
...
@@ -5,8 +5,8 @@ require 'spec_helper'
...
@@ -5,8 +5,8 @@ require 'spec_helper'
RSpec
.
describe
Projects
::
ErrorTrackingHelper
do
RSpec
.
describe
Projects
::
ErrorTrackingHelper
do
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
let
_it_be
(
:project
,
reload:
true
)
{
create
(
:project
)
}
let
(
:project
)
{
build_stubbed
(
:project
)
}
let
_it_be
(
:current_user
)
{
create
(
:user
)
}
let
(
:current_user
)
{
build_stubbed
(
:user
)
}
describe
'#error_tracking_data'
do
describe
'#error_tracking_data'
do
let
(
:can_enable_error_tracking
)
{
true
}
let
(
:can_enable_error_tracking
)
{
true
}
...
@@ -41,14 +41,14 @@ RSpec.describe Projects::ErrorTrackingHelper do
...
@@ -41,14 +41,14 @@ RSpec.describe Projects::ErrorTrackingHelper do
end
end
context
'with error_tracking_setting'
do
context
'with error_tracking_setting'
do
let
(
:error_tracking_setting
)
do
let
(
:project
)
{
build_stubbed
(
:project
,
:with_error_tracking_setting
)
}
create
(
:project_error_tracking_setting
,
project:
project
)
before
do
project
.
error_tracking_setting
.
enabled
=
enabled
end
end
context
'when enabled'
do
context
'when enabled'
do
before
do
let
(
:enabled
)
{
true
}
error_tracking_setting
.
update!
(
enabled:
true
)
end
it
'show error tracking enabled'
do
it
'show error tracking enabled'
do
expect
(
helper
.
error_tracking_data
(
current_user
,
project
)).
to
include
(
expect
(
helper
.
error_tracking_data
(
current_user
,
project
)).
to
include
(
...
@@ -58,9 +58,7 @@ RSpec.describe Projects::ErrorTrackingHelper do
...
@@ -58,9 +58,7 @@ RSpec.describe Projects::ErrorTrackingHelper do
end
end
context
'when disabled'
do
context
'when disabled'
do
before
do
let
(
:enabled
)
{
false
}
error_tracking_setting
.
update!
(
enabled:
false
)
end
it
'show error tracking not enabled'
do
it
'show error tracking not enabled'
do
expect
(
helper
.
error_tracking_data
(
current_user
,
project
)).
to
include
(
expect
(
helper
.
error_tracking_data
(
current_user
,
project
)).
to
include
(
...
@@ -86,10 +84,11 @@ RSpec.describe Projects::ErrorTrackingHelper do
...
@@ -86,10 +84,11 @@ RSpec.describe Projects::ErrorTrackingHelper do
with_them
do
with_them
do
before
do
before
do
stub_feature_flags
(
integrated_error_tracking:
feature_flag
)
stub_feature_flags
(
integrated_error_tracking:
feature_flag
)
error_tracking_setting
.
update_columns
(
project
.
error_tracking_setting
.
attributes
=
{
enabled:
enabled
,
enabled:
enabled
,
integrated:
integrated
integrated:
integrated
)
}
end
end
specify
do
specify
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