-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a PerSuicideAndSelfHarm event with details attributes
- Loading branch information
1 parent
ba188eb
commit 6108316
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class GenericEvent | ||
class PerSuicideAndSelfHarm < GenericEvent | ||
details_attributes :concerns, | ||
:history, | ||
:sash_methods, | ||
:source_type, | ||
:source_summary, | ||
:source_observations, | ||
:safety_actions, | ||
:observation_level, | ||
:observation_level_comment, | ||
:comments, | ||
:reporting_officer, | ||
:reporting_officer_signed_at, | ||
:reception_officer, | ||
:reception_officer_signed_at | ||
|
||
eventable_types 'PersonEscortRecord' | ||
|
||
def event_classification | ||
:suicide_and_self_harm | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
spec/models/generic_event/per_suicide_and_self_harm_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe GenericEvent::PerSuicideAndSelfHarm do | ||
let(:per_suicide_and_self_harm_event) { build(:event_per_suicide_and_self_harm) } | ||
|
||
it_behaves_like 'an event with details', :concerns, :history, :sash_methods, :source_type, :source_summary, :source_observations, | ||
:safety_actions, :observation_level, :observation_level_comment, :comments, :reporting_officer, | ||
:reporting_officer_signed_at, :reception_officer, :reception_officer_signed_at | ||
|
||
it_behaves_like 'an event with eventable types', 'PersonEscortRecord' | ||
|
||
describe '#event_classification' do | ||
subject(:event_classification) { per_suicide_and_self_harm_event.event_classification } | ||
|
||
it { is_expected.to eq(:suicide_and_self_harm) } | ||
end | ||
end |