|
|
|
@ -18,15 +18,16 @@ RSpec.describe Organisation, type: :model do
|
|
|
|
|
let!(:owned_case_log) do |
|
|
|
|
FactoryBot.create( |
|
|
|
|
:case_log, |
|
|
|
|
:completed, |
|
|
|
|
owning_organisation: organisation, |
|
|
|
|
managing_organisation: other_organisation |
|
|
|
|
managing_organisation: other_organisation, |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
let!(:managed_case_log) do |
|
|
|
|
FactoryBot.create( |
|
|
|
|
:case_log, |
|
|
|
|
owning_organisation: other_organisation, |
|
|
|
|
managing_organisation: organisation |
|
|
|
|
managing_organisation: organisation, |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -37,6 +38,15 @@ RSpec.describe Organisation, type: :model do
|
|
|
|
|
it "has managed case logs" do |
|
|
|
|
expect(organisation.managed_case_logs.first).to eq(managed_case_log) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has case logs" do |
|
|
|
|
expect(organisation.case_logs.to_a).to eq([owned_case_log, managed_case_log]) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has case log status helper methods" do |
|
|
|
|
expect(organisation.completed_case_logs.to_a).to eq([owned_case_log]) |
|
|
|
|
expect(organisation.not_completed_case_logs.to_a).to eq([managed_case_log]) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|