This repository has been archived by the owner on Feb 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
international_students_component_spec.rb
79 lines (67 loc) · 3.05 KB
/
international_students_component_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require 'rails_helper'
describe Courses::InternationalStudentsComponent, type: :component do
context 'when the course is fee-paying and the provider does not sponsor Student visas' do
before do
course = build(
:course,
funding_type: 'fee',
provider: build(:provider, can_sponsor_student_visa: false),
)
render_inline(described_class.new(course: CourseDecorator.new(course)))
end
it 'tells candidates they’ll need the right to study' do
expect(rendered_component).to have_text('You’ll need the right to study in the UK')
end
it 'tells candidates sponsorship is not available' do
expect(rendered_component).to have_text('Sponsorship is not available for this course')
end
end
context 'when the course is fee-paying and the provider does sponsor Student visas' do
before do
course = build(
:course,
funding_type: 'fee',
provider: build(:provider, can_sponsor_student_visa: true),
)
render_inline(described_class.new(course: CourseDecorator.new(course)))
end
it 'tells candidates they’ll need the right to study' do
expect(rendered_component).to have_text('You’ll need the right to study in the UK')
end
it 'tells candidates visa sponsorship may be available, but they should check' do
expect(rendered_component).to have_text('Before you apply for this course, contact us to check Student visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.')
end
end
context 'when the course is salaried and the provider can sponsor Skilled Worker visas' do
before do
course = build(
:course,
funding_type: 'salary',
provider: build(:provider, can_sponsor_skilled_worker_visa: true),
)
render_inline(described_class.new(course: CourseDecorator.new(course)))
end
it 'tells candidates they’ll need the right to work' do
expect(rendered_component).to have_text('You’ll need the right to work in the UK')
end
it 'tells candidates visa sponsorship may be available, but they should check' do
expect(rendered_component).to have_text('Before you apply for this course, contact us to check Skilled Worker visa sponsorship is available. If it is, and you get a place on this course, we’ll help you apply for your visa.')
end
end
context 'when the course is salaried but the provider cannot sponsor Skilled Worker visas' do
before do
course = build(
:course,
funding_type: 'salary',
provider: build(:provider, can_sponsor_skilled_worker_visa: false),
)
render_inline(described_class.new(course: CourseDecorator.new(course)))
end
it 'tells candidates they’ll need the right to work' do
expect(rendered_component).to have_text('You’ll need the right to work in the UK')
end
it 'tells candidates visa sponsorship is not available' do
expect(rendered_component).to have_text('Sponsorship is not available for this course')
end
end
end