working on siblings

This commit is contained in:
Jared Cosulich 2017-04-19 09:23:41 -04:00
parent 720b59d815
commit 2e796899f8
4 changed files with 21 additions and 16 deletions

View file

@ -92,13 +92,13 @@ RSpec.describe Attempt, type: :model do
end
it 'should contact the Twilio API' do
expect(FakeSMS.messages.length).to eq(2)
expect(FakeSMS.messages.first.to).to eq('111111111')
expect(FakeSMS.messages.first.body).to eq("Question 0:1")
expect(FakeSMS.messages.length).to eq(1)
# expect(FakeSMS.messages.first.to).to eq('111111111')
# expect(FakeSMS.messages.first.body).to eq("Question 0:1")
expect(FakeSMS.messages.last.to).to eq('111111111')
expect(FakeSMS.messages.last.body).to eq("Option 0:1 A: Reply 1\n\rOption 0:1 B: Reply 2\n\rOption 0:1 C: Reply 3\n\rOption 0:1 D: Reply 4\n\rOption 0:1 E: Reply 5\n\rReply 'stop' to stop these messages.")
expect(FakeSMS.messages.last.body).to eq("Question 0:1\r\nOption 0:1 A: Reply 1\n\rOption 0:1 B: Reply 2\n\rOption 0:1 C: Reply 3\n\rOption 0:1 D: Reply 4\n\rOption 0:1 E: Reply 5\n\rReply 'stop' to stop these messages.")
end
it 'should update sent_at' do

View file

@ -24,7 +24,7 @@ RSpec.describe RecipientSchedule, type: :model do
frequency_hours: 24
)
end
let!(:recipient_schedule) { schedule.recipient_schedules.for(recipient).first }
let!(:recipient_schedule) { schedule.recipient_schedules.for_recipient(recipient).first }
let!(:not_ready_recipient_schedule) do
RecipientSchedule.create!(
@ -121,7 +121,7 @@ RSpec.describe RecipientSchedule, type: :model do
date += 1.day
date += 1.day if date.on_weekend?
expect(recipient_schedule.next_attempt_at).to eq(date.to_time)
expect(recipient_schedule.reload.next_attempt_at).to eq(date.to_time)
end
end
end