From 68d3fe6ae389ba4dfe50aeb1418a73193d8cddd3 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Wed, 19 Jul 2023 12:25:07 +0100 Subject: [PATCH] feat: update tests --- ...tion_helper.rb => organisations_helper.rb} | 2 +- spec/helpers/organisations_helper_spec.rb | 25 +++++++++++++++++++ spec/helpers/tag_helper_spec.rb | 1 + spec/models/organisation_spec.rb | 19 -------------- 4 files changed, 27 insertions(+), 20 deletions(-) rename app/helpers/{organisation_helper.rb => organisations_helper.rb} (97%) create mode 100644 spec/helpers/organisations_helper_spec.rb diff --git a/app/helpers/organisation_helper.rb b/app/helpers/organisations_helper.rb similarity index 97% rename from app/helpers/organisation_helper.rb rename to app/helpers/organisations_helper.rb index 9f95c339d..c40fe263d 100644 --- a/app/helpers/organisation_helper.rb +++ b/app/helpers/organisations_helper.rb @@ -1,4 +1,4 @@ -module OrganisationHelper +module OrganisationsHelper def organisation_header(path, user, current_organisation) if path == "/organisations" "Organisations" diff --git a/spec/helpers/organisations_helper_spec.rb b/spec/helpers/organisations_helper_spec.rb new file mode 100644 index 000000000..0e3867b7d --- /dev/null +++ b/spec/helpers/organisations_helper_spec.rb @@ -0,0 +1,25 @@ +require "rails_helper" + +RSpec.describe OrganisationsHelper do + + include TagHelper + describe "display_organisation_attributes" do + let(:organisation) { create(:organisation) } + + it "does not include data protection agreement" do + expect(display_organisation_attributes(organisation)).to eq( + [{ editable: true, name: "Name", value: "DLUHC" }, + { editable: false, name: "Organisation ID", value: "ORG#{organisation.id}" }, + { editable: true, + name: "Address", + value: "2 Marsham Street\nLondon\nSW1P 4DF" }, + { editable: true, name: "Telephone number", value: nil }, + { editable: false, name: "Type of provider", value: "Local authority" }, + { editable: false, name: "Registration number", value: "1234" }, + { editable: false, format: :bullet, name: "Rent periods", value: %w[All] }, + { editable: false, name: "Owns housing stock", value: "Yes" }, + { editable: false, name: "Status", value: status_tag(organisation.status) }], + ) + end + end +end diff --git a/spec/helpers/tag_helper_spec.rb b/spec/helpers/tag_helper_spec.rb index 3373737de..1886725a2 100644 --- a/spec/helpers/tag_helper_spec.rb +++ b/spec/helpers/tag_helper_spec.rb @@ -20,6 +20,7 @@ RSpec.describe TagHelper do expect(status_tag("activating_soon", "app-tag--small")).to eq("Activating soon") expect(status_tag("reactivating_soon", "app-tag--small")).to eq("Reactivating soon") expect(status_tag("deactivated", "app-tag--small")).to eq("Deactivated") + expect(status_tag("merged", "app-tag--small")).to eq("Merged") end end end diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 0cdfc014e..ad9034d35 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -230,23 +230,4 @@ RSpec.describe Organisation, type: :model do end end end - - describe "display_organisation_attributes" do - let(:organisation) { create(:organisation) } - - it "does not include data protection agreement" do - expect(organisation.display_organisation_attributes).to eq( - [{ editable: true, name: "Name", value: "DLUHC" }, - { editable: false, name: "Organisation ID", value: "ORG#{organisation.id}" }, - { editable: true, - name: "Address", - value: "2 Marsham Street\nLondon\nSW1P 4DF" }, - { editable: true, name: "Telephone number", value: nil }, - { editable: false, name: "Type of provider", value: "Local authority" }, - { editable: false, name: "Registration number", value: "1234" }, - { editable: false, format: :bullet, name: "Rent periods", value: %w[All] }, - { editable: false, name: "Owns housing stock", value: "Yes" }], - ) - end - end end