mirror of
https://github.com/discourse/discourse.git
synced 2025-03-01 00:39:17 +00:00
Prefabricate admin in wizard_spec.rb
This commit is contained in:
parent
bc4748571e
commit
6e11ae06d8
@ -4,6 +4,8 @@ require 'rails_helper'
|
||||
require 'wizard'
|
||||
|
||||
describe Wizard do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
|
||||
before do
|
||||
SiteSetting.wizard_enabled = true
|
||||
end
|
||||
@ -118,19 +120,16 @@ describe Wizard do
|
||||
|
||||
it "it's false when the wizard is disabled" do
|
||||
SiteSetting.wizard_enabled = false
|
||||
admin = Fabricate(:admin)
|
||||
expect(build_simple(admin).requires_completion?).to eq(false)
|
||||
end
|
||||
|
||||
it "its false when the wizard is bypassed" do
|
||||
SiteSetting.bypass_wizard_check = true
|
||||
admin = Fabricate(:admin)
|
||||
expect(build_simple(admin).requires_completion?).to eq(false)
|
||||
end
|
||||
|
||||
it "its automatically bypasses after you reach topic limit" do
|
||||
Fabricate(:topic)
|
||||
admin = Fabricate(:admin)
|
||||
wizard = build_simple(admin)
|
||||
|
||||
wizard.max_topics_to_require_completion = Topic.count - 1
|
||||
@ -140,7 +139,6 @@ describe Wizard do
|
||||
end
|
||||
|
||||
it "it's true for the first admin who logs in" do
|
||||
admin = Fabricate(:admin)
|
||||
second_admin = Fabricate(:admin)
|
||||
UserAuthToken.generate!(user_id: second_admin.id)
|
||||
|
||||
@ -149,14 +147,14 @@ describe Wizard do
|
||||
end
|
||||
|
||||
it "is false for staff when complete" do
|
||||
wizard = build_simple(Fabricate(:admin))
|
||||
wizard = build_simple(admin)
|
||||
updater = wizard.create_updater('simple', name: 'Evil Trout')
|
||||
updater.update
|
||||
|
||||
expect(wizard.requires_completion?).to eq(false)
|
||||
|
||||
# It's also false for another user
|
||||
wizard = build_simple(Fabricate(:admin))
|
||||
wizard = build_simple(admin)
|
||||
expect(wizard.requires_completion?).to eq(false)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user