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
|
@ -19,10 +19,13 @@ RSpec.describe REST::AnnouncementSerializer do
|
|||
|
||||
context 'when date fields are populated' do
|
||||
it 'parses as RFC 3339 datetime' do
|
||||
expect { DateTime.rfc3339(subject['starts_at']) }.to_not raise_error
|
||||
expect { DateTime.rfc3339(subject['ends_at']) }.to_not raise_error
|
||||
expect { DateTime.rfc3339(subject['published_at']) }.to_not raise_error
|
||||
expect { DateTime.rfc3339(subject['updated_at']) }.to_not raise_error
|
||||
expect(subject)
|
||||
.to include(
|
||||
'starts_at' => match_api_datetime_format,
|
||||
'ends_at' => match_api_datetime_format,
|
||||
'published_at' => match_api_datetime_format,
|
||||
'updated_at' => match_api_datetime_format
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue