Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spacing to WorldWideOrganisation descriptions #2890

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/presenters/worldwide_organisation_presenter.rb
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ def person_in_primary_role
href: person["web_url"],
image_url: person["details"]["image"]["url"],
image_alt: person["details"]["image"]["alt_text"],
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join,
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join(", "),
}
end

@@ -67,7 +67,7 @@ def people_in_non_primary_roles
{
name: person["title"],
href: person["web_url"],
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join,
description: current_roles.map { |role_app| role_app.dig("links", "role").first["title"] }.join(", "),
}
end
end
10 changes: 10 additions & 0 deletions test/presenters/worldwide_organisation_presenter_test.rb
Original file line number Diff line number Diff line change
@@ -5,6 +5,16 @@ def schema_name
"worldwide_organisation"
end

test "description of primary_role_person should have spaces between roles" do
presenter = create_presenter(WorldwideOrganisationPresenter, content_item: { "links" => { "primary_role_person" => [{ "details" => { "image" => {} }, "links" => { "role_appointments" => [{ "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 1" }] } }, { "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 2" }] } }] } }] } })
assert_equal "Example Role 1, Example Role 2", presenter.person_in_primary_role[:description]
end

test "description of people_in_non_primary_roles should have spaces between roles" do
presenter = create_presenter(WorldwideOrganisationPresenter, content_item: { "links" => { "secondary_role_person" => [{ "details" => { "image" => {} }, "links" => { "role_appointments" => [{ "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 1" }] } }, { "details" => { "current" => true }, "links" => { "role" => [{ "title" => "Example Role 2" }] } }] } }] } })
assert_equal "Example Role 1, Example Role 2", presenter.people_in_non_primary_roles.first[:description]
end

test "#title returns the title" do
assert_equal schema_item["title"], presented_item.title
end