@ -128,7 +128,7 @@ RSpec.describe SchemesHelper do
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
]
]
expect ( display_scheme_attributes ( scheme , support_user ) ) . to eq ( attributes )
expect ( display_scheme_attributes ( scheme ) ) . to eq ( attributes )
end
end
it " returns correct display attributes for a coordinator user " do
it " returns correct display attributes for a coordinator user " do
@ -139,6 +139,7 @@ RSpec.describe SchemesHelper do
{ name : " Confidential information " , value : " No " , edit : true } ,
{ name : " Confidential information " , value : " No " , edit : true } ,
{ name : " Type of scheme " , value : " Housing for older people " } ,
{ name : " Type of scheme " , value : " Housing for older people " } ,
{ name : " Registered under Care Standards Act 2000 " , value : " Yes – registered care home providing personal care " } ,
{ name : " Registered under Care Standards Act 2000 " , value : " Yes – registered care home providing personal care " } ,
{ name : " Housing stock owned by " , value : " Acme LTD Owning " , edit : true } ,
{ name : " Support services provided by " , value : " A registered charity or voluntary organisation " } ,
{ name : " Support services provided by " , value : " A registered charity or voluntary organisation " } ,
{ name : " Primary client group " , value : " Rough sleepers " } ,
{ name : " Primary client group " , value : " Rough sleepers " } ,
{ name : " Has another client group " , value : " Yes " } ,
{ name : " Has another client group " , value : " Yes " } ,
@ -147,7 +148,7 @@ RSpec.describe SchemesHelper do
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
]
]
expect ( display_scheme_attributes ( scheme , coordinator_user ) ) . to eq ( attributes )
expect ( display_scheme_attributes ( scheme ) ) . to eq ( attributes )
end
end
end
end
@ -173,7 +174,7 @@ RSpec.describe SchemesHelper do
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
]
]
expect ( display_scheme_attributes ( scheme , support_user ) ) . to eq ( attributes )
expect ( display_scheme_attributes ( scheme ) ) . to eq ( attributes )
end
end
it " returns correct display attributes for a coordinator user " do
it " returns correct display attributes for a coordinator user " do
@ -184,6 +185,7 @@ RSpec.describe SchemesHelper do
{ name : " Confidential information " , value : " No " , edit : true } ,
{ name : " Confidential information " , value : " No " , edit : true } ,
{ name : " Type of scheme " , value : " Housing for older people " } ,
{ name : " Type of scheme " , value : " Housing for older people " } ,
{ name : " Registered under Care Standards Act 2000 " , value : " Yes – registered care home providing personal care " } ,
{ name : " Registered under Care Standards Act 2000 " , value : " Yes – registered care home providing personal care " } ,
{ name : " Housing stock owned by " , value : " Acme LTD Owning " , edit : true } ,
{ name : " Support services provided by " , value : " A registered charity or voluntary organisation " } ,
{ name : " Support services provided by " , value : " A registered charity or voluntary organisation " } ,
{ name : " Primary client group " , value : " Rough sleepers " } ,
{ name : " Primary client group " , value : " Rough sleepers " } ,
{ name : " Has another client group " , value : " Yes " } ,
{ name : " Has another client group " , value : " Yes " } ,
@ -192,7 +194,7 @@ RSpec.describe SchemesHelper do
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Intended length of stay " , value : " Permanent " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
{ name : " Availability " , value : " Active from 1 April 2021 " } ,
]
]
expect ( display_scheme_attributes ( scheme , coordinator_user ) ) . to eq ( attributes )
expect ( display_scheme_attributes ( scheme ) ) . to eq ( attributes )
end
end
context " when the managing organisation is the owning organisation " do
context " when the managing organisation is the owning organisation " do
@ -206,7 +208,7 @@ RSpec.describe SchemesHelper do
context " with no deactivations " do
context " with no deactivations " do
it " displays current collection start date as availability date if created_at is later than collection start date " do
it " displays current collection start date as availability date if created_at is later than collection start date " do
scheme . update! ( created_at : Time . zone . local ( 2022 , 4 , 16 ) )
scheme . update! ( created_at : Time . zone . local ( 2022 , 4 , 16 ) )
availability_attribute = display_scheme_attributes ( scheme , support_user ) . find { | x | x [ :name ] == " Availability " } [ :value ]
availability_attribute = display_scheme_attributes ( scheme ) . find { | x | x [ :name ] == " Availability " } [ :value ]
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 " )
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 " )
end
end
@ -221,7 +223,7 @@ RSpec.describe SchemesHelper do
end
end
it " displays the timeline of availability " do
it " displays the timeline of availability " do
availability_attribute = display_scheme_attributes ( scheme , support_user ) . find { | x | x [ :name ] == " Availability " } [ :value ]
availability_attribute = display_scheme_attributes ( scheme ) . find { | x | x [ :name ] == " Availability " } [ :value ]
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 9 August 2022 \n Deactivated on 10 August 2022 \n Active from 1 September 2022 to 14 September 2022 \n Deactivated on 15 September 2022 \n Active from 28 September 2022 " )
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 9 August 2022 \n Deactivated on 10 August 2022 \n Active from 1 September 2022 to 14 September 2022 \n Deactivated on 15 September 2022 \n Active from 28 September 2022 " )
end
end
@ -235,7 +237,7 @@ RSpec.describe SchemesHelper do
end
end
it " displays the timeline of availability " do
it " displays the timeline of availability " do
availability_attribute = display_scheme_attributes ( scheme , support_user ) . find { | x | x [ :name ] == " Availability " } [ :value ]
availability_attribute = display_scheme_attributes ( scheme ) . find { | x | x [ :name ] == " Availability " } [ :value ]
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 9 August 2022 \n Deactivated on 10 August 2022 \n Active from 1 September 2022 to 14 September 2022 \n Deactivated on 15 September 2022 " )
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 9 August 2022 \n Deactivated on 10 August 2022 \n Active from 1 September 2022 to 14 September 2022 \n Deactivated on 15 September 2022 " )
end
end
@ -251,7 +253,7 @@ RSpec.describe SchemesHelper do
end
end
it " displays the timeline of availability " do
it " displays the timeline of availability " do
availability_attribute = display_scheme_attributes ( scheme , support_user ) . find { | x | x [ :name ] == " Availability " } [ :value ]
availability_attribute = display_scheme_attributes ( scheme ) . find { | x | x [ :name ] == " Availability " } [ :value ]
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 14 June 2022 \n Deactivated on 15 June 2022 \n Active from 18 June 2022 to 23 September 2022 \n Deactivated on 24 September 2022 \n Active from 28 September 2022 " )
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 14 June 2022 \n Deactivated on 15 June 2022 \n Active from 18 June 2022 to 23 September 2022 \n Deactivated on 24 September 2022 \n Active from 28 September 2022 " )
end
end
@ -265,7 +267,7 @@ RSpec.describe SchemesHelper do
end
end
it " displays the timeline of availability " do
it " displays the timeline of availability " do
availability_attribute = display_scheme_attributes ( scheme , support_user ) . find { | x | x [ :name ] == " Availability " } [ :value ]
availability_attribute = display_scheme_attributes ( scheme ) . find { | x | x [ :name ] == " Availability " } [ :value ]
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 14 June 2022 \n Deactivated on 15 June 2022 \n Active from 28 September 2022 " )
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 14 June 2022 \n Deactivated on 15 June 2022 \n Active from 28 September 2022 " )
end
end
@ -282,7 +284,7 @@ RSpec.describe SchemesHelper do
end
end
it " displays the timeline of availability " do
it " displays the timeline of availability " do
availability_attribute = display_scheme_attributes ( scheme , support_user ) . find { | x | x [ :name ] == " Availability " } [ :value ]
availability_attribute = display_scheme_attributes ( scheme ) . find { | x | x [ :name ] == " Availability " } [ :value ]
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 14 June 2022 \n Deactivated on 15 June 2022 \n Active from 28 September 2022 to 23 October 2022 \n Deactivated on 24 October 2022 \n Active from 28 October 2022 " )
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 14 June 2022 \n Deactivated on 15 June 2022 \n Active from 28 September 2022 to 23 October 2022 \n Deactivated on 24 October 2022 \n Active from 28 October 2022 " )
end
end
@ -297,7 +299,7 @@ RSpec.describe SchemesHelper do
end
end
it " displays the timeline of availability " do
it " displays the timeline of availability " do
availability_attribute = display_scheme_attributes ( scheme , support_user ) . find { | x | x [ :name ] == " Availability " } [ :value ]
availability_attribute = display_scheme_attributes ( scheme ) . find { | x | x [ :name ] == " Availability " } [ :value ]
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 9 October 2022 \n Deactivated on 10 October 2022 \n Active from 11 December 2022 " )
expect ( availability_attribute ) . to eq ( " Active from 1 April 2021 to 9 October 2022 \n Deactivated on 10 October 2022 \n Active from 11 December 2022 " )
end
end