diff --git a/app/controllers/attempts_controller.rb b/app/controllers/attempts_controller.rb index 88301d34..8f0ed808 100644 --- a/app/controllers/attempts_controller.rb +++ b/app/controllers/attempts_controller.rb @@ -17,7 +17,9 @@ class AttemptsController < ApplicationController responded_at: Time.new, twilio_details: twilio_params.to_h.to_yaml ) - render plain: "We've registered your response of #{attempt.response}. To see how others responded to the same question please visit" + render plain: """We've registered your response of #{attempt.response}. +To see how others responded to the same question please visit +#{school_category_url(attempt.recipient.school, attempt.question.category)}""" end # # GET /attempts/1/edit diff --git a/spec/controllers/attempts_controller_spec.rb b/spec/controllers/attempts_controller_spec.rb index fde322c4..76e91880 100644 --- a/spec/controllers/attempts_controller_spec.rb +++ b/spec/controllers/attempts_controller_spec.rb @@ -6,7 +6,7 @@ RSpec.describe AttemptsController, type: :controller do let(:schedule) { Schedule.new } let(:school) { School.create!(name: 'School') } - let(:recipient) { Recipient.create!(name: 'Recipient', phone: '+11231231234') } + let(:recipient) { school.recipients.create!(name: 'Recipient', phone: '+11231231234') } let(:recipient_schedule) { RecipientSchedule.new } let(:category) { Category.create!(name: 'Category') } let(:question) { create_questions(1, category).first } @@ -48,7 +48,9 @@ RSpec.describe AttemptsController, type: :controller do it "sends back a message" do post :twilio, params: twilio_attributes - expect(response.body).to eq('Thank you!') + expect(response.body).to eq """We\'ve registered your response of Option 0:1 C. +To see how others responded to the same question please visit +http://test.host/schools/school/categories/category""" end end