-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add summary provisional assessment report
- Loading branch information
Showing
8 changed files
with
120 additions
and
7 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,12 @@ | ||
module Reports | ||
class ProvisionalAssessmentsSummary < ProvisionalAssessmentsNew | ||
COLUMNS = %w[ | ||
supplier_name | ||
total | ||
assessed | ||
disallowed | ||
].freeze | ||
|
||
def extended_fields(claim) = [] | ||
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
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
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
78 changes: 78 additions & 0 deletions
78
spec/services/reports/provisional_assessments_summary_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,78 @@ | ||
require 'rails_helper' | ||
require File.expand_path('shared_examples_for_reports.rb', __dir__) | ||
|
||
RSpec.describe Reports::ProvisionalAssessmentsSummary do | ||
subject(:report) { described_class.new } | ||
|
||
describe '::COLUMNS' do | ||
subject { described_class::COLUMNS } | ||
|
||
it { is_expected.to eq( | ||
%w[ | ||
supplier_name | ||
total | ||
assessed | ||
disallowed | ||
] | ||
)} | ||
end | ||
|
||
it_behaves_like 'data for an MI report' | ||
|
||
describe '#call' do | ||
subject(:call) { described_class.call } | ||
|
||
context 'with a single draft claim' do | ||
before { create(:claim, :draft) } | ||
|
||
it { is_expected.to be_empty } | ||
end | ||
|
||
context 'with a single submitted claim' do | ||
before { create(:claim, :submitted) } | ||
|
||
it { is_expected.to be_empty } | ||
end | ||
|
||
context 'with a single allocated claim' do | ||
before { create(:claim, :allocated) } | ||
|
||
it { is_expected.to be_empty } | ||
end | ||
|
||
context 'with a single rejected claim' do | ||
before { create(:claim, :rejected) } | ||
|
||
it { is_expected.to be_empty } | ||
end | ||
|
||
context 'with a single redetermination claim' do | ||
before { create(:claim, :redetermination) } | ||
|
||
it { is_expected.to be_empty } | ||
end | ||
|
||
context 'with a single authorised claim' do | ||
before { create(:claim, :authorised) } | ||
|
||
it { expect(call.length).to eq(1) } | ||
end | ||
|
||
context 'with a single part_authorised claim' do | ||
let!(:claim) do | ||
create( | ||
:claim, :part_authorised, | ||
external_user: | ||
) | ||
end | ||
let(:external_user) { build(:external_user, provider: build(:provider, name: 'Test provider')) } | ||
|
||
it { expect(call.length).to eq(1) } | ||
it { expect(call.first.length).to eq(4) } | ||
it { expect(call.first[0]).to eq('Test provider') } | ||
it { expect(call.first[1]).to eq(claim.total_including_vat) } | ||
it { expect(call.first[2]).to eq(claim.amount_assessed) } | ||
it { expect(call.first[3]).to eq(claim.total_including_vat - claim.amount_assessed) } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
RSpec.shared_examples 'data for an MI report' do | ||
it { expect(described_class::COLUMNS).to be_an(Array) } | ||
it { expect(described_class.call).to be_an(Array) } | ||
it { expect(described_class.new.call).to be_an(Array) } | ||
end |