Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luciagirasoles committed Nov 4, 2023
1 parent 2b9f8b0 commit 3acacbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion spec/controllers/api/events_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

# Some of these tests may be time-dependent
# so we mock the time the tests are run
Timecop.freeze(DateTime.new(2022, 3, 30))
travel_to(DateTime.new(2022, 3, 30))
end

after { travel_back }

describe 'GET #past' do
before do
july_meetup = create(:event, title: 'July Meetup', date: DateTime.new(2021, 7, 31, 16).utc)
Expand Down
8 changes: 4 additions & 4 deletions spec/tasks/job_board/digest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
after(:each) { Rake::Task['job_board:digest'].reenable }

context 'when it is Monday' do
before { Timecop.travel(Time.now.last_week(:monday)) }
after { Timecop.return }
before { travel_to(Time.now.last_week(:monday)) }
after { travel_back }

it 'posts job listings to Slack' do
client = stub_slack_client
Expand All @@ -23,8 +23,8 @@
end

context 'when it is not Monday' do
before { Timecop.travel(Time.now.last_week(:tuesday)) }
after { Timecop.return }
before { travel_to(Time.now.last_week(:tuesday)) }
after { travel_back }

it 'does not post job listings to Slack' do
client = stub_slack_client
Expand Down

0 comments on commit 3acacbd

Please sign in to comment.