Commit e7d5e6a2 authored by Dallas Reedy's avatar Dallas Reedy

Remove :time_travel RSpec metadata tag as it results in flaky tests

- Also, while we're at it, let's make the previous `:time_travel`
  use-case test more descriptive about what it is testing
parent 344b5b59
......@@ -9,8 +9,8 @@ RSpec.describe GitlabSubscription, :saas do
let_it_be(plan) { create(plan) }
end
describe 'default values', time_travel: 30.days do
specify do
describe 'default values', :freeze_time do
it 'defaults start_date to the current date' do
expect(subject.start_date).to eq(Date.today)
end
end
......
......@@ -9,14 +9,6 @@ RSpec.configure do |config|
freeze_time { example.run }
end
config.around(:example, :time_travel) do |example|
duration = example.metadata[:time_travel]
raise 'The time_travel RSpec metadata must have an ActiveSupport::Duration value (such as `30.days`).' unless duration.is_a?(ActiveSupport::Duration)
travel(duration) { example.run }
end
config.around(:example, :time_travel_to) do |example|
date_or_time = example.metadata[:time_travel_to]
......
......@@ -9,18 +9,6 @@ RSpec.describe 'time travel' do
end
end
describe ':time_travel' do
today = Date.current
it 'time-travels by the given duration', time_travel: 3.days do
expect(Date.current).to eq(today + 3.days)
end
it 'works with negative durations', time_travel: -5.days do
expect(Date.current).to eq(today - 5.days)
end
end
describe ':time_travel_to' do
it 'time-travels to the specified date', time_travel_to: '2020-01-01' do
expect(Date.current).to eq(Date.new(2020, 1, 1))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment