mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 04:19:01 +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
@ -1,9 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe UserBadgesController do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:badge) { Fabricate(:badge) }
|
||||
fab!(:user)
|
||||
fab!(:admin)
|
||||
fab!(:badge)
|
||||
|
||||
describe "#index" do
|
||||
fab!(:badge) { Fabricate(:badge, target_posts: true, show_posts: false) }
|
||||
@ -42,11 +42,11 @@ RSpec.describe UserBadgesController do
|
||||
end
|
||||
|
||||
describe "#index" do
|
||||
fab!(:post) { Fabricate(:post) }
|
||||
fab!(:private_message_post) { Fabricate(:private_message_post) }
|
||||
fab!(:post)
|
||||
fab!(:private_message_post)
|
||||
let(:topic) { post.topic }
|
||||
let(:private_message_topic) { private_message_post.topic }
|
||||
fab!(:group) { Fabricate(:group) }
|
||||
fab!(:group)
|
||||
fab!(:private_category) { Fabricate(:private_category, group: group) }
|
||||
fab!(:restricted_topic) { Fabricate(:topic, category: private_category) }
|
||||
fab!(:restricted_post) { Fabricate(:post, topic: restricted_topic) }
|
||||
|
Reference in New Issue
Block a user