|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require "rails_helper" |
| 4 | +require "active_support/testing/time_helpers" |
| 5 | + |
| 6 | +RSpec.describe "eligibility_interface/result/ineligible.html.erb", |
| 7 | + type: :view do |
| 8 | + include ActiveSupport::Testing::TimeHelpers |
| 9 | + subject { render } |
| 10 | + |
| 11 | + let(:region) { create(:region) } |
| 12 | + let(:eligibility_check) { create(:eligibility_check) } |
| 13 | + |
| 14 | + before { assign(:eligibility_check, eligibility_check) } |
| 15 | + |
| 16 | + it do |
| 17 | + expect(subject).to match( |
| 18 | + "You’re not eligible to apply for qualified teacher status", |
| 19 | + ) |
| 20 | + end |
| 21 | + |
| 22 | + context "when work experience is under 9 months" do |
| 23 | + let(:eligibility_check) do |
| 24 | + create(:eligibility_check, region:, work_experience: "under_9_months") |
| 25 | + end |
| 26 | + |
| 27 | + it do |
| 28 | + expect(subject).to match( |
| 29 | + "To apply for QTS, you’ll need at least 9 months of teaching work " \ |
| 30 | + "experience. This can be gained in any country but must be from after you qualified as a teacher.", |
| 31 | + ) |
| 32 | + end |
| 33 | + |
| 34 | + context "when the date is before 2025" do |
| 35 | + it do |
| 36 | + travel_to Date.new(2024, 12, 30) do |
| 37 | + expect(subject).to match( |
| 38 | + "If you’re a citizen of Iceland, Norway, or Liechtenstein you can gain " \ |
| 39 | + "more teaching experience during an adaptation period.", |
| 40 | + ) |
| 41 | + end |
| 42 | + end |
| 43 | + end |
| 44 | + |
| 45 | + context "when the date is 2025 or later" do |
| 46 | + it do |
| 47 | + travel_to Date.new(2025, 1, 1) do |
| 48 | + expect(subject).to match( |
| 49 | + "If you’re a citizen of Iceland, Liechtenstein, Norway, or Switzerland " \ |
| 50 | + "you can gain more teaching experience during an adaptation period.", |
| 51 | + ) |
| 52 | + end |
| 53 | + end |
| 54 | + end |
| 55 | + end |
| 56 | +end |
0 commit comments