Commit d69c920a authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '345345-remove-flaky-time_travel-spec-metadata-tag' into 'master'

Remove flaky :time_travel RSpec metadata tag

See merge request gitlab-org/gitlab!74253
parents 0153b060 e7d5e6a2
...@@ -9,8 +9,8 @@ RSpec.describe GitlabSubscription, :saas do ...@@ -9,8 +9,8 @@ RSpec.describe GitlabSubscription, :saas do
let_it_be(plan) { create(plan) } let_it_be(plan) { create(plan) }
end end
describe 'default values', time_travel: 30.days do describe 'default values', :freeze_time do
specify do it 'defaults start_date to the current date' do
expect(subject.start_date).to eq(Date.today) expect(subject.start_date).to eq(Date.today)
end end
end end
......
...@@ -9,14 +9,6 @@ RSpec.configure do |config| ...@@ -9,14 +9,6 @@ RSpec.configure do |config|
freeze_time { example.run } freeze_time { example.run }
end 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| config.around(:example, :time_travel_to) do |example|
date_or_time = example.metadata[:time_travel_to] date_or_time = example.metadata[:time_travel_to]
......
...@@ -9,18 +9,6 @@ RSpec.describe 'time travel' do ...@@ -9,18 +9,6 @@ RSpec.describe 'time travel' do
end end
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 describe ':time_travel_to' do
it 'time-travels to the specified date', time_travel_to: '2020-01-01' 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)) 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