Browse Source

More test fixes

pull/2825/head
Rachael Booth 1 year ago
parent
commit
66583810dc
  1. 2
      spec/helpers/organisations_helper_spec.rb
  2. 2
      spec/helpers/tab_nav_helper_spec.rb
  3. 6
      spec/requests/organisations_controller_spec.rb

2
spec/helpers/organisations_helper_spec.rb

@ -3,7 +3,7 @@ require "rails_helper"
RSpec.describe OrganisationsHelper do RSpec.describe OrganisationsHelper do
include TagHelper include TagHelper
describe "display_organisation_attributes" do describe "display_organisation_attributes" do
let(:organisation) { create(:organisation) } let(:organisation) { create(:organisation, :la, :holds_own_stock, address_line1: "2 Marsham Street", address_line2: "London", postcode: "SW1P 4DF", housing_registration_no: 1234, organisation_rent_periods: []) }
it "has the correct values" do it "has the correct values" do
expect(display_organisation_attributes(organisation)).to eq( expect(display_organisation_attributes(organisation)).to eq(

2
spec/helpers/tab_nav_helper_spec.rb

@ -15,7 +15,7 @@ RSpec.describe TabNavHelper do
describe "#org_cell" do describe "#org_cell" do
it "returns the users org name and role separated by a newline character" do it "returns the users org name and role separated by a newline character" do
expected_html = "MHCLG\n<span class=\"app-!-colour-muted\">Data provider</span>" expected_html = "#{organisation.name}\n<span class=\"app-!-colour-muted\">Data provider</span>"
expect(org_cell(current_user)).to match(expected_html) expect(org_cell(current_user)).to match(expected_html)
end end
end end

6
spec/requests/organisations_controller_spec.rb

@ -1431,7 +1431,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
context "when a search parameter is passed" do context "when a search parameter is passed" do
let!(:matching_user) { create(:user, organisation:, name: "joe", email: "matching@example.com") } let!(:matching_user) { create(:user, organisation:, name: "abcdefghijklmnopqrstuvwxyz", email: "matching@example.com") }
let(:org_user_count) { User.where(organisation:).count } let(:org_user_count) { User.where(organisation:).count }
before do before do
@ -1439,7 +1439,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
context "when our search string matches case" do context "when our search string matches case" do
let(:search_param) { "joe" } let(:search_param) { "abcdefghijklmnopqrstuvwxyz" }
it "returns only matching results" do it "returns only matching results" do
expect(page).to have_content(matching_user.name) expect(page).to have_content(matching_user.name)
@ -1459,7 +1459,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
context "when we need case insensitive search" do context "when we need case insensitive search" do
let(:search_param) { "Joe" } let(:search_param) { "Abcdefghijklmnopqrstuvwxyz" }
it "returns only matching results" do it "returns only matching results" do
expect(page).to have_content(matching_user.name) expect(page).to have_content(matching_user.name)

Loading…
Cancel
Save