Remove 'table' from JSON fields for user and organization (#6179) [deploy]
* Change naming of some fields in feed json * Elimate the 'table' entry to OpenStruct
This commit is contained in:
parent
fa96c114ed
commit
17953a06a5
2 changed files with 5 additions and 4 deletions
|
|
@ -11,8 +11,8 @@ article_methods_to_include = %i[
|
|||
|
||||
json.array!(@stories) do |article|
|
||||
json.extract! article, *article_attributes_to_include
|
||||
json.user article.cached_user
|
||||
json.organization article.cached_organization
|
||||
json.user article.cached_user.as_json["table"]
|
||||
json.organization article.cached_organization.as_json["table"]
|
||||
json.tag_list article.cached_tag_list_array
|
||||
json.extract! article, *article_methods_to_include
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ RSpec.describe "Stories::FeedsIndex", type: :request do
|
|||
|
||||
it "renders article list as json" do
|
||||
get "/stories/feed", headers: headers
|
||||
|
||||
expect(response.content_type).to eq("application/json")
|
||||
expect(response_article["id"]).to eq article.id
|
||||
expect(response_article["title"]).to eq title
|
||||
expect(response_article["user_id"]).to eq user.id
|
||||
expect(response_article["user"]["table"]["name"]).to eq user.name
|
||||
expect(response_article["user"]["name"]).to eq user.name
|
||||
expect(response_article["organization_id"]).to eq organization.id
|
||||
expect(response_article["organization"]["table"]["name"]).to eq organization.name
|
||||
expect(response_article["organization"]["name"]).to eq organization.name
|
||||
expect(response_article["tag_list"]).to eq article.decorate.cached_tag_list_array
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue