Browse Source

feat: update tests

pull/1787/head
natdeanlewissoftwire 3 years ago
parent
commit
68d3fe6ae3
  1. 2
      app/helpers/organisations_helper.rb
  2. 25
      spec/helpers/organisations_helper_spec.rb
  3. 1
      spec/helpers/tag_helper_spec.rb
  4. 19
      spec/models/organisation_spec.rb

2
app/helpers/organisation_helper.rb → app/helpers/organisations_helper.rb

@ -1,4 +1,4 @@
module OrganisationHelper module OrganisationsHelper
def organisation_header(path, user, current_organisation) def organisation_header(path, user, current_organisation)
if path == "/organisations" if path == "/organisations"
"Organisations" "Organisations"

25
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

1
spec/helpers/tag_helper_spec.rb

@ -20,6 +20,7 @@ RSpec.describe TagHelper do
expect(status_tag("activating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Activating soon</strong>") expect(status_tag("activating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Activating soon</strong>")
expect(status_tag("reactivating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Reactivating soon</strong>") expect(status_tag("reactivating_soon", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--blue app-tag--small\">Reactivating soon</strong>")
expect(status_tag("deactivated", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Deactivated</strong>") expect(status_tag("deactivated", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--grey app-tag--small\">Deactivated</strong>")
expect(status_tag("merged", "app-tag--small")).to eq("<strong class=\"govuk-tag govuk-tag--green app-tag--small\">Merged</strong>")
end end
end end
end end

19
spec/models/organisation_spec.rb

@ -230,23 +230,4 @@ RSpec.describe Organisation, type: :model do
end end
end 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 end

Loading…
Cancel
Save