-
Notifications
You must be signed in to change notification settings - Fork 4
/
shared_process_setup_context.rb
59 lines (55 loc) · 1.36 KB
/
shared_process_setup_context.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
RSpec.shared_context 'with a process request setup' do
def sanitize_to_id(value)
value.to_s.gsub(/\s/, "_").gsub(/[^-\w]/, "").downcase
end
def choose_date
within '.choose-date' do
find("label[for='visit_slot_granted_#{sanitize_to_id(vst.slots.first.iso8601)}']").click
end
end
let(:contact_email_address) { 'visitor@test.example.com' }
let(:prison_email_address) { 'prison@test.example.com' }
let(:prison) {
create(
:prison,
name: 'Leeds',
email_address: prison_email_address,
estate: create(:estate, nomis_id: 'LEI')
)
}
let(:vst) {
create(
:visit,
prison:,
contact_email_address:,
prisoner: create(
:prisoner,
number: prisoner_number,
first_name: 'Oscar',
last_name: 'Wilde',
date_of_birth: Date.parse(prisoner_dob)
)
)
}
let(:prisoner_number) { 'G7244GR' }
let(:prisoner_dob) { '1966-11-22' }
let(:sso_response) do
{
'uid' => '1234-1234-1234-1234',
'provider' => 'hmpps_sso',
'info' => {
'first_name' => 'Joe',
'last_name' => 'Goldman',
'user_id' => 485_926,
'organisations' => [
vst.prison.estate.nomis_id
],
'roles' => [],
}
}
end
before do
OmniAuth.config.add_mock(:hmpps_sso, sso_response)
visit prison_inbox_path
end
end