A platform for community discussion. Free, open, simple.
Prefabricate admin in wizard_spec.rb
Daniel Waterworth6e11ae06d8d7
diff --git a/spec/components/wizard/wizard_spec.rb b/spec/components/wizard/wizard_spec.rbindex f0b543e9bef..bf5490adefd 100644--- a/spec/components/wizard/wizard_spec.rb+++ b/spec/components/wizard/wizard_spec.rb@@ -4,6 +4,8 @@ require 'rails_helper'require 'wizard'describe Wizard do+ fab!(:admin) { Fabricate(:admin) }+before doSiteSetting.wizard_enabled = trueend@@ -118,19 +120,16 @@ describe Wizard doit "it's false when the wizard is disabled" doSiteSetting.wizard_enabled = false- admin = Fabricate(:admin)expect(build_simple(admin).requires_completion?).to eq(false)endit "its false when the wizard is bypassed" doSiteSetting.bypass_wizard_check = true- admin = Fabricate(:admin)expect(build_simple(admin).requires_completion?).to eq(false)endit "its automatically bypasses after you reach topic limit" doFabricate(:topic)- admin = Fabricate(:admin)wizard = build_simple(admin)wizard.max_topics_to_require_completion = Topic.count - 1@@ -140,7 +139,6 @@ describe Wizard doendit "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 doendit "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.updateexpect(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