Add API datetime/format matcher for serialization specs, reduce factories (#33325)
This commit is contained in:
parent
978142ac9e
commit
ce5c33c65d
26 changed files with 127 additions and 96 deletions
|
@ -10,19 +10,15 @@ 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, params: { application_id: 123 }) }
|
||||
let(:scheduled_status) { Fabricate.build(:scheduled_status, scheduled_at: 4.minutes.from_now, params: { application_id: 123 }) }
|
||||
|
||||
describe 'serialization' do
|
||||
it 'is serialized as RFC 3339 datetime' do
|
||||
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))
|
||||
.to include(
|
||||
scheduled_at: be_a(String).and(match_api_datetime_format),
|
||||
params: not_include(:application_id)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue