@ -14,7 +14,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
sign_in user
sign_in user
end
end
context " when accessing the housing provid ers tab " do
context " when accessing the stock own ers tab " do
context " with an organisation that the user belongs to " do
context " with an organisation that the user belongs to " do
let! ( :housing_provider ) { FactoryBot . create ( :organisation ) }
let! ( :housing_provider ) { FactoryBot . create ( :organisation ) }
let! ( :other_org_housing_provider ) { FactoryBot . create ( :organisation , name : " Foobar LTD " ) }
let! ( :other_org_housing_provider ) { FactoryBot . create ( :organisation , name : " Foobar LTD " ) }
@ -31,32 +31,32 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( expected_html )
end
end
it " shows an add housing provid er button " do
it " shows an add stock own er button " do
expect ( page ) . to have_link ( " Add a housing provid er " )
expect ( page ) . to have_link ( " Add a stock own er " )
end
end
it " shows a table of housing provid ers " do
it " shows a table of stock own ers " do
expected_html = " <table class= \" govuk-table \" "
expected_html = " <table class= \" govuk-table \" "
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( housing_provider . name )
expect ( response . body ) . to include ( housing_provider . name )
end
end
it " shows only housing provid ers for the current user's organisation " do
it " shows only stock own ers for the current user's organisation " do
expect ( page ) . to have_content ( housing_provider . name )
expect ( page ) . to have_content ( housing_provider . name )
expect ( page ) . not_to have_content ( other_org_housing_provider . name )
expect ( page ) . not_to have_content ( other_org_housing_provider . name )
end
end
it " shows the pagination count " do
it " shows the pagination count " do
expect ( page ) . to have_content ( " 1 total housing provid ers " )
expect ( page ) . to have_content ( " 1 total stock own ers " )
end
end
context " when adding a housing provid er " do
context " when adding a stock own er " do
before do
before do
get " /organisations/ #{ organisation . id } /housing-providers/add " , headers : , params : { }
get " /organisations/ #{ organisation . id } /housing-providers/add " , headers : , params : { }
end
end
it " has the correct header " do
it " has the correct header " do
expect ( response . body ) . to include ( " What is the name of your housing provid er? " )
expect ( response . body ) . to include ( " What is the name of your stock own er? " )
end
end
it " shows an add button " do
it " shows an add button " do
@ -248,7 +248,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
sign_in user
sign_in user
end
end
context " when accessing the housing provid ers tab " do
context " when accessing the stock own ers tab " do
context " with an organisation that the user belongs to " do
context " with an organisation that the user belongs to " do
let! ( :housing_provider ) { FactoryBot . create ( :organisation ) }
let! ( :housing_provider ) { FactoryBot . create ( :organisation ) }
let! ( :other_org_housing_provider ) { FactoryBot . create ( :organisation , name : " Foobar LTD " ) }
let! ( :other_org_housing_provider ) { FactoryBot . create ( :organisation , name : " Foobar LTD " ) }
@ -265,23 +265,23 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( expected_html )
end
end
it " doesn't show an add housing provid er button " do
it " doesn't show an add stock own er button " do
expect ( page ) . not_to have_link ( " Add a housing provid er " )
expect ( page ) . not_to have_link ( " Add a stock own er " )
end
end
it " shows a table of housing provid ers " do
it " shows a table of stock own ers " do
expected_html = " <table class= \" govuk-table \" "
expected_html = " <table class= \" govuk-table \" "
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( housing_provider . name )
expect ( response . body ) . to include ( housing_provider . name )
end
end
it " shows only housing provid ers for the current user's organisation " do
it " shows only stock own ers for the current user's organisation " do
expect ( page ) . to have_content ( housing_provider . name )
expect ( page ) . to have_content ( housing_provider . name )
expect ( page ) . not_to have_content ( other_org_housing_provider . name )
expect ( page ) . not_to have_content ( other_org_housing_provider . name )
end
end
it " shows the pagination count " do
it " shows the pagination count " do
expect ( page ) . to have_content ( " 1 total housing provid ers " )
expect ( page ) . to have_content ( " 1 total stock own ers " )
end
end
end
end
@ -469,7 +469,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
end
end
end
end
context " when viewing a specific organisation's housing provid ers " do
context " when viewing a specific organisation's stock own ers " do
let! ( :housing_provider ) { FactoryBot . create ( :organisation ) }
let! ( :housing_provider ) { FactoryBot . create ( :organisation ) }
let! ( :other_org_housing_provider ) { FactoryBot . create ( :organisation , name : " Foobar LTD " ) }
let! ( :other_org_housing_provider ) { FactoryBot . create ( :organisation , name : " Foobar LTD " ) }
let! ( :other_organisation ) { FactoryBot . create ( :organisation , name : " Foobar LTD 2 " ) }
let! ( :other_organisation ) { FactoryBot . create ( :organisation , name : " Foobar LTD 2 " ) }
@ -489,13 +489,13 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
expect ( page ) . to have_content ( " Users " )
expect ( page ) . to have_content ( " Users " )
end
end
it " shows a table of housing provid ers " do
it " shows a table of stock own ers " do
expected_html = " <table class= \" govuk-table \" "
expected_html = " <table class= \" govuk-table \" "
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( expected_html )
expect ( response . body ) . to include ( housing_provider . name )
expect ( response . body ) . to include ( housing_provider . name )
end
end
it " shows only housing provid ers for this organisation " do
it " shows only stock own ers for this organisation " do
expect ( page ) . to have_content ( housing_provider . name )
expect ( page ) . to have_content ( housing_provider . name )
expect ( page ) . not_to have_content ( other_org_housing_provider . name )
expect ( page ) . not_to have_content ( other_org_housing_provider . name )
end
end
@ -505,16 +505,16 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
end
end
it " shows the pagination count " do
it " shows the pagination count " do
expect ( page ) . to have_content ( " 1 total housing provid ers " )
expect ( page ) . to have_content ( " 1 total stock own ers " )
end
end
context " when adding a housing provid er " do
context " when adding a stock own er " do
before do
before do
get " /organisations/ #{ organisation . id } /housing-providers/add " , headers : , params : { }
get " /organisations/ #{ organisation . id } /housing-providers/add " , headers : , params : { }
end
end
it " has the correct header " do
it " has the correct header " do
expect ( response . body ) . to include ( " What is the name of this organisation& # 39;s housing provid er? " )
expect ( response . body ) . to include ( " What is the name of this organisation& # 39;s stock own er? " )
end
end
it " shows an add button " do
it " shows an add button " do
@ -562,7 +562,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
expect ( response . body ) . to include ( " Remove " )
expect ( response . body ) . to include ( " Remove " )
end
end
context " when adding a housing provid er " do
context " when adding a stock own er " do
before do
before do
get " /organisations/ #{ organisation . id } /managing-agents/add " , headers : , params : { }
get " /organisations/ #{ organisation . id } /managing-agents/add " , headers : , params : { }
end
end