fixing tests

pull/1/head
Jared Cosulich 9 years ago
parent 061a3b9fde
commit affc5aae53

@ -124,8 +124,10 @@ describe "survey:attempt_questions" do
before :each do
recipients[1].update_attributes(opted_out: true)
Timecop.freeze
subject.invoke
now = DateTime.now
date = ActiveSupport::TimeZone["America/New_York"].parse(now.strftime("%Y-%m-%dT20:00:00%z"))
Timecop.freeze(date) { subject.invoke }
end
it 'should create the first attempt for each recipient' do

@ -38,6 +38,12 @@ RSpec.describe RecipientSchedule, type: :model do
end
describe 'ready' do
before :each do
now = DateTime.now
date = ActiveSupport::TimeZone["America/New_York"].parse(now.strftime("%Y-%m-%dT16:00:00%z"))
Timecop.freeze(date)
end
subject { schedule.recipient_schedules.ready }
it ('should only provide recipient_schedules who are ready to send a message') do
@ -96,7 +102,11 @@ RSpec.describe RecipientSchedule, type: :model do
end
it 'should update next_attempt_at' do
expect(recipient_schedule.next_attempt_at.to_i).to eq(Date.today.to_time.to_i + (960 * 60))
now = DateTime.now
date = ActiveSupport::TimeZone["America/New_York"].parse(now.strftime("%Y-%m-%dT16:00:00%z"))
time = date.to_time.to_i + (60 * 60 * 24 * 7)
expect(recipient_schedule.next_attempt_at.to_i).to eq(time)
end
end
end

Loading…
Cancel
Save