mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Allow fab! without block (#24314)
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.
This commit is contained in:

committed by
GitHub

parent
d91456fd53
commit
6e161d3e75
@ -9,7 +9,7 @@ RSpec.describe Email::Processor do
|
||||
|
||||
context "when reply via email is too short" do
|
||||
let(:mail) { file_from_fixtures("chinese_reply.eml", "emails").read }
|
||||
fab!(:post) { Fabricate(:post) }
|
||||
fab!(:post)
|
||||
fab!(:user) { Fabricate(:user, email: "discourse@bar.com") }
|
||||
|
||||
fab!(:post_reply_key) do
|
||||
@ -177,7 +177,7 @@ RSpec.describe Email::Processor do
|
||||
|
||||
describe "when replying to a post that is too old" do
|
||||
fab!(:user) { Fabricate(:user, email: "discourse@bar.com") }
|
||||
fab!(:topic) { Fabricate(:topic) }
|
||||
fab!(:topic)
|
||||
fab!(:post) { Fabricate(:post, topic: topic, created_at: 3.days.ago) }
|
||||
let(:mail) do
|
||||
file_from_fixtures("old_destination.eml", "emails")
|
||||
|
Reference in New Issue
Block a user