From 893151d76b5f35ec03267ea6320e6b938c249ef0 Mon Sep 17 00:00:00 2001 From: Mac Siri Date: Mon, 21 Dec 2020 07:20:16 -0500 Subject: [PATCH] Fix API's broken organization's image (#11981) --- app/controllers/api/v0/organizations_controller.rb | 2 +- spec/requests/api/v0/organizations_spec.rb | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/v0/organizations_controller.rb b/app/controllers/api/v0/organizations_controller.rb index bd8b4191f..5447a9e72 100644 --- a/app/controllers/api/v0/organizations_controller.rb +++ b/app/controllers/api/v0/organizations_controller.rb @@ -4,7 +4,7 @@ module Api before_action :find_organization, only: %i[users listings] SHOW_ATTRIBUTES_FOR_SERIALIZATION = %i[ - username name summary twitter_username github_username url + id username name summary twitter_username github_username url location created_at profile_image tech_stack tag_line story ].freeze private_constant :SHOW_ATTRIBUTES_FOR_SERIALIZATION diff --git a/spec/requests/api/v0/organizations_spec.rb b/spec/requests/api/v0/organizations_spec.rb index 32d67a13f..48595e822 100644 --- a/spec/requests/api/v0/organizations_spec.rb +++ b/spec/requests/api/v0/organizations_spec.rb @@ -13,16 +13,19 @@ RSpec.describe "Api::V0::Organizations", type: :request do get api_organization_path(organization.username) response_organization = response.parsed_body - - expect(response_organization["type_of"]).to eq("organization") + expect(response_organization).to include( + { + "profile_image" => organization.profile_image_url, + "type_of" => "organization", + "joined_at" => organization.created_at.utc.iso8601 + }, + ) %w[ username name summary twitter_username github_username url location tech_stack tag_line story ].each do |attr| expect(response_organization[attr]).to eq(organization.public_send(attr)) end - - expect(response_organization["joined_at"]).to eq(organization.created_at.utc.iso8601) end end