Don't monkey patch ActiveSupport.
It could have side effects (for example, a conflict after upgrading to Rails 5). Thanks @aitbw for the suggestion!
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
require 'rails_helper'
|
||||
require 'time_helper'
|
||||
|
||||
feature 'Officing Results' do
|
||||
|
||||
background do
|
||||
freeze_time
|
||||
travel_to Time.now # TODO: use `freeze_time` after migrating to Rails 5.
|
||||
@poll_officer = create(:poll_officer)
|
||||
@officer_assignment = create(:poll_officer_assignment, :final, officer: @poll_officer)
|
||||
@poll = @officer_assignment.booth_assignment.poll
|
||||
|
||||
@@ -18,6 +18,7 @@ RSpec.configure do |config|
|
||||
config.include(EmailSpec::Helpers)
|
||||
config.include(EmailSpec::Matchers)
|
||||
config.include(CommonActions)
|
||||
config.include(ActiveSupport::Testing::TimeHelpers)
|
||||
config.before(:suite) do
|
||||
DatabaseCleaner.clean_with :truncation
|
||||
end
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
module ActiveSupport::Testing::TimeHelpers
|
||||
# Copied from Rails 5.2. TODO: remove after migrating to Rails 5.
|
||||
def freeze_time(&block)
|
||||
travel_to Time.now, &block
|
||||
end
|
||||
end
|
||||
|
||||
include ActiveSupport::Testing::TimeHelpers
|
||||
Reference in New Issue
Block a user