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
2dec5efb
Commit
2dec5efb
authored
Mar 23, 2021
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Freeze time for entire test instead of just the subject
And prevent flakyness
parent
31e966bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/services/namespaces/in_product_marketing_emails_service.rb
...ervices/namespaces/in_product_marketing_emails_service.rb
+2
-1
spec/services/namespaces/in_product_marketing_emails_service_spec.rb
...es/namespaces/in_product_marketing_emails_service_spec.rb
+3
-4
No files found.
app/services/namespaces/in_product_marketing_emails_service.rb
View file @
2dec5efb
...
...
@@ -110,7 +110,8 @@ module Namespaces
end
def
range
(
interval
+
1
).
days
.
ago
.
beginning_of_day
..
(
interval
+
1
).
days
.
ago
.
end_of_day
date
=
(
interval
+
1
).
days
.
ago
date
.
beginning_of_day
..
date
.
end_of_day
end
def
incomplete_action
...
...
spec/services/namespaces/in_product_marketing_emails_service_spec.rb
View file @
2dec5efb
...
...
@@ -3,14 +3,12 @@
require
'spec_helper'
RSpec
.
describe
Namespaces
::
InProductMarketingEmailsService
,
'#execute'
do
subject
(
:execute_service
)
do
travel_to
(
frozen_time
)
{
described_class
.
new
(
track
,
interval
).
execute
}
end
subject
(
:execute_service
)
{
described_class
.
new
(
track
,
interval
).
execute
}
let
(
:track
)
{
:create
}
let
(
:interval
)
{
1
}
let
(
:frozen_time
)
{
Time
.
current
}
let
(
:frozen_time
)
{
Time
.
zone
.
parse
(
'23 Mar 2021 10:14:40 UTC'
)
}
let
(
:previous_action_completed_at
)
{
frozen_time
-
2
.
days
}
let
(
:current_action_completed_at
)
{
nil
}
let
(
:experiment_enabled
)
{
true
}
...
...
@@ -21,6 +19,7 @@ RSpec.describe Namespaces::InProductMarketingEmailsService, '#execute' do
let_it_be
(
:user
)
{
create
(
:user
,
email_opted_in:
true
)
}
before
do
travel_to
(
frozen_time
)
create
(
:onboarding_progress
,
namespace:
group
,
**
actions_completed
)
group
.
add_developer
(
user
)
stub_experiment_for_subject
(
in_product_marketing_emails:
experiment_enabled
)
...
...
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