-
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.
As a Support User, I should be able to see all Claims made by a School
- Loading branch information
Showing
6 changed files
with
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
class Claims::Support::Schools::ClaimsController < Claims::Support::ApplicationController | ||
include Claims::BelongsToSchool | ||
include Claims::Support::ClaimsHelper | ||
|
||
def index | ||
@claims = @school.claims.order("created_at DESC") | ||
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,8 @@ | ||
module Claims::Support::ClaimsHelper | ||
def claim_draft_state(claim) | ||
css_class = claim.draft ? "govuk-tag--grey" : "govuk-tag--blue" | ||
text = claim.draft ? "Draft" : "Submitted" | ||
|
||
"<strong class='govuk-tag #{css_class}'>#{text}</strong>".html_safe | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="govuk-width-container"> | ||
<h1 class="govuk-heading-l"><%= @school.name %></h1> | ||
|
||
<%= render "claims/support/schools/secondary_navigation", school: @school %> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<h2 class="govuk-heading-m"><%= t(".heading") %></h2> | ||
</div> | ||
</div> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ en: | |
claims: | ||
index: | ||
heading: Claims | ||
claim_id: ID |
36 changes: 36 additions & 0 deletions
36
spec/system/claims/support/schools/claims/view_a_schools_claims_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,36 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "View a schools claims", type: :system, service: :claims do | ||
let!(:school) { create(:school, :claims).becomes(Claims::School) } | ||
let!(:colin) { create(:persona, :colin, service: "claims") } | ||
let!(:claim) { create(:claim, school_id: school.id) } | ||
|
||
scenario "View a school's claims as a support user" do | ||
given_i_sign_in_as_colin | ||
when_i_visit_the_claims_support_school_claims_page | ||
i_see_a_list_of_the_schools_claims | ||
end | ||
|
||
private | ||
|
||
def given_i_sign_in_as_colin | ||
and_i_visit_the_personas_page | ||
and_i_click_sign_in_as("Colin") | ||
end | ||
|
||
def and_i_visit_the_personas_page | ||
visit personas_path | ||
end | ||
|
||
def and_i_click_sign_in_as(persona_name) | ||
click_on "Sign In as #{persona_name}" | ||
end | ||
|
||
def when_i_visit_the_claims_support_school_claims_page | ||
visit claims_support_school_claims_path(school) | ||
end | ||
|
||
def i_see_a_list_of_the_schools_claims | ||
expect(page).to have_content("Claims\nID #{claim.id} Submitted") | ||
end | ||
end |