Skip to content

Commit 60665db

Browse files
authored
feat: 🎸 プロダクト名を API の戻り値に追加した (#96)
1 parent 17aa634 commit 60665db

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/controllers/api/v1/gss/characters_controller.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ def show
1616
else
1717
shown_data = {
1818
gss_name: gss_character.name,
19-
nicknames: gss_character.nicknames.pluck(:name)
19+
nicknames: gss_character.nicknames.pluck(:name),
20+
product_titles: gss_character.product_titles.pluck(:name)
2021
}
2122

2223
render json: shown_data

spec/requests/api/v1/gss/characters_spec.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@
2828
it { expect(response).to have_http_status(:success) }
2929
end
3030

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

36-
it { expect(JSON.parse(response.body).keys).to include 'gss_name', 'nicknames' }
36+
it '期待どおりの値を含むこと' do
37+
expect(JSON.parse(response.body).keys).to eq(
38+
%w[gss_name nicknames product_titles]
39+
)
40+
end
3741
end
3842
end
3943
end

0 commit comments

Comments
 (0)