diff --git a/test_app/spec/models/customer_spec.rb b/test_app/spec/models/customer_spec.rb index ca41843..35c42ee 100644 --- a/test_app/spec/models/customer_spec.rb +++ b/test_app/spec/models/customer_spec.rb @@ -45,5 +45,13 @@ expect(customer.vip).to eq(true) end + it 'travel_to' do + travel_to Time.zone.local(2004, 11, 23, 01, 04, 44) do + @customer = create(:customer_vip) + end + + expect(@customer.created_at).to be < Time.now + end + it { expect{ create(:customer) }.to change{Customer.all.size}.by(1) } end diff --git a/test_app/spec/rails_helper.rb b/test_app/spec/rails_helper.rb index bd84774..9e6d41e 100644 --- a/test_app/spec/rails_helper.rb +++ b/test_app/spec/rails_helper.rb @@ -28,6 +28,9 @@ RSpec.configure do |config| + # Time Helper + config.include ActiveSupport::Testing::TimeHelpers + # FactoryBot config.include FactoryBot::Syntax::Methods