mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 12:42:57 +08:00
6e161d3e75
The most common thing that we do with fab! is: fab!(:thing) { Fabricate(:thing) } This commit adds a shorthand for this which is just simply: fab!(:thing) i.e. If you omit the block, then, by default, you'll get a `Fabricate`d object using the fabricator of the same name.
21 lines
531 B
Ruby
21 lines
531 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe UserStatusSerializer do
|
|
fab!(:user)
|
|
fab!(:user_status) do
|
|
Fabricate(
|
|
:user_status,
|
|
user: user,
|
|
set_at: Time.parse("2023-09-29T02:20:00Z"),
|
|
ends_at: Time.parse("2023-09-29T03:25:00Z"),
|
|
)
|
|
end
|
|
|
|
describe "#ends_at" do
|
|
it "is formatted as a ISO8601 timestamp" do
|
|
serialized = described_class.new(user_status, scope: Guardian.new(user), root: false).as_json
|
|
expect(serialized[:ends_at]).to eq("2023-09-29T03:25:00Z")
|
|
end
|
|
end
|
|
end
|