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.

38 lines
1.8 KiB

require "rails_helper"
RSpec.describe "OrganisationRelationships", type: :feature do
context "when viewing the stock owners page" do
let(:user) { create(:user) }
before do
sign_in user
create(:organisation_relationship, parent_organisation: create(:organisation, name: "Zeta"), child_organisation: user.organisation)
create(:organisation_relationship, parent_organisation: create(:organisation, name: "Alpha"), child_organisation: user.organisation)
create(:organisation_relationship, parent_organisation: create(:organisation, name: "Gamma"), child_organisation: user.organisation)
create(:organisation_relationship, parent_organisation: create(:organisation, name: "ABACUS"), child_organisation: user.organisation)
visit("organisations/#{user.organisation.id}/stock-owners")
end
it "displays stock owners in alphabetical order" do
expect(page).to have_content(/ABACUS.*Alpha.*Gamma.*Zeta/m)
end
end
context "when viewing the managing agents page" do
let(:user) { create(:user) }
before do
sign_in user
create(:organisation_relationship, parent_organisation: user.organisation, child_organisation: create(:organisation, name: "Zeta"))
create(:organisation_relationship, parent_organisation: user.organisation, child_organisation: create(:organisation, name: "Alpha"))
create(:organisation_relationship, parent_organisation: user.organisation, child_organisation: create(:organisation, name: "Gamma"))
create(:organisation_relationship, parent_organisation: user.organisation, child_organisation: create(:organisation, name: "ABACUS"))
visit("organisations/#{user.organisation.id}/managing-agents")
end
it "displays stock owners in alphabetical order" do
expect(page).to have_content(/ABACUS.*Alpha.*Gamma.*Zeta/m)
end
end
end