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

feat: 🎸 プロダクト名を API の戻り値に追加した #96

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion app/controllers/api/v1/gss/characters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def show
else
shown_data = {
gss_name: gss_character.name,
nicknames: gss_character.nicknames.pluck(:name)
nicknames: gss_character.nicknames.pluck(:name),
product_titles: gss_character.product_titles.pluck(:name)
}

render json: shown_data
Expand Down
8 changes: 6 additions & 2 deletions spec/requests/api/v1/gss/characters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@
it { expect(response).to have_http_status(:success) }
end

describe '戻り値の key に "gss_name" と "nicknames" を含むこと' do
describe '戻り値の key' do
before do
get '/api/v1/gss/characters/%E3%83%95%E3%83%AA%E3%83%83%E3%82%AF'
end

it { expect(JSON.parse(response.body).keys).to include 'gss_name', 'nicknames' }
it '期待どおりの値を含むこと' do
expect(JSON.parse(response.body).keys).to eq(
%w[gss_name nicknames product_titles]
)
end
end
end
end