-
Notifications
You must be signed in to change notification settings - Fork 1
/
activity_spec.rb
45 lines (41 loc) · 1.46 KB
/
activity_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
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Activity do
describe '#build_from_nomis' do
subject(:activity) { described_class.new }
let(:nomis_scheduled_event) do
{
'bookingId' => 771_697,
'eventClass' => 'INT_MOV',
'eventId' => 401_732_488,
'eventStatus' => 'SCH',
'eventType' => 'PRISON_ACT',
'eventTypeDesc' => 'Prison Activities',
'eventSubType' => 'PA',
'eventSubTypeDesc' => 'Prison Activities',
'eventDate' => '2020-04-22',
'startTime' => '2020-04-22T08:30:00',
'endTime' => '2020-04-22T11:45:00',
'eventLocation' => 'CONTRACTS',
'eventLocationId' => 76_748,
'eventSource' => 'PA',
'eventSourceCode' => 'CCONT1',
'eventSourceDesc' => 'CAT C CONTRACTS 1',
'paid' => false,
'payRate' => 0.5,
'locationCode' => 'CNCTS',
}
end
let(:expected_attributes) do
{
id: nomis_scheduled_event['eventId'],
start_time: Time.parse(nomis_scheduled_event['startTime']), # rubocop:disable Rails/TimeZone
type: 'Prison Activities',
reason: nomis_scheduled_event['eventTypeDesc'],
agency_id: nomis_scheduled_event['locationCode'],
}
end
it { expect(activity.build_from_nomis(nomis_scheduled_event)).to be_a(described_class) }
it { expect(activity.build_from_nomis(nomis_scheduled_event)).to have_attributes(expected_attributes) }
end
end