mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 14:17:57 +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
@ -128,7 +128,7 @@ RSpec.describe ApplicationController do
|
||||
|
||||
describe "#redirect_to_second_factor_if_required" do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:user)
|
||||
|
||||
before do
|
||||
admin # to skip welcome wizard at home page `/`
|
||||
@ -430,8 +430,8 @@ RSpec.describe ApplicationController do
|
||||
let!(:theme) { Fabricate(:theme, user_selectable: true) }
|
||||
let!(:theme2) { Fabricate(:theme, user_selectable: true) }
|
||||
let!(:non_selectable_theme) { Fabricate(:theme, user_selectable: false) }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:user)
|
||||
fab!(:admin)
|
||||
|
||||
before { sign_in(user) }
|
||||
|
||||
@ -1061,7 +1061,7 @@ RSpec.describe ApplicationController do
|
||||
end
|
||||
|
||||
describe "Discourse-Rate-Limit-Error-Code header" do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:admin)
|
||||
|
||||
before { RateLimiter.enable }
|
||||
|
||||
@ -1152,7 +1152,7 @@ RSpec.describe ApplicationController do
|
||||
describe "#banner_json" do
|
||||
let(:admin) { Fabricate(:admin) }
|
||||
let(:user) { Fabricate(:user) }
|
||||
fab!(:banner_topic) { Fabricate(:banner_topic) }
|
||||
fab!(:banner_topic)
|
||||
fab!(:p1) { Fabricate(:post, topic: banner_topic, raw: "A banner topic") }
|
||||
|
||||
before do
|
||||
@ -1252,7 +1252,7 @@ RSpec.describe ApplicationController do
|
||||
end
|
||||
|
||||
context "when user is regular user" do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:user)
|
||||
|
||||
before { sign_in(user) }
|
||||
|
||||
|
Reference in New Issue
Block a user