mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
Updated to rails 6. Passing tests
This commit is contained in:
parent
3430069801
commit
770ebc580e
20 changed files with 33 additions and 34 deletions
|
|
@ -48,7 +48,7 @@ RSpec.describe Attempt, type: :model do
|
|||
|
||||
describe 'after_update' do
|
||||
before :each do
|
||||
attempt.update_attributes(answer_index: 4)
|
||||
attempt.update(answer_index: 4)
|
||||
end
|
||||
|
||||
xit 'updates associated school_categories' do
|
||||
|
|
@ -73,13 +73,13 @@ RSpec.describe Attempt, type: :model do
|
|||
end
|
||||
|
||||
it 'are updated when an attempt is responded to' do
|
||||
attempt.update_attributes(answer_index: 2)
|
||||
attempt.update(answer_index: 2)
|
||||
expect(recipient.attempts_count).to eq(1)
|
||||
expect(recipient.responses_count).to eq(1)
|
||||
end
|
||||
|
||||
it 'are updated when an attempt is responded to with an open-ended response' do
|
||||
attempt.update_attributes(open_response_id: 1)
|
||||
attempt.update(open_response_id: 1)
|
||||
expect(recipient.attempts_count).to eq(1)
|
||||
expect(recipient.responses_count).to eq(1)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ describe RecipientList do
|
|||
it 'should delete recipient_schedules if a recipient is removed' do
|
||||
modified_recipient_ids = recipients.map(&:id)[0,2].join(',')
|
||||
expect do
|
||||
recipient_list.update_attributes(recipient_ids: modified_recipient_ids)
|
||||
recipient_list.update(recipient_ids: modified_recipient_ids)
|
||||
end.to change { schedule.recipient_schedules.count }.from(3).to(2)
|
||||
end
|
||||
|
||||
it 'should create recipient_schedules if a recipient is added' do
|
||||
new_recipients = create_recipients(school, 2)
|
||||
expect do
|
||||
recipient_list.update_attributes(recipient_ids: (recipients + new_recipients).map(&:id).join(','))
|
||||
recipient_list.update(recipient_ids: (recipients + new_recipients).map(&:id).join(','))
|
||||
end.to change { schedule.recipient_schedules.count }.from(3).to(5)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ RSpec.describe RecipientSchedule, type: :model do
|
|||
|
||||
describe 'with an opted out recipient' do
|
||||
before :each do
|
||||
recipient_schedule.recipient.update_attributes(opted_out: true)
|
||||
recipient_schedule.recipient.update(opted_out: true)
|
||||
end
|
||||
|
||||
let!(:attempt) { recipient_schedule.attempt_question }
|
||||
|
|
@ -79,7 +79,7 @@ RSpec.describe RecipientSchedule, type: :model do
|
|||
before :each do
|
||||
friday_time = ActiveSupport::TimeZone["UTC"].parse('2017-04-21T20:00:00')
|
||||
Timecop.freeze()
|
||||
recipient_schedule.update_attributes(next_attempt_at: friday_time)
|
||||
recipient_schedule.update(next_attempt_at: friday_time)
|
||||
end
|
||||
|
||||
let!(:attempt) { recipient_schedule.attempt_question }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue