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
|
@ -6,14 +6,16 @@ RSpec.describe REST::AccountSerializer::FieldSerializer do
|
|||
subject { serialized_record_json(field, described_class) }
|
||||
|
||||
let(:default_datetime) { DateTime.new(2024, 11, 28, 16, 20, 0) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:account) { user.account }
|
||||
let(:account) { Fabricate.build :account }
|
||||
|
||||
context 'when verified_at is populated' do
|
||||
let(:field) { Account::Field.new(account, 'name' => 'Foo', 'value' => 'Bar', 'verified_at' => default_datetime) }
|
||||
|
||||
it 'parses as RFC 3339 datetime' do
|
||||
expect { DateTime.rfc3339(subject['verified_at']) }.to_not raise_error
|
||||
expect(subject)
|
||||
.to include(
|
||||
'verified_at' => match_api_datetime_format
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue