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

Fix: #950 新規アンテナ作成時にリストへ挿入するを設定しても、ホーム挿入になる (LTS) #976

Merged
merged 1 commit into from
Jan 31, 2025
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
2 changes: 1 addition & 1 deletion app/controllers/api/v1/antennas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def show
end

def create
@antenna = Antenna.create!(antenna_params.merge(account: current_account, list_id: 0))
@antenna = Antenna.create!({ list_id: 0 }.merge(antenna_params.merge(account: current_account)))
render json: @antenna, serializer: REST::AntennaSerializer
end

Expand Down
14 changes: 14 additions & 0 deletions spec/requests/api/v1/antennas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@
expect(Antenna.where(account: user.account).count).to eq(1)
end

context 'when specify a list when create new' do
let(:list) { Fabricate(:list, account: user.account, title: 'ohagi') }
let(:params) { { title: 'my antenna', list_id: list.id.to_s, insert_feeds: 'true' } }

it 'returns the new antenna with list', :aggregate_failures do
subject

expect(response).to have_http_status(200)
expect(response.parsed_body).to match(a_hash_including(title: 'my antenna', insert_feeds: true))
expect(response.parsed_body['list']).to match(a_hash_including(id: list.id.to_s, title: list.title))
expect(Antenna.where(account: user.account).count).to eq(1)
end
end

context 'when a title is not given' do
let(:params) { { title: '' } }

Expand Down