|
53 | 53 | expect(mail.govuk_notify_personalisation[:title]).to eq(form.name) |
54 | 54 | end |
55 | 55 |
|
| 56 | + context "when no Welsh form is provided" do |
| 57 | + it "falls back to the English title for title_cy" do |
| 58 | + expect(mail.govuk_notify_personalisation[:title_cy]).to eq(form.name) |
| 59 | + end |
| 60 | + end |
| 61 | + |
| 62 | + context "when a Welsh form is provided" do |
| 63 | + let(:welsh_form) { Form.new(build(:v2_form_document, name: "Ffurflen 1")) } |
| 64 | + |
| 65 | + it "uses the Welsh form name as title_cy" do |
| 66 | + expect(mail.govuk_notify_personalisation[:title_cy]).to eq("Ffurflen 1") |
| 67 | + end |
| 68 | + end |
| 69 | + |
56 | 70 | it "includes the forms what happens next" do |
57 | 71 | expect(mail.govuk_notify_personalisation[:what_happens_next_text]).to eq("Please wait for a response") |
58 | 72 | end |
|
104 | 118 | it "sets the payment_link" do |
105 | 119 | expect(mail.govuk_notify_personalisation[:payment_link]).to eq("#{payment_url}?reference=#{submission_reference}") |
106 | 120 | end |
| 121 | + |
| 122 | + it "sets payment_link_cy to an empty string when no Welsh form is provided" do |
| 123 | + expect(mail.govuk_notify_personalisation[:payment_link_cy]).to eq("") |
| 124 | + end |
| 125 | + |
| 126 | + context "when the Welsh form has a payment url" do |
| 127 | + let(:welsh_payment_url) { "https://www.gov.uk/payments/welsh-service/pay-for-licence" } |
| 128 | + let(:welsh_form) { Form.new(build(:v2_form_document, payment_url: welsh_payment_url)) } |
| 129 | + |
| 130 | + it "sets payment_link_cy to the Welsh payment url with reference" do |
| 131 | + expect(mail.govuk_notify_personalisation[:payment_link_cy]).to eq("#{welsh_payment_url}?reference=#{submission_reference}") |
| 132 | + end |
| 133 | + end |
107 | 134 | end |
108 | 135 |
|
109 | 136 | context "when a payment url is not set" do |
|
116 | 143 | it "sets the payment link personalisation to an empty string" do |
117 | 144 | expect(mail.govuk_notify_personalisation[:payment_link]).to eq("") |
118 | 145 | end |
| 146 | + |
| 147 | + it "sets the Welsh payment link personalisation to an empty string" do |
| 148 | + expect(mail.govuk_notify_personalisation[:payment_link_cy]).to eq("") |
| 149 | + end |
119 | 150 | end |
120 | 151 |
|
121 | 152 | context "when submission_locale is :en" do |
|
0 commit comments