Fix a spec failing because of the daylight savings (#18661)

This commit is contained in:
Anna Buianova 2022-10-31 17:23:09 +03:00 committed by GitHub
parent cc4f3556cf
commit f3d2d1b156
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -200,7 +200,9 @@ RSpec.describe "ArticlesUpdate", type: :request do
put "/articles/#{draft.id}", params: { article: attributes }
draft.reload
published_at_utc = draft.published_at.in_time_zone("UTC").strftime("%m/%d/%Y %H:%M")
expect(published_at_utc).to eq("#{tomorrow.strftime('%m/%d/%Y')} 23:00")
draft.published_at.in_time_zone(attributes[:timezone])
expected_time = "#{(tomorrow + 1.day).strftime('%m/%d/%Y')} 00:00"
expect(published_at_utc).to eq(expected_time)
expect(draft.published).to be true
end