mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +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,10 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Admin::EmailController do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:moderator) { Fabricate(:moderator) }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:email_log) { Fabricate(:email_log) }
|
||||
fab!(:admin)
|
||||
fab!(:moderator)
|
||||
fab!(:user)
|
||||
fab!(:email_log)
|
||||
|
||||
describe "#index" do
|
||||
context "when logged in as an admin" do
|
||||
@ -48,7 +48,7 @@ RSpec.describe Admin::EmailController do
|
||||
end
|
||||
|
||||
describe "#sent" do
|
||||
fab!(:post) { Fabricate(:post) }
|
||||
fab!(:post)
|
||||
fab!(:email_log) { Fabricate(:email_log, post: post) }
|
||||
|
||||
let(:post_reply_key) { Fabricate(:post_reply_key, post: post, user: email_log.user) }
|
||||
@ -137,7 +137,7 @@ RSpec.describe Admin::EmailController do
|
||||
end
|
||||
|
||||
describe "#skipped" do
|
||||
# fab!(:user) { Fabricate(:user) }
|
||||
# fab!(:user)
|
||||
fab!(:log1) { Fabricate(:skipped_email_log, user: user, created_at: 20.minutes.ago) }
|
||||
fab!(:log2) { Fabricate(:skipped_email_log, created_at: 10.minutes.ago) }
|
||||
|
||||
@ -213,7 +213,7 @@ RSpec.describe Admin::EmailController do
|
||||
|
||||
context "with SiteSetting.disable_emails" do
|
||||
fab!(:eviltrout) { Fabricate(:evil_trout) }
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:admin)
|
||||
|
||||
it 'bypasses disable when setting is "yes"' do
|
||||
SiteSetting.disable_emails = "yes"
|
||||
|
Reference in New Issue
Block a user