-
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.
- Loading branch information
1 parent
f412a27
commit 27ec46b
Showing
21 changed files
with
256 additions
and
14 deletions.
There are no files selected for viewing
16 changes: 15 additions & 1 deletion
16
app/controllers/claims/support/claims/claim_activities_controller.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 |
---|---|---|
@@ -1,3 +1,17 @@ | ||
class Claims::Support::Claims::ClaimActivitiesController < Claims::Support::ApplicationController | ||
before_action :skip_authorization | ||
def index | ||
@pagy, @claim_activities = pagy(Claims::ClaimActivity.order(created_at: :desc)) | ||
|
||
authorize [:claims, @claim_activities] | ||
end | ||
|
||
def show | ||
@claim_activity = Claims::ClaimActivity.find(params[:id]) | ||
|
||
if @claim_activity.sampling_uploaded? | ||
@pagy, @provider_samplings = pagy(@claim_activity.record.provider_samplings.order_by_provider_name) | ||
end | ||
|
||
authorize [:claims, @claim_activity] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class Claims::Support::Claims::ClaimActivityPolicy < Claims::ApplicationPolicy | ||
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
28 changes: 28 additions & 0 deletions
28
app/views/claims/support/claims/claim_activities/show.html.erb
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,28 @@ | ||
<%= content_for :page_title, Claims::ClaimActivity.human_attribute_name("action.#{@claim_activity.action}") %> | ||
<%= render "claims/support/primary_navigation", current: :claims %> | ||
|
||
<% content_for(:before_content) do %> | ||
<%= govuk_back_link href: claims_support_claims_claim_activities_path %> | ||
<% end %> | ||
|
||
<div class="govuk-width-container"> | ||
<p class="govuk-caption-l"><%= t(".page_caption") %></p> | ||
<h1 class="govuk-heading-l"><%= Claims::ClaimActivity.human_attribute_name("action.#{@claim_activity.action}") %></h1> | ||
|
||
<p class="govuk-body"><%= t(".byline", user: @claim_activity.user_full_name, time: l(@claim_activity.created_at, format: :date_at_time)) %></p> | ||
|
||
<h2 class="govuk-heading-m"><%= t(".files") %></h2> | ||
|
||
<%= govuk_list type: :bullet do %> | ||
<% case @claim_activity.action %> | ||
<% when "payment_request_delivered", "clawback_request_delivered" %> | ||
<li><%= govuk_link_to "Claims sent to ESFA", @claim_activity.record.csv_file %></li> | ||
<% when "sampling_uploaded" %> | ||
<% @provider_samplings.each do |provider_sampling| %> | ||
<li><%= govuk_link_to provider_sampling.provider.name, provider_sampling.csv_file %></li> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= render PaginationComponent.new(pagy: @pagy) if @pagy %> | ||
</div> |
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
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
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,2 @@ | ||
claim_reference,school_urn,school_name,claim_status | ||
12345678,1234567,Example School,paid |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
FactoryBot::SyntaxRunner.class_eval do | ||
include RSpec::Rails::FileFixtureSupport | ||
end | ||
|
||
RSpec.configure { |config| config.include FactoryBot::Syntax::Methods } |
58 changes: 58 additions & 0 deletions
58
spec/system/claims/support/claims/view_a_claims_activity_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,58 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "View a claims activity", service: :claims, type: :system do | ||
let(:support_user) { create(:claims_support_user, first_name: "Colin", last_name: "Chapman") } | ||
let(:created_at) { Time.zone.parse("20 December 2024 16:00") } | ||
|
||
let(:payment_request_delivered) { create(:claim_activity, :payment_request_delivered, user: support_user, created_at:) } | ||
let(:sampling_uploaded) { create(:claim_activity, :sampling_uploaded, user: support_user, created_at: created_at + 1.day) } | ||
|
||
scenario "Support user visits a 'payment_request_delivered' activity" do | ||
given_i_sign_in_as(support_user) | ||
and_there_are_claim_activities(payment_request_delivered) | ||
when_i_visit_the_claims_activity_by_url(payment_request_delivered) | ||
then_i_can_see_the_claims_activity_payment_request_delivered_details | ||
end | ||
|
||
scenario "Support user views a 'sampling_uploaded' activity" do | ||
given_i_sign_in_as(support_user) | ||
and_there_are_claim_activities(sampling_uploaded) | ||
when_i_visit_the_claims_activity_log | ||
and_i_click_on_view_all_files_of_a_claim_activity | ||
then_i_can_see_the_claims_activity_sampling_uploaded_details | ||
end | ||
|
||
private | ||
|
||
def given_i_sign_in | ||
visit sign_in_path | ||
click_on "Sign in using DfE Sign In" | ||
end | ||
|
||
def and_there_are_claim_activities(*activities) | ||
[*activities] | ||
end | ||
|
||
def when_i_visit_the_claims_activity_by_url(activity) | ||
visit claims_support_claims_claim_activity_path(activity) | ||
end | ||
|
||
def when_i_visit_the_claims_activity_log | ||
click_on "Claims" | ||
click_on "Activity log" | ||
end | ||
|
||
def and_i_click_on_view_all_files_of_a_claim_activity | ||
click_on "View all files" | ||
end | ||
|
||
def then_i_can_see_the_claims_activity_payment_request_delivered_details | ||
expect(page).to have_css("h1.govuk-heading-l", text: "Claims sent to ESFA") | ||
expect(page).to have_content("Colin Chapman on 20 December 2024 at 4:00pm") | ||
end | ||
|
||
def then_i_can_see_the_claims_activity_sampling_uploaded_details | ||
expect(page).to have_css("h1.govuk-heading-l", text: "Sampling data uploaded") | ||
expect(page).to have_content("Colin Chapman on 21 December 2024 at 4:00pm") | ||
end | ||
end |
44 changes: 44 additions & 0 deletions
44
spec/system/claims/support/claims/view_claims_activity_log_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,44 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "View claims activity log", service: :claims, type: :system do | ||
let(:support_user) { create(:claims_support_user, first_name: "Colin", last_name: "Chapman") } | ||
let(:created_at) { Time.zone.parse("20 December 2024 16:00") } | ||
|
||
let(:payment_request_delivered) { create(:claim_activity, :payment_request_delivered, user: support_user, created_at:) } | ||
let(:sampling_uploaded) { create(:claim_activity, :sampling_uploaded, user: support_user, created_at: created_at + 1.day) } | ||
|
||
scenario "Support user views the claims activity log" do | ||
given_i_sign_in_as(support_user) | ||
given_there_are_claim_activities | ||
when_i_visit_the_claims_activity_log | ||
then_i_can_see_the_claims_activities | ||
end | ||
|
||
private | ||
|
||
def given_i_sign_in | ||
visit sign_in_path | ||
click_on "Sign in using DfE Sign In" | ||
end | ||
|
||
def given_there_are_claim_activities | ||
[payment_request_delivered, sampling_uploaded] | ||
end | ||
|
||
def when_i_visit_the_claims_activity_log | ||
click_on "Claims" | ||
click_on "Activity log" | ||
end | ||
|
||
def then_i_can_see_the_claims_activities | ||
within(".app-timeline__item:nth-child(1)") do | ||
expect(page).to have_content("Sampling data uploaded") | ||
expect(page).to have_content("Colin Chapman on 21 December 2024 at 4:00pm") | ||
end | ||
|
||
within(".app-timeline__item:nth-child(2)") do | ||
expect(page).to have_content("Claims sent to ESFA for payment") | ||
expect(page).to have_content("Colin Chapman on 20 December 2024 at 4:00pm") | ||
end | ||
end | ||
end |