Fix application_id erroneous inclusion in ScheduledStatusSerializer (#33159)

This commit is contained in:
Matt Jankowski 2024-12-17 03:54:07 -05:00 committed by GitHub
parent 3ac478472e
commit a7673d361d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View File

@ -10,6 +10,6 @@ class REST::ScheduledStatusSerializer < ActiveModel::Serializer
end
def params
object.params.without(:application_id)
object.params.without('application_id')
end
end

View File

@ -11,11 +11,18 @@ RSpec.describe REST::ScheduledStatusSerializer do
end
let(:account) { Fabricate(:account) }
let(:scheduled_status) { Fabricate.build(:scheduled_status, scheduled_at: 4.minutes.from_now, account: account) }
let(:scheduled_status) { Fabricate.build(:scheduled_status, scheduled_at: 4.minutes.from_now, account: account, params: { application_id: 123 }) }
context 'with scheduled_at' do
describe 'serialization' do
it 'is serialized as RFC 3339 datetime' do
expect { DateTime.rfc3339(subject['scheduled_at']) }.to_not raise_error
expect { DateTime.rfc3339(subject['scheduled_at']) }
.to_not raise_error
end
it 'returns expected values and removes application_id from params' do
expect(subject.deep_symbolize_keys)
.to include(scheduled_at: be_a(String))
.and include(params: not_include(:application_id))
end
end
end