Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2061 lines
77 KiB

Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
require "rails_helper"
RSpec.describe SchemesController, type: :request do
let(:organisation) { user.organisation }
let(:headers) { { "Accept" => "text/html" } }
let(:page) { Capybara::Node::Simple.new(response.body) }
let(:user) { FactoryBot.create(:user, :support) }
let!(:schemes) { FactoryBot.create_list(:scheme, 5) }
before do
schemes.each do |scheme|
FactoryBot.create(:location, scheme:)
end
end
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
describe "#index" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider user" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator user" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
before do
schemes.each do |scheme|
scheme.update!(owning_organisation: user.organisation)
end
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
sign_in user
get "/schemes"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "redirects to the organisation schemes path" do
follow_redirect!
expect(path).to match("/organisations/#{user.organisation.id}/schemes")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "shows a list of schemes for the organisation" do
follow_redirect!
schemes.each do |scheme|
expect(page).to have_content(scheme.id_to_display)
end
end
context "when parent organisation has schemes" do
let(:parent_organisation) { FactoryBot.create(:organisation) }
let!(:parent_schemes) { FactoryBot.create_list(:scheme, 5, owning_organisation: parent_organisation) }
before do
create(:organisation_relationship, parent_organisation:, child_organisation: user.organisation)
parent_schemes.each do |scheme|
FactoryBot.create(:location, scheme:)
end
get "/schemes"
end
it "shows parent organisation schemes" do
follow_redirect!
parent_schemes.each do |scheme|
expect(page).to have_content(scheme.id_to_display)
end
end
end
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
context "when signed in as a support user" do
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "has page heading" do
expect(page).to have_content("Schemes")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "shows all schemes" do
schemes.each do |scheme|
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(scheme.id_to_display)
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
end
it "shows incomplete tag if the scheme is not confirmed" do
schemes[0].update!(confirmed: nil)
get "/schemes"
assert_select ".govuk-tag", text: /Incomplete/, count: 1
end
it "shows incomplete schemes at the top" do
schemes[0].update!(confirmed: nil)
schemes[2].update!(confirmed: false)
schemes[4].update!(confirmed: false)
get "/schemes"
expect(page.all(".govuk-tag")[1].text).to eq("Incomplete")
expect(page.all(".govuk-tag")[2].text).to eq("Incomplete")
expect(page.all(".govuk-tag")[3].text).to eq("Incomplete")
end
it "displays a link to check answers page if the scheme is incomplete" do
scheme = schemes[0]
scheme.update!(confirmed: nil)
get "/schemes"
expect(page).to have_link(nil, href: /schemes\/#{scheme.id}\/check-answers/)
end
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
it "shows a search bar" do
expect(page).to have_field("search", type: "search")
end
it "has correct title" do
expect(page).to have_title("Supported housing schemes - Submit social housing lettings and sales data (CORE) - GOV.UK")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "shows the total organisations count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{schemes.count}</strong> total schemes")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
context "when paginating over 20 results" do
let(:total_schemes_count) { Scheme.count }
before do
FactoryBot.create_list(:scheme, 20)
end
context "when on the first page" do
before do
get "/schemes"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "shows the total schemes count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{total_schemes_count}</strong> total schemes")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "shows which schemes are being shown on the current page" do
expect(CGI.unescape_html(response.body)).to match("Showing <b>1</b> to <b>20</b> of <b>#{total_schemes_count}</b> schemes")
end
it "has correct page 1 of 2 title" do
expect(page).to have_title("Supported housing schemes (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "has pagination links" do
expect(page).not_to have_content("Previous")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
expect(page).not_to have_link("Previous")
expect(page).to have_content("Next")
expect(page).to have_link("Next")
end
end
context "when on the second page" do
before do
get "/schemes?page=2"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "shows the total schemes count" do
expect(CGI.unescape_html(response.body)).to match("<strong>#{total_schemes_count}</strong> total schemes")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "has pagination links" do
expect(page).to have_content("Previous")
expect(page).to have_link("Previous")
expect(page).not_to have_content("Next")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
expect(page).not_to have_link("Next")
end
it "shows which schemes are being shown on the current page" do
expect(CGI.unescape_html(response.body)).to match("Showing <b>21</b> to <b>25</b> of <b>#{total_schemes_count}</b> schemes")
end
it "has correct page 1 of 2 title" do
expect(page).to have_title("Supported housing schemes (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
end
end
context "when searching" do
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let!(:searched_scheme) { FactoryBot.create(:scheme) }
let(:search_param) { searched_scheme.id_to_display }
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
before do
FactoryBot.create(:location, scheme: searched_scheme)
get "/schemes?search=#{search_param}"
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
it "returns matching results" do
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(searched_scheme.id_to_display)
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
schemes.each do |scheme|
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).not_to have_content(scheme.id_to_display)
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
end
it "returns results with no location" do
scheme_without_location = FactoryBot.create(:scheme)
get "/schemes?search=#{scheme_without_location.id}"
expect(page).to have_content(scheme_without_location.id_to_display)
schemes.each do |scheme|
expect(page).not_to have_content(scheme.id_to_display)
end
end
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
it "updates the table caption" do
expect(page).to have_content("1 scheme found matching ‘#{search_param}")
end
it "has search in the title" do
expect(page).to have_title("Supported housing schemes (1 scheme matching ‘#{search_param}’) - Submit social housing lettings and sales data (CORE) - GOV.UK")
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end
end
end
end
describe "#show" do
let(:specific_scheme) { schemes.first }
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/#{specific_scheme.id}"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider user" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/#{specific_scheme.id}"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator user" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:specific_scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) }
before do
sign_in user
end
it "has page heading" do
get "/schemes/#{specific_scheme.id}"
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(specific_scheme.id_to_display)
expect(page).to have_content(specific_scheme.service_name)
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(specific_scheme.sensitive)
expect(page).to have_content(specific_scheme.scheme_type)
expect(page).to have_content(specific_scheme.registered_under_care_act)
expect(page).to have_content(specific_scheme.primary_client_group)
expect(page).to have_content(specific_scheme.secondary_client_group)
expect(page).to have_content(specific_scheme.support_type)
expect(page).to have_content(specific_scheme.intended_stay)
end
context "when coordinator attempts to see scheme belonging to a different organisation" do
let!(:specific_scheme) { FactoryBot.create(:scheme) }
it "returns 404 not found" do
get "/schemes/#{specific_scheme.id}"
expect(response).to have_http_status(:not_found)
end
end
context "when the requested scheme does not exist" do
it "returns not found" do
get "/schemes/#{Scheme.maximum(:id) + 1}"
expect(response).to have_http_status(:not_found)
end
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
context "when looking at scheme details" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) }
let(:add_deactivations) { scheme.scheme_deactivation_periods << scheme_deactivation_period }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
before do
FactoryBot.create(:location, scheme:)
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
Timecop.freeze(Time.utc(2022, 10, 10))
sign_in user
add_deactivations
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
scheme.save!
get "/schemes/#{scheme.id}"
end
after do
Timecop.unfreeze
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
context "with active scheme" do
let(:add_deactivations) {}
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "renders deactivate this scheme" do
expect(response).to have_http_status(:ok)
expect(page).to have_link("Deactivate this scheme", href: "/schemes/#{scheme.id}/new-deactivation")
end
end
context "with deactivated scheme" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:scheme_deactivation_period) { FactoryBot.create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 10, 9), scheme:) }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "renders reactivate this scheme" do
expect(response).to have_http_status(:ok)
expect(page).to have_link("Reactivate this scheme", href: "/schemes/#{scheme.id}/new-reactivation")
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "with scheme that's deactivating soon" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:scheme_deactivation_period) { FactoryBot.create(:scheme_deactivation_period, deactivation_date: Time.zone.local(2022, 10, 12), scheme:) }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "does not render toggle scheme link" do
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
expect(response).to have_http_status(:ok)
expect(page).not_to have_link("Reactivate this scheme")
expect(page).not_to have_link("Deactivate this scheme")
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
end
context "when coordinator attempts to see scheme belonging to a parent organisation" do
let(:parent_organisation) { FactoryBot.create(:organisation) }
let!(:specific_scheme) { FactoryBot.create(:scheme, owning_organisation: parent_organisation) }
before do
FactoryBot.create(:location, scheme: specific_scheme)
create(:organisation_relationship, parent_organisation:, child_organisation: user.organisation)
get "/schemes/#{specific_scheme.id}"
end
it "shows the scheme" do
expect(page).to have_content(specific_scheme.id_to_display)
end
it "does not allow editing the scheme" do
expect(page).not_to have_link("Change")
expect(page).not_to have_content("Reactivate this scheme")
expect(page).not_to have_content("Deactivate this scheme")
end
end
end
context "when signed in as a support user" do
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{specific_scheme.id}"
end
it "has page heading" do
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(specific_scheme.id_to_display)
expect(page).to have_content(specific_scheme.service_name)
expect(page).to have_content(specific_scheme.owning_organisation.name)
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(specific_scheme.sensitive)
expect(page).to have_content(specific_scheme.id_to_display)
expect(page).to have_content(specific_scheme.service_name)
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(page).to have_content(specific_scheme.sensitive)
expect(page).to have_content(specific_scheme.scheme_type)
expect(page).to have_content(specific_scheme.registered_under_care_act)
expect(page).to have_content(specific_scheme.primary_client_group)
expect(page).to have_content(specific_scheme.secondary_client_group)
expect(page).to have_content(specific_scheme.support_type)
expect(page).to have_content(specific_scheme.intended_stay)
end
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
describe "#new" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/new"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/new"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
before do
sign_in user
get "/schemes/new"
end
it "returns a template for a new scheme" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Create a new supported housing scheme")
end
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/new"
end
it "returns a template for a new scheme" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Create a new supported housing scheme")
end
end
end
describe "#create" do
context "when not signed in" do
it "redirects to the sign in page" do
post "/schemes"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
post "/schemes"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let(:params) do
{ scheme: { service_name: " testy ",
sensitive: "1",
scheme_type: "Foyer",
registered_under_care_act: "No",
arrangement_type: "D" } }
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
sign_in user
end
it "creates a new scheme for user organisation with valid params and renders correct page" do
expect { post "/schemes", params: }.to change(Scheme, :count).by(1)
follow_redirect!
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(response).to have_http_status(:ok)
expect(page).to have_content("What client group is this scheme intended for?")
end
it "creates a new scheme for user organisation with valid params" do
post "/schemes", params: params
expect(Scheme.last.owning_organisation_id).to eq(user.organisation_id)
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(Scheme.last.service_name).to eq("testy")
expect(Scheme.last.scheme_type).to eq("Foyer")
expect(Scheme.last.sensitive).to eq("Yes")
expect(Scheme.last.registered_under_care_act).to eq("No")
expect(Scheme.last.id).not_to eq(nil)
expect(Scheme.last.has_other_client_group).to eq(nil)
expect(Scheme.last.primary_client_group).to eq(nil)
expect(Scheme.last.secondary_client_group).to eq(nil)
expect(Scheme.last.support_type).to eq(nil)
expect(Scheme.last.intended_stay).to eq(nil)
expect(Scheme.last.id_to_display).to match(/S*/)
end
context "when support services provider is selected" do
let(:params) do
{ scheme: { service_name: "testy",
sensitive: "1",
scheme_type: "Foyer",
registered_under_care_act: "No",
arrangement_type: "R" } }
end
it "creates a new scheme for user organisation with valid params and renders correct page" do
expect { post "/schemes", params: }.to change(Scheme, :count).by(1)
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content(" What client group is this scheme intended for?")
end
it "creates a new scheme for user organisation with valid params" do
post "/schemes", params: params
expect(Scheme.last.owning_organisation_id).to eq(user.organisation_id)
expect(Scheme.last.service_name).to eq("testy")
expect(Scheme.last.scheme_type).to eq("Foyer")
expect(Scheme.last.sensitive).to eq("Yes")
expect(Scheme.last.registered_under_care_act).to eq("No")
expect(Scheme.last.id).not_to eq(nil)
expect(Scheme.last.has_other_client_group).to eq(nil)
expect(Scheme.last.primary_client_group).to eq(nil)
expect(Scheme.last.secondary_client_group).to eq(nil)
expect(Scheme.last.support_type).to eq(nil)
expect(Scheme.last.intended_stay).to eq(nil)
expect(Scheme.last.id_to_display).to match(/S*/)
end
end
context "when required params are missing" do
let(:params) do
{ scheme: { service_name: "",
scheme_type: "",
registered_under_care_act: "",
arrangement_type: "" } }
end
it "renders the same page with error message" do
post "/schemes", params: params
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.registered_under_care_act.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.service_name.invalid"))
end
end
context "when the organisation id param is included" do
let(:organisation) { FactoryBot.create(:organisation) }
let(:params) { { scheme: { owning_organisation: organisation } } }
it "sets the owning organisation correctly" do
post "/schemes", params: params
expect(Scheme.last.owning_organisation_id).to eq(user.organisation_id)
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when signed in as a support user" do
let(:organisation) { FactoryBot.create(:organisation) }
let(:user) { FactoryBot.create(:user, :support) }
let(:params) do
{ scheme: { service_name: "testy",
sensitive: "1",
scheme_type: "Foyer",
registered_under_care_act: "No",
owning_organisation_id: organisation.id,
arrangement_type: "D" } }
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
end
it "creates a new scheme for user organisation with valid params and renders correct page" do
expect { post "/schemes", params: }.to change(Scheme, :count).by(1)
follow_redirect!
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(response).to have_http_status(:ok)
expect(page).to have_content("What client group is this scheme intended for?")
end
it "creates a new scheme for user organisation with valid params" do
post "/schemes", params: params
expect(Scheme.last.owning_organisation_id).to eq(organisation.id)
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
expect(Scheme.last.service_name).to eq("testy")
expect(Scheme.last.scheme_type).to eq("Foyer")
expect(Scheme.last.sensitive).to eq("Yes")
expect(Scheme.last.registered_under_care_act).to eq("No")
expect(Scheme.last.id).not_to eq(nil)
expect(Scheme.last.has_other_client_group).to eq(nil)
expect(Scheme.last.primary_client_group).to eq(nil)
expect(Scheme.last.secondary_client_group).to eq(nil)
expect(Scheme.last.support_type).to eq(nil)
expect(Scheme.last.intended_stay).to eq(nil)
expect(Scheme.last.id_to_display).to match(/S*/)
end
context "when support services provider is selected" do
let(:params) do
{ scheme: { service_name: "testy",
sensitive: "1",
scheme_type: "Foyer",
registered_under_care_act: "No",
owning_organisation_id: organisation.id,
support_services_provider_before_type_cast: "1" } }
end
it "creates a new scheme for user organisation with valid params and renders correct page" do
expect { post "/schemes", params: }.to change(Scheme, :count).by(1)
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What client group is this scheme intended for?")
end
it "creates a new scheme for user organisation with valid params" do
post "/schemes", params: params
expect(Scheme.last.owning_organisation_id).to eq(organisation.id)
expect(Scheme.last.service_name).to eq("testy")
expect(Scheme.last.scheme_type).to eq("Foyer")
expect(Scheme.last.sensitive).to eq("Yes")
expect(Scheme.last.registered_under_care_act).to eq("No")
expect(Scheme.last.id).not_to eq(nil)
expect(Scheme.last.has_other_client_group).to eq(nil)
expect(Scheme.last.primary_client_group).to eq(nil)
expect(Scheme.last.secondary_client_group).to eq(nil)
expect(Scheme.last.support_type).to eq(nil)
expect(Scheme.last.intended_stay).to eq(nil)
expect(Scheme.last.id_to_display).to match(/S*/)
end
end
context "when required params are missing" do
let(:params) do
{ scheme: { service_name: "",
scheme_type: "",
registered_under_care_act: "",
owning_organisation_id: nil,
arrangement_type: "" } }
end
it "renders the same page with error message" do
post "/schemes", params: params
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.registered_under_care_act.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.service_name.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.owning_organisation_id.invalid"))
end
end
context "when organisation id param refers to a non-stock-owning organisation" do
let(:organisation_which_does_not_own_stock) { FactoryBot.create(:organisation, holds_own_stock: false) }
let(:params) { { scheme: { owning_organisation_id: organisation_which_does_not_own_stock.id } } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "displays the new page with an error message" do
post "/schemes", params: params
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content("Enter an organisation that owns housing stock")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
end
end
describe "#update" do
context "when not signed in" do
it "redirects to the sign in page" do
patch "/schemes/#{schemes.first.id}"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
patch "/schemes/#{schemes.first.id}"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let(:scheme_to_update) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
sign_in user
patch "/schemes/#{scheme_to_update.id}", params:
end
context "when confirming unfinished scheme" do
let(:params) { { scheme: { owning_organisation_id: user.organisation.id, arrangement_type: nil, confirmed: true, page: "check-answers" } } }
it "does not allow the scheme to be confirmed" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
end
end
CLDC-2140 Scheme and location updates (#1455) * feat: update scheme status so incomplete unless has active locations * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: change active -> completed * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: change to confirmed to add clarification in code * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: update scheme typeahead text * feat: reject incomplete locations * feat: only confirm locations if complete (old) AND save button clicked (new) * feat: add unconfirmed scope * refactor: complete -> confirm * feat: fix tests * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: update scheme typeahead text * feat: reject incomplete locations * feat: only confirm locations if complete (old) AND save button clicked (new) * feat: add unconfirmed scope * refactor: complete -> confirm * feat: fix tests * feat: fix more tests * feat: fix more tests * refactor: rubocop * refactor: rubocop * refactor: rubocop * feat: add tests for incomplete schemes * refactor: linting * feat: test incomplete count too * feat: test unconfirmed locations aren't options in location_id * feat: test validation * feat: test when scheme is confirmed * feat: test when scheme is confirmed for support user * feat: test when location is confirmed * refactor: linting * refactor: consistent use of factorybot or not within a file * feat: confirm locations when complete even if save button not clicked, and update tests * refactor: simplify * refactor: simplify * refactor: move location helper methods to helpers * refactor: move scheme helper methods to helpers * refactor: formatting * refactor: po response * refactor: review response
2 years ago
context "when scheme is completed but not yet confirmed" do
let(:params) { { scheme: { page: "check-answers" } } }
it "is not confirmed" do
expect(scheme_to_update.confirmed).to eq(nil)
end
context "when confirming finished scheme" do
let(:params) { { scheme: { confirmed: true, page: "check-answers" } } }
before do
scheme_to_update.reload
end
it "confirms scheme" do
expect(scheme_to_update.confirmed).to eq(true)
end
end
end
context "when required params are missing" do
let(:params) do
{ scheme: {
service_name: "",
primary_client_group: "",
secondary_client_group: "",
scheme_type: "",
registered_under_care_act: "",
support_type: "",
intended_stay: "",
arrangement_type: "",
has_other_client_group: "",
page: "details",
} }
end
it "renders the same page with error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.service_name.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.registered_under_care_act.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.primary_client_group.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.secondary_client_group.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.support_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.intended_stay.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.has_other_client_group.invalid"))
end
context "when updating from check answers page" do
let(:params) { { scheme: { primary_client_group: "Homeless families with support needs", page: "primary-client-group", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Check your changes before creating this scheme")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.primary_client_group).to eq("Homeless families with support needs")
end
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
context "when updating primary client group" do
let(:params) { { scheme: { primary_client_group: "Homeless families with support needs", page: "primary-client-group" } } }
it "renders confirm secondary group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Does this scheme provide for another client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.primary_client_group).to eq("Homeless families with support needs")
end
context "when updating from check answers page" do
let(:params) { { scheme: { primary_client_group: "Homeless families with support needs", page: "primary-client-group", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.primary_client_group).to eq("Homeless families with support needs")
end
end
end
context "when updating confirm secondary client group" do
let(:params) { { scheme: { has_other_client_group: "Yes", page: "confirm-secondary" } } }
it "renders secondary client group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("Yes")
end
context "when updating from check answers page with the answer YES" do
let(:params) { { scheme: { has_other_client_group: "Yes", page: "confirm-secondary", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("Yes")
end
end
context "when updating from check answers page with the answer NO" do
let(:params) { { scheme: { has_other_client_group: "No", page: "confirm-secondary", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("No")
end
end
end
context "when updating secondary client group" do
let(:params) { { scheme: { secondary_client_group: "Homeless families with support needs", page: "secondary-client-group" } } }
it "renders confirm support page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What support does this scheme provide?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.secondary_client_group).to eq("Homeless families with support needs")
end
context "when updating from check answers page" do
let(:params) { { scheme: { secondary_client_group: "Homeless families with support needs", page: "secondary-client-group", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.secondary_client_group).to eq("Homeless families with support needs")
end
end
end
context "when updating support" do
let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support" } } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
Cldc 1669 add location redesign (#1034) * feat: wip postcode page * feat: wip add new flow * feat: add check answers page, continue updating flow * feat: add back behaviour * feat: more flow work * feat: further flow work and flash notice, name tidying * feat: add check_answers referrer linking * feat: add controller and details linking and lint * refactor: erblinting * feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates * feat: add validations to controller (could later be added to model) * fix: correct date order * feat: validate on model (except startdate) * feat: copy update * refactor: railsification * feat: add date model validation * feat: add updated availability text in check_answers * feat: more updated dynamic text and linking * refactor: erblinting * refactor: cleanup of redundant code * refactor: remove redundant create * feat: use rails route * test: wip tests * test: wip tests * feat: add new back behaviour for new scheme path and tests wip * feat: add more back behaviour for new scheme path and fix local auth validation * feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes * feat: if location with no details added, route to normal path rather than check answers * test: update model and helper location tests * test: more test updates * test: more test updates and remove redundant files * test: remove redundant tests, add postcode test * test: add new #new tests * test: add test for all new controller methods * test: add more startdate tests * refactor: erblinting * test: fix failing tests * test: update scheme test * feat: respond to PR comments * feat: make postcode clear only if changed * feat: add _update methods * refactor: simplify validation and location_edit_path method * refactor: add helper method for action text * refactor: remove redundant logic * refactor: simplify routing * refactor: reintroduce location_params * refactor: use presence validation for postcode * refactor: use presence validation for la * feat: validate confirmed * tests: make tests pass with new startdate validation * WIP * refactor: simplify display attributes helpers and update tests * refactor: linting * feat: design change to save behaviour * test: fix failing tests * feat: location code copy tweak * refactor: remove redundant function * refactor: remove add_another_location and new location page * feat: simplify startdate validations to move to model, use scheme available_from date for in range validation * test: fix failing tests * refactor: linting * feat: remove name validation as a result of PO review * test: update tests * refactor: remove redundant context Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "renders the check answers page" do
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
follow_redirect!
expect(response).to have_http_status(:ok)
Cldc 1669 add location redesign (#1034) * feat: wip postcode page * feat: wip add new flow * feat: add check answers page, continue updating flow * feat: add back behaviour * feat: more flow work * feat: further flow work and flash notice, name tidying * feat: add check_answers referrer linking * feat: add controller and details linking and lint * refactor: erblinting * feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates * feat: add validations to controller (could later be added to model) * fix: correct date order * feat: validate on model (except startdate) * feat: copy update * refactor: railsification * feat: add date model validation * feat: add updated availability text in check_answers * feat: more updated dynamic text and linking * refactor: erblinting * refactor: cleanup of redundant code * refactor: remove redundant create * feat: use rails route * test: wip tests * test: wip tests * feat: add new back behaviour for new scheme path and tests wip * feat: add more back behaviour for new scheme path and fix local auth validation * feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes * feat: if location with no details added, route to normal path rather than check answers * test: update model and helper location tests * test: more test updates * test: more test updates and remove redundant files * test: remove redundant tests, add postcode test * test: add new #new tests * test: add test for all new controller methods * test: add more startdate tests * refactor: erblinting * test: fix failing tests * test: update scheme test * feat: respond to PR comments * feat: make postcode clear only if changed * feat: add _update methods * refactor: simplify validation and location_edit_path method * refactor: add helper method for action text * refactor: remove redundant logic * refactor: simplify routing * refactor: reintroduce location_params * refactor: use presence validation for postcode * refactor: use presence validation for la * feat: validate confirmed * tests: make tests pass with new startdate validation * WIP * refactor: simplify display attributes helpers and update tests * refactor: linting * feat: design change to save behaviour * test: fix failing tests * feat: location code copy tweak * refactor: remove redundant function * refactor: remove add_another_location and new location page * feat: simplify startdate validations to move to model, use scheme available_from date for in range validation * test: fix failing tests * refactor: linting * feat: remove name validation as a result of PO review * test: update tests * refactor: remove redundant context Co-authored-by: James Rose <james@jbpr.net>
2 years ago
expect(page).to have_content("Check your answers before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.intended_stay).to eq("Medium stay")
expect(scheme_to_update.reload.support_type).to eq("Low level")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when updating from check answers page" do
let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support", check_answers: "true" } } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.intended_stay).to eq("Medium stay")
expect(scheme_to_update.reload.support_type).to eq("Low level")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
end
context "when updating details" do
let(:params) do
{ scheme: { service_name: "testy",
sensitive: "1",
scheme_type: "Foyer",
registered_under_care_act: "No",
page: "details",
owning_organisation_id: organisation.id,
arrangement_type: "D" } }
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "renders confirm secondary group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What client group is this scheme intended for?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.service_name).to eq("testy")
expect(scheme_to_update.reload.scheme_type).to eq("Foyer")
expect(scheme_to_update.reload.sensitive).to eq("Yes")
expect(scheme_to_update.reload.registered_under_care_act).to eq("No")
end
context "when updating from check answers page" do
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
let(:params) { { scheme: { service_name: "testy", sensitive: "1", scheme_type: "Foyer", registered_under_care_act: "No", page: "details", check_answers: "true" } } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.service_name).to eq("testy")
expect(scheme_to_update.reload.scheme_type).to eq("Foyer")
expect(scheme_to_update.reload.sensitive).to eq("Yes")
expect(scheme_to_update.reload.registered_under_care_act).to eq("No")
end
end
end
context "when editing scheme name details" do
let(:params) { { scheme: { service_name: "testy", sensitive: "1", page: "edit-name" } } }
it "renders scheme show page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content(scheme_to_update.reload.service_name)
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.service_name).to eq("testy")
expect(scheme_to_update.reload.sensitive).to eq("Yes")
end
end
context "when the requested scheme does not exist" do
let(:scheme_to_update) { OpenStruct.new(id: Scheme.maximum(:id) + 1) }
let(:params) { {} }
it "returns not found" do
expect(response).to have_http_status(:not_found)
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when signed in as a support user" do
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let(:user) { FactoryBot.create(:user, :support) }
let(:scheme_to_update) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
FactoryBot.create(:location, scheme: scheme_to_update)
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
patch "/schemes/#{scheme_to_update.id}", params:
end
CLDC-2140 Scheme and location updates (#1455) * feat: update scheme status so incomplete unless has active locations * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: change active -> completed * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: change to confirmed to add clarification in code * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: update scheme typeahead text * feat: reject incomplete locations * feat: only confirm locations if complete (old) AND save button clicked (new) * feat: add unconfirmed scope * refactor: complete -> confirm * feat: fix tests * feat: update scheme typeahead text * feat: reject incomplete locations * feat: show completed/incomplete locations and validate when completed == 0 * feat: improve copy * feat: update scheme typeahead text * feat: reject incomplete locations * feat: only confirm locations if complete (old) AND save button clicked (new) * feat: add unconfirmed scope * refactor: complete -> confirm * feat: fix tests * feat: fix more tests * feat: fix more tests * refactor: rubocop * refactor: rubocop * refactor: rubocop * feat: add tests for incomplete schemes * refactor: linting * feat: test incomplete count too * feat: test unconfirmed locations aren't options in location_id * feat: test validation * feat: test when scheme is confirmed * feat: test when scheme is confirmed for support user * feat: test when location is confirmed * refactor: linting * refactor: consistent use of factorybot or not within a file * feat: confirm locations when complete even if save button not clicked, and update tests * refactor: simplify * refactor: simplify * refactor: move location helper methods to helpers * refactor: move scheme helper methods to helpers * refactor: formatting * refactor: po response * refactor: review response
2 years ago
context "when confirming unfinished scheme" do
let(:params) { { scheme: { owning_organisation_id: user.organisation.id, arrangement_type: nil, confirmed: true, page: "check-answers" } } }
it "does not allow the scheme to be confirmed" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
end
end
context "when scheme is completed but not yet confirmed" do
let(:params) { { scheme: { page: "check-answers" } } }
it "is not confirmed" do
expect(scheme_to_update.confirmed).to eq(nil)
end
context "when confirming finished scheme" do
let(:params) { { scheme: { confirmed: true, page: "check-answers" } } }
before do
scheme_to_update.reload
end
it "confirms scheme" do
expect(scheme_to_update.confirmed).to eq(true)
end
end
end
context "when required params are missing" do
let(:params) do
{ scheme: {
service_name: "",
managing_organisation_id: "",
owning_organisation_id: "",
primary_client_group: "",
secondary_client_group: "",
scheme_type: "",
registered_under_care_act: "",
support_type: "",
intended_stay: "",
arrangement_type: "",
has_other_client_group: "",
page: "details",
} }
end
it "renders the same page with error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content("Create a new supported housing scheme")
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.owning_organisation_id.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.service_name.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.scheme_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.registered_under_care_act.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.primary_client_group.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.secondary_client_group.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.support_type.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.intended_stay.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.has_other_client_group.invalid"))
expect(page).to have_content(I18n.t("activerecord.errors.models.scheme.attributes.arrangement_type.invalid"))
end
context "when updating from check answers page" do
let(:params) { { scheme: { primary_client_group: "Homeless families with support needs", page: "primary-client-group", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Check your changes before creating this scheme")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.primary_client_group).to eq("Homeless families with support needs")
end
end
context "when saving a scheme" do
let(:params) { { scheme: { page: "check-answers", confirmed: "true" } } }
it "marks the scheme as confirmed" do
expect(scheme_to_update.reload.confirmed?).to eq(true)
end
Cldc 1669 add location redesign (#1034) * feat: wip postcode page * feat: wip add new flow * feat: add check answers page, continue updating flow * feat: add back behaviour * feat: more flow work * feat: further flow work and flash notice, name tidying * feat: add check_answers referrer linking * feat: add controller and details linking and lint * refactor: erblinting * feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates * feat: add validations to controller (could later be added to model) * fix: correct date order * feat: validate on model (except startdate) * feat: copy update * refactor: railsification * feat: add date model validation * feat: add updated availability text in check_answers * feat: more updated dynamic text and linking * refactor: erblinting * refactor: cleanup of redundant code * refactor: remove redundant create * feat: use rails route * test: wip tests * test: wip tests * feat: add new back behaviour for new scheme path and tests wip * feat: add more back behaviour for new scheme path and fix local auth validation * feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes * feat: if location with no details added, route to normal path rather than check answers * test: update model and helper location tests * test: more test updates * test: more test updates and remove redundant files * test: remove redundant tests, add postcode test * test: add new #new tests * test: add test for all new controller methods * test: add more startdate tests * refactor: erblinting * test: fix failing tests * test: update scheme test * feat: respond to PR comments * feat: make postcode clear only if changed * feat: add _update methods * refactor: simplify validation and location_edit_path method * refactor: add helper method for action text * refactor: remove redundant logic * refactor: simplify routing * refactor: reintroduce location_params * refactor: use presence validation for postcode * refactor: use presence validation for la * feat: validate confirmed * tests: make tests pass with new startdate validation * WIP * refactor: simplify display attributes helpers and update tests * refactor: linting * feat: design change to save behaviour * test: fix failing tests * feat: location code copy tweak * refactor: remove redundant function * refactor: remove add_another_location and new location page * feat: simplify startdate validations to move to model, use scheme available_from date for in range validation * test: fix failing tests * refactor: linting * feat: remove name validation as a result of PO review * test: update tests * refactor: remove redundant context Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "marks all the scheme locations as confirmed given they are complete" do
expect(scheme_to_update.locations.count > 0).to eq(true)
scheme_to_update.locations.each do |location|
expect(location.confirmed?).to eq(true)
end
end
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
context "when updating primary client group" do
let(:params) { { scheme: { primary_client_group: "Homeless families with support needs", page: "primary-client-group" } } }
it "renders confirm secondary group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("Does this scheme provide for another client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.primary_client_group).to eq("Homeless families with support needs")
end
context "when updating from check answers page" do
let(:params) { { scheme: { primary_client_group: "Homeless families with support needs", page: "primary-client-group", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.primary_client_group).to eq("Homeless families with support needs")
end
end
end
context "when updating confirm secondary client group" do
let(:params) { { scheme: { has_other_client_group: "Yes", page: "confirm-secondary" } } }
it "renders secondary client group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("Yes")
end
context "when updating from check answers page with the answer YES" do
let(:params) { { scheme: { has_other_client_group: "Yes", page: "confirm-secondary", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("Yes")
end
end
context "when updating from check answers page with the answer NO" do
let(:params) { { scheme: { has_other_client_group: "No", page: "confirm-secondary", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.has_other_client_group).to eq("No")
end
end
end
context "when updating secondary client group" do
let(:params) { { scheme: { secondary_client_group: "Homeless families with support needs", page: "secondary-client-group" } } }
it "renders confirm support page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What support does this scheme provide?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.secondary_client_group).to eq("Homeless families with support needs")
end
context "when updating from check answers page" do
let(:params) { { scheme: { secondary_client_group: "Homeless families with support needs", page: "secondary-client-group", check_answers: "true" } } }
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.secondary_client_group).to eq("Homeless families with support needs")
end
end
end
context "when updating support" do
let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support" } } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
Cldc 1669 add location redesign (#1034) * feat: wip postcode page * feat: wip add new flow * feat: add check answers page, continue updating flow * feat: add back behaviour * feat: more flow work * feat: further flow work and flash notice, name tidying * feat: add check_answers referrer linking * feat: add controller and details linking and lint * refactor: erblinting * feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates * feat: add validations to controller (could later be added to model) * fix: correct date order * feat: validate on model (except startdate) * feat: copy update * refactor: railsification * feat: add date model validation * feat: add updated availability text in check_answers * feat: more updated dynamic text and linking * refactor: erblinting * refactor: cleanup of redundant code * refactor: remove redundant create * feat: use rails route * test: wip tests * test: wip tests * feat: add new back behaviour for new scheme path and tests wip * feat: add more back behaviour for new scheme path and fix local auth validation * feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes * feat: if location with no details added, route to normal path rather than check answers * test: update model and helper location tests * test: more test updates * test: more test updates and remove redundant files * test: remove redundant tests, add postcode test * test: add new #new tests * test: add test for all new controller methods * test: add more startdate tests * refactor: erblinting * test: fix failing tests * test: update scheme test * feat: respond to PR comments * feat: make postcode clear only if changed * feat: add _update methods * refactor: simplify validation and location_edit_path method * refactor: add helper method for action text * refactor: remove redundant logic * refactor: simplify routing * refactor: reintroduce location_params * refactor: use presence validation for postcode * refactor: use presence validation for la * feat: validate confirmed * tests: make tests pass with new startdate validation * WIP * refactor: simplify display attributes helpers and update tests * refactor: linting * feat: design change to save behaviour * test: fix failing tests * feat: location code copy tweak * refactor: remove redundant function * refactor: remove add_another_location and new location page * feat: simplify startdate validations to move to model, use scheme available_from date for in range validation * test: fix failing tests * refactor: linting * feat: remove name validation as a result of PO review * test: update tests * refactor: remove redundant context Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "renders scheme check your answers page after successful update" do
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
follow_redirect!
expect(response).to have_http_status(:ok)
Cldc 1669 add location redesign (#1034) * feat: wip postcode page * feat: wip add new flow * feat: add check answers page, continue updating flow * feat: add back behaviour * feat: more flow work * feat: further flow work and flash notice, name tidying * feat: add check_answers referrer linking * feat: add controller and details linking and lint * refactor: erblinting * feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates * feat: add validations to controller (could later be added to model) * fix: correct date order * feat: validate on model (except startdate) * feat: copy update * refactor: railsification * feat: add date model validation * feat: add updated availability text in check_answers * feat: more updated dynamic text and linking * refactor: erblinting * refactor: cleanup of redundant code * refactor: remove redundant create * feat: use rails route * test: wip tests * test: wip tests * feat: add new back behaviour for new scheme path and tests wip * feat: add more back behaviour for new scheme path and fix local auth validation * feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes * feat: if location with no details added, route to normal path rather than check answers * test: update model and helper location tests * test: more test updates * test: more test updates and remove redundant files * test: remove redundant tests, add postcode test * test: add new #new tests * test: add test for all new controller methods * test: add more startdate tests * refactor: erblinting * test: fix failing tests * test: update scheme test * feat: respond to PR comments * feat: make postcode clear only if changed * feat: add _update methods * refactor: simplify validation and location_edit_path method * refactor: add helper method for action text * refactor: remove redundant logic * refactor: simplify routing * refactor: reintroduce location_params * refactor: use presence validation for postcode * refactor: use presence validation for la * feat: validate confirmed * tests: make tests pass with new startdate validation * WIP * refactor: simplify display attributes helpers and update tests * refactor: linting * feat: design change to save behaviour * test: fix failing tests * feat: location code copy tweak * refactor: remove redundant function * refactor: remove add_another_location and new location page * feat: simplify startdate validations to move to model, use scheme available_from date for in range validation * test: fix failing tests * refactor: linting * feat: remove name validation as a result of PO review * test: update tests * refactor: remove redundant context Co-authored-by: James Rose <james@jbpr.net>
2 years ago
expect(page).to have_content("Check your answers before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.intended_stay).to eq("Medium stay")
expect(scheme_to_update.reload.support_type).to eq("Low level")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when updating from check answers page" do
let(:params) { { scheme: { intended_stay: "Medium stay", support_type: "Low level", page: "support", check_answers: "true" } } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.intended_stay).to eq("Medium stay")
expect(scheme_to_update.reload.support_type).to eq("Low level")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
end
context "when updating details" do
let(:another_organisation) { FactoryBot.create(:organisation) }
let(:params) do
{ scheme: { service_name: "testy",
sensitive: "1",
scheme_type: "Foyer",
registered_under_care_act: "No",
page: "details",
arrangement_type: "The same organisation that owns the housing stock",
owning_organisation_id: another_organisation.id } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "renders confirm secondary group after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("What client group is this scheme intended for?")
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.service_name).to eq("testy")
expect(scheme_to_update.reload.scheme_type).to eq("Foyer")
expect(scheme_to_update.reload.sensitive).to eq("Yes")
expect(scheme_to_update.reload.registered_under_care_act).to eq("No")
expect(scheme_to_update.reload.owning_organisation_id).to eq(another_organisation.id)
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when updating from check answers page" do
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
let(:params) { { scheme: { service_name: "testy", sensitive: "1", scheme_type: "Foyer", registered_under_care_act: "No", page: "details", check_answers: "true" } } }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
it "renders check answers page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.service_name).to eq("testy")
expect(scheme_to_update.reload.scheme_type).to eq("Foyer")
expect(scheme_to_update.reload.sensitive).to eq("Yes")
expect(scheme_to_update.reload.registered_under_care_act).to eq("No")
end
end
end
context "when editing scheme name details" do
let(:another_organisation) { FactoryBot.create(:organisation) }
let(:params) do
{ scheme: { service_name: "testy",
sensitive: "1",
page: "edit-name",
owning_organisation_id: another_organisation.id } }
end
it "renders scheme show page after successful update" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content(scheme_to_update.reload.service_name)
expect(scheme_to_update.reload.owning_organisation_id).to eq(another_organisation.id)
end
it "updates a scheme with valid params" do
follow_redirect!
expect(scheme_to_update.reload.service_name).to eq("testy")
expect(scheme_to_update.reload.sensitive).to eq("Yes")
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
describe "#primary_client_group" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/1/primary-client-group"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/1/primary-client-group"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let!(:another_scheme) { FactoryBot.create(:scheme) }
before do
sign_in user
get "/schemes/#{scheme.id}/primary-client-group"
end
it "returns a template for a primary-client-group" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("What client group is this scheme intended for?")
end
context "when attempting to access primary-client-group scheme page for another organisation" do
before do
get "/schemes/#{another_scheme.id}/primary-client-group"
end
it "returns 404 not_found" do
request
expect(response).to have_http_status(:not_found)
end
end
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{scheme.id}/primary-client-group"
end
it "returns a template for a primary-client-group" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("What client group is this scheme intended for?")
end
context "and the scheme is confirmed" do
before do
scheme.update!(confirmed: true)
get "/schemes/#{scheme.id}/primary-client-group"
end
it "redirects to a view scheme page" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(path).to match("/schemes/#{scheme.id}")
expect(page).to have_content(scheme.service_name)
assert_select "a", text: /Change/, count: 3
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
describe "#confirm_secondary_client_group" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/1/confirm-secondary-client-group"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/1/confirm-secondary-client-group"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let!(:another_scheme) { FactoryBot.create(:scheme) }
before do
sign_in user
get "/schemes/#{scheme.id}/confirm-secondary-client-group"
end
it "returns a template for a confirm-secondary-client-group" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Does this scheme provide for another client group?")
end
context "when attempting to access confirm-secondary-client-group scheme page for another organisation" do
before do
get "/schemes/#{another_scheme.id}/confirm-secondary-client-group"
end
it "returns 404 not_found" do
request
expect(response).to have_http_status(:not_found)
end
end
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{scheme.id}/confirm-secondary-client-group"
end
it "returns a template for a confirm-secondary-client-group" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Does this scheme provide for another client group?")
end
context "and the scheme is confirmed" do
before do
scheme.update!(confirmed: true)
get "/schemes/#{scheme.id}/confirm-secondary-client-group"
end
it "redirects to a view scheme page" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(path).to match("/schemes/#{scheme.id}")
expect(page).to have_content(scheme.service_name)
assert_select "a", text: /Change/, count: 3
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
describe "#secondary_client_group" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/1/secondary-client-group"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/1/secondary-client-group"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let!(:another_scheme) { FactoryBot.create(:scheme) }
before do
sign_in user
get "/schemes/#{scheme.id}/secondary-client-group"
end
it "returns a template for a secondary-client-group" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
context "when attempting to access secondary-client-group scheme page for another organisation" do
before do
get "/schemes/#{another_scheme.id}/secondary-client-group"
end
it "returns 404 not_found" do
request
expect(response).to have_http_status(:not_found)
end
end
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil, primary_client_group: Scheme::PRIMARY_CLIENT_GROUP[:"Homeless families with support needs"]) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{scheme.id}/secondary-client-group"
end
it "returns a template for a secondary-client-group" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("What is the other client group?")
end
context "and the scheme is confirmed" do
before do
scheme.update!(confirmed: true)
get "/schemes/#{scheme.id}/secondary-client-group"
end
it "redirects to a view scheme page" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(path).to match("/schemes/#{scheme.id}")
expect(page).to have_content(scheme.service_name)
assert_select "a", text: /Change/, count: 3
end
end
it "does not show the primary client group as an option" do
expect(scheme.primary_client_group).not_to be_nil
expect(page).not_to have_content("Homeless families with support needs")
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
describe "#support" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/1/support"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/1/support"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let!(:another_scheme) { FactoryBot.create(:scheme) }
before do
sign_in user
get "/schemes/#{scheme.id}/support"
end
it "returns a template for a support" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("What support does this scheme provide?")
end
context "when attempting to access secondary-client-group scheme page for another organisation" do
before do
get "/schemes/#{another_scheme.id}/support"
end
it "returns 404 not_found" do
request
expect(response).to have_http_status(:not_found)
end
end
context "and the scheme is confirmed" do
before do
scheme.update!(confirmed: true)
get "/schemes/#{scheme.id}/support"
end
it "redirects to a view scheme page" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(path).to match("/schemes/#{scheme.id}")
expect(page).to have_content(scheme.service_name)
assert_select "a", text: /Change/, count: 2
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{scheme.id}/support"
end
it "returns a template for a support" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("What support does this scheme provide?")
end
end
end
describe "#check-answers" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/1/check-answers"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/1/check-answers"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let!(:another_scheme) { FactoryBot.create(:scheme) }
before do
sign_in user
get "/schemes/#{scheme.id}/check-answers"
end
it "returns a template for a support" do
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when attempting to access check-answers scheme page for another organisation" do
before do
get "/schemes/#{another_scheme.id}/check-answers"
end
it "returns 404 not_found" do
request
expect(response).to have_http_status(:not_found)
end
end
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme) }
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{scheme.id}/check-answers"
end
it "returns a template for a support" do
expect(response).to have_http_status(:ok)
CLDC-1337-permitted-user-can-add-location-when-creating-scheme (#704) * added last step * not finding postcode field * testing being direct to add locations page after submitting support questions * added route to locations controller * location controller spec * location controller * added template for new * next step in feature * added postcode * added name to locations * removed total units from schemes * moved total units to locations * changed type of unit type in db * using type of units * add locations page is finished * purged total units and added test for location create * creating location * testing creating location as data provider * fixed factory * refacotred update/create and added test creating location as a coord user * testing returning back to create page if create another location is selected * testing returning back to create page if create another location is selected - part 2 * thanks rubocop * thanks rubocop * testing back from new location * returned tests back * testing clickable locations link * testing clickable locations link under correct context * correctly looking table * table with caption * wip * fixed failing exisiting tests * fixed failing exisiting tests - part 2 * validating postcode case logs style * validating postcode specs * validating postcode specs debugger removed * navigation when editing location * spike creating new location after addition * small refactoring * added test to add another location from locations page * added test to amend a location * added test to amend a location - part 2 * testing location cell * added wheelchair adaptions to the unit tyupe * rebased * testing postcode missing * testing creating schem for a different org for coordinator * testing new scheme for a different org for coordinator * upcasing all postcodes before creation * testing edge cases around postcodes and yes or no for another location * create locations with support user * details locations specs * update locations specs * rubocop * checking raising error * fixed failed test * switched yes and no for wheelchairs * routes refactoring * fixed routing - WIP * further chanegs * feature tests passing * correct page when errros * redundant page * moving viewing locations away from schemes controller * new is fixed * create fixed * fixed locations specs * fixed tab nav specs * completed location specs * lint
2 years ago
expect(page).to have_content("Check your changes before creating this scheme")
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
end
end
describe "#details" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/1/details"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/1/details"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
let!(:another_scheme) { FactoryBot.create(:scheme) }
before do
sign_in user
get "/schemes/#{scheme.id}/details"
end
it "returns a template for a support" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Create a new supported housing scheme")
end
context "when attempting to access check-answers scheme page for another organisation" do
before do
get "/schemes/#{another_scheme.id}/details"
end
it "returns 404 not_found" do
request
expect(response).to have_http_status(:not_found)
end
end
context "and the scheme is confirmed" do
before do
scheme.update!(confirmed: true)
get "/schemes/#{scheme.id}/details"
end
it "redirects to a view scheme page" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(path).to match("/schemes/#{scheme.id}")
expect(page).to have_content(scheme.service_name)
assert_select "a", text: /Change/, count: 2
end
end
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme, confirmed: nil) }
CLDC-1290 Permitted user can create a new scheme (#671) * added test to find link to create a new scheme * added button to create a new scheme * testing arriving to the new scheme form * non exsiting link to controller new action * SPIKEEEE * first page complete * posting to create * refactored scheme to enums * refactored new scheme page to use enums as well * views * SPIKE WIP * SPIKE WIP * SPIKE WIP * drawing list of scheme details * expanded on feature seeing more fields to fill in * expanded on feature seeing more fields to fill in 2nd page * refactored * working back buttons * working flash * more change in wip * default value for org * working spike * some spacing * filling answers * spike finished * correct name for details * testing fill in details * removed gem and further tests * Add has other client group field to schemes. Display it in the check answers. Fix tests and routing * remove details view and path Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com> * WIP change update paths * Implement changing answers (except the details one) * Add details page back for editing scheme details * added missing test for support questions and nested check answers under correct context * checking the back functionality * rubo and lint * checking the back functionality for primary gourp * checking the back functionality for confirm secondary * checking the back functionality for secondary group * checking the back functionality for support answers * checking the back functionality for returning to check answers from details page * checking the back functionality for returning to check answers from primary group page * checking the back functionality for secondary group confirm yes * checking the back functionality for secondary group confirm yes - fixed * checking the back functionality for secondary group * checking the back functionality for secondary group -fixed * checking the back functionality for returning from support page * Do not display secondary client group if the scheme doesn't have one * Add details path to schemes controller update method * Add more tests for back button * Add tests for new controller method * Add tests for creating schemes as data coordinator * fixed schema * added test for missing params when creating scheme * create for support user with or withotu required param * code to get controller render errors when required param is missing * code to implement correct validation * code to implement correct validation - part 2 * highlight missing field * doing silly dance to get correct field highlighted on the error * testing patch for schemes * testing patch for schemes - correct path * small refactoring * testing primary client group update via regular path * testing primary client group update via check answers page * testing confirm secondary group update with YES NO and returning from check answers page * testing updating secondary client group update and returning from check answers page * testing support answers and returning from check answers page * testing details and returning from check answers page * weird path when no names supplied * rubocop * lost in rebasing * started id to code refactoring * model specs remastered * fixed scheme controller specs * further refactorings * fixing feature schemes * final touches * removed code from db * remaining code purged * rubocop * included check for owning org field * checking for stock owning org selection * added stock owning org * added stock owning org on new page * added stock owning org to details * removed total units * managing related schems properly via Org * managing related schems properly via Org - rubocop * small refactoring * small refactoring - 2 * small refactoring - 3 * tests for owned_schemes and managed_schemes * rubocop * added tests for support user creating scheme * rubocop -a * tests for a primary-client-group * tests for a secondary-client-group * tests for a confirm-secondary-client-group * tests for a check-answers * tests for a details * rubocop * redundant action in controller * Trigger WF * switched to int for confirm * flashing test * flashing test for support user * flashing test rubocop Co-authored-by: Kat <katrina@madetech.com> Co-authored-by: baarkerlounger <baarkerlounger@users.noreply.github.com>
2 years ago
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{scheme.id}/details"
end
it "returns a template for a support" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Create a new supported housing scheme")
end
end
end
describe "#edit_name" do
context "when not signed in" do
it "redirects to the sign in page" do
get "/schemes/1/edit-name"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
get "/schemes/1/edit-name"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation) }
let!(:another_scheme) { FactoryBot.create(:scheme) }
before do
sign_in user
get "/schemes/#{scheme.id}/edit-name"
end
it "returns a template for a edit-name" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Scheme details")
expect(page).to have_content("This scheme contains confidential information")
expect(page).not_to have_content("Which organisation owns the housing stock for this scheme?")
end
context "when attempting to access secondary-client-group scheme page for another organisation" do
before do
get "/schemes/#{another_scheme.id}/edit-name"
end
it "returns 404 not_found" do
request
expect(response).to have_http_status(:not_found)
end
end
end
context "when signed in as a support user" do
let(:user) { FactoryBot.create(:user, :support) }
let!(:scheme) { FactoryBot.create(:scheme) }
before do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
get "/schemes/#{scheme.id}/edit-name"
end
it "returns a template for a secondary-client-group" do
expect(response).to have_http_status(:ok)
expect(page).to have_content("Scheme details")
expect(page).to have_content("This scheme contains confidential information")
expect(page).to have_content("Which organisation owns the housing stock for this scheme?")
end
end
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
describe "#deactivate" do
context "when not signed in" do
it "redirects to the sign in page" do
patch "/schemes/1/new-deactivation"
expect(response).to redirect_to("/account/sign-in")
end
end
context "when signed in as a data provider" do
let(:user) { FactoryBot.create(:user) }
before do
sign_in user
patch "/schemes/1/new-deactivation"
end
it "returns 401 unauthorized" do
request
expect(response).to have_http_status(:unauthorized)
end
end
context "when signed in as a data coordinator" do
let(:user) { FactoryBot.create(:user, :data_coordinator) }
let!(:scheme) { FactoryBot.create(:scheme, owning_organisation: user.organisation, created_at: Time.zone.today) }
let!(:location) { FactoryBot.create(:location, scheme:) }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
let(:deactivation_date) { Time.utc(2022, 10, 10) }
let!(:lettings_log) { FactoryBot.create(:lettings_log, :sh, location:, scheme:, startdate:, owning_organisation: user.organisation, created_by: user) }
let(:startdate) { Time.utc(2022, 10, 11) }
let(:setup_schemes) { nil }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
before do
Timecop.freeze(Time.utc(2022, 10, 10))
sign_in user
setup_schemes
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
patch "/schemes/#{scheme.id}/new-deactivation", params:
end
after do
Timecop.unfreeze
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
context "with default date" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "default", deactivation_date: } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
context "and affected logs" do
it "redirects to the confirmation page" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("This change will affect #{scheme.lettings_logs.count} logs")
end
end
context "and no affected logs" do
let(:setup_schemes) { scheme.lettings_logs.update(scheme: nil) }
it "redirects to the location page and updates the deactivation period" do
follow_redirect!
follow_redirect!
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
scheme.reload
expect(scheme.scheme_deactivation_periods.count).to eq(1)
expect(scheme.scheme_deactivation_periods.first.deactivation_date).to eq(Time.zone.local(2022, 4, 1))
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "with other date" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "10", "deactivation_date(1i)": "2022" } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
context "and affected logs" do
it "redirects to the confirmation page" do
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_content("This change will affect #{scheme.lettings_logs.count} logs")
end
end
context "and no affected logs" do
let(:setup_schemes) { scheme.lettings_logs.update(scheme: nil) }
it "redirects to the location page and updates the deactivation period" do
follow_redirect!
follow_redirect!
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
scheme.reload
expect(scheme.scheme_deactivation_periods.count).to eq(1)
expect(scheme.scheme_deactivation_periods.first.deactivation_date).to eq(Time.zone.local(2022, 10, 10))
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "when confirming deactivation" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { deactivation_date:, confirm: true, deactivation_date_type: "other" } }
let(:mailer) { instance_double(LocationOrSchemeDeactivationMailer) }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
before do
Timecop.freeze(Time.utc(2022, 10, 10))
sign_in user
end
after do
Timecop.unfreeze
end
context "and a log startdate is after scheme deactivation date" do
before do
patch "/schemes/#{scheme.id}/deactivate", params:
end
it "updates existing scheme with valid deactivation date and renders scheme page" do
follow_redirect!
follow_redirect!
expect(response).to have_http_status(:ok)
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
scheme.reload
expect(scheme.scheme_deactivation_periods.count).to eq(1)
expect(scheme.scheme_deactivation_periods.first.deactivation_date).to eq(deactivation_date)
end
it "clears the scheme and scheme answers" do
expect(lettings_log.scheme).to eq(scheme)
expect(lettings_log.scheme).to eq(scheme)
lettings_log.reload
expect(lettings_log.scheme).to eq(nil)
expect(lettings_log.scheme).to eq(nil)
end
it "marks log as needing attention" do
expect(lettings_log.unresolved).to eq(nil)
lettings_log.reload
expect(lettings_log.unresolved).to eq(true)
end
end
context "and a log startdate is before scheme deactivation date" do
let(:startdate) { Time.utc(2022, 10, 9) }
it "does not update the log" do
expect(lettings_log.scheme).to eq(scheme)
expect(lettings_log.scheme).to eq(scheme)
lettings_log.reload
expect(lettings_log.scheme).to eq(scheme)
expect(lettings_log.scheme).to eq(scheme)
end
it "does not mark log as needing attention" do
expect(lettings_log.unresolved).to eq(nil)
lettings_log.reload
expect(lettings_log.unresolved).to eq(nil)
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
context "and the users need to be notified" do
it "sends E-mails to the creators of affected logs with counts" do
expect {
patch "/schemes/#{scheme.id}/deactivate", params:
}.to enqueue_job(ActionMailer::MailDeliveryJob)
end
end
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
context "when the date is not selected" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { "deactivation_date": "" } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "displays the new page with an error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.not_selected"))
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "when invalid date is entered" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "44", "deactivation_date(1i)": "2022" } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "displays the new page with an error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "when the date is entered is before the beginning of current collection window" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "10", "deactivation_date(2i)": "4", "deactivation_date(1i)": "2020" } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "displays the new page with an error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.out_of_range", date: "1 April 2022"))
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "when the day is not entered" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "", "deactivation_date(2i)": "2", "deactivation_date(1i)": "2022" } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "displays page with an error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "when the month is not entered" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "", "deactivation_date(1i)": "2022" } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "displays page with an error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
context "when the year is not entered" do
Cldc 1670 reactivate locations (#1007) * route deactivated scheme to reactivation page * Render correct reactivate question content * refactor into a helper * display successful reactivation banner for default date * Save reactivation date * Add reactivation errors * lint and fix url in tests * make toggle translations generic * Add reactivation status * Reuse date validation messages * Show deactivate this location when location is reactivating soon * Display correct confirmation banner * Add validation for reactivation date before deactivation date * Improve availability label * Use current collection start date if created at is later than that * Update paths * Fix controller and don't display the previous day if location availability start afterwards * refactor availability label * Filter out active periods * lint * Refactor active_period method into the model * Allow deactivations and reactivations from available from date instead of start of the collection date * Prevent deactivations during deactivated periods * lint * typo * Remove active periods that last 1 day (because they get deactivated on the same day) * Move the active_periods into helper * extract remove_overlapping_and_empty_periods into a separate method * Remove nested deactivation periods * Make deactivate/reactvate location form use location_deactivation_period model * refactor toggle date methods * extract shared condition * update validations * refactor validations * Update schemes deactivation form to use dectivation model * Refactor * lint * remove redundant location_id and update scheme controller * update active_periods
2 years ago
let(:params) { { scheme_deactivation_period: { deactivation_date_type: "other", "deactivation_date(3i)": "2", "deactivation_date(2i)": "2", "deactivation_date(1i)": "" } } }
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
it "displays page with an error message" do
expect(response).to have_http_status(:unprocessable_entity)
expect(page).to have_content(I18n.t("validations.scheme.toggle_date.invalid"))
Cldc 1671 deactivate scheme (#980) * feat: wip update scheme summary page * feat: wip deactivate scheme schemes page * feat: wip toggle active page * feat: wip set deactivation_date to a datetime (to be more specific times later_ * Change conditional question controller to accommodate all models * feat: add specific datetimes for deactivation * feat: correct date and add notice * feat: wip error behaviour * feat: wip errors * feat: wip errors refactoring * feat: wip errors more refactoring * refactor: linting * feat: add second error in correct position and wip date range error * feat: remove unneccessary db field * feat: change type values to strings * refactor: tidy up controller logic * refactor: use same structure as locations deactivation * feat: add general partially missing date input error * feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller * feat: fix tests, add status tag behaviour and remove unnecessary nils * refactor: linting * refactor: erblinting * refactor: remove redundant line * refactor: respond to PR comments 1 * refactor: respond to PR comments 2 * refactor: respond to PR comments 3 * refactor: respond to PR comments 3 (locations side) * fix: remove @locations in location model * fix: remove @locations in location model * fix: update status names * feat: wip validation update * feat: add validation to model layer * feat: further separate scheme deactivation behaviour * test: update tests to new flow * feat: respond to pr comments and add dynamic success text * feat: duplicate behaviour schemes -> locations (+ tests) * refactor: linting * refactor: typo and remove unnecessary line for this PR * refactor: feature toggle simplification * Refactor locations and schemes controller actions - Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to - Make all deactivation date comparision UTC time * feat: update deactivation_date validation and add tests * refactor: linting Co-authored-by: Kat <katrina@kosiak.co.uk> Co-authored-by: James Rose <james@jbpr.net>
2 years ago
end
end
end
end
Cldc 1227 supported housing index (#648) * Added test file for supported housing schemes * Added factory bot for supported housing schemes * swapped managing agent to org for scheme * created migration for schemes * created model for scheme * added migration to add foreign key to the schemes table * missing spec and log spec for supported housing * fixed failing specs * added schemes migration * next step feature * added route * added controller * added index * added all schemes * correct test for scheme * added view * route alias for schemes * spec for index schemes * failing scheme controller spec * added simple view, scheme seed and authentication * spec for index schemes list * rubocop - thanks * better seed * added Heading to org * added feature flag to hide supported services on prod * added feature flag testing nav items * testing coordinator user can see the link to supported housing * moved toggle to a different place * moved toggle to PrimaryNavigationComponent * testing not being signed in on support pages * testing showing search bar * added search bar * testing subset of schemes for coordinator user * rubocop * failing test for title in page * code to expose title * pagination with tests without searching * partial for schemes * scoping out all but support and coord users * searching schemes code and test * searching via code and org tests * searching by org name tests * searching by org name code * search_by tests * search_by code * search_by woops must search by service * searching schemes feature * tests for data coordinator user * redirect for data coordinator user * testing org schemes for coordiantor user * schemes in org controller for coordiantor user * refactored specs moved into orgs what belongs there * view for org schemes * rubocop * accebility field * accebility field on org page * correct return when on org schemes * passing search test on the orgs page * highlight nav tab * navs helper done * rubocop * fixed failing tests for support user * correct view * how did I manage to delete this file? * checking you cant access schems unathorized * moved test * renamed service name * correct title for sup user schemes org * testing not being able to view any other orgs supported housing for coordinator user * Trigger WF * last fix * aded has many to org for schemes * rubocop Co-authored-by: Ted <ted.booton@madetech.com>
2 years ago
end