diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb index e7370dc8212..486bfd933f2 100644 --- a/spec/fabricators/user_fabricator.rb +++ b/spec/fabricators/user_fabricator.rb @@ -72,6 +72,7 @@ Fabricator(:admin, from: :user) do username { sequence(:username) { |i| "anne#{i}" } } email { sequence(:email) { |i| "anne#{i}@discourse.org" } } admin true + trust_level TrustLevel[4] after_create do |user| user.group_users << Fabricate(:group_user, user: user, group: Group[:admins]) diff --git a/spec/lib/cooked_post_processor_spec.rb b/spec/lib/cooked_post_processor_spec.rb index a78e4d1531e..f13fe03585f 100644 --- a/spec/lib/cooked_post_processor_spec.rb +++ b/spec/lib/cooked_post_processor_spec.rb @@ -185,11 +185,9 @@ RSpec.describe CookedPostProcessor do - #{url_with_query_param} RAW - let(:staff_post) do - Fabricate(:post, user: Fabricate(:admin, refresh_auto_groups: true), raw: <<~RAW) + let(:staff_post) { Fabricate(:post, user: Fabricate(:admin), raw: <<~RAW) } This is a #{url_with_path} topic RAW - end before do urls.each do |url| diff --git a/spec/lib/guardian/topic_guardian_spec.rb b/spec/lib/guardian/topic_guardian_spec.rb index 66d4a577868..7c5bd92315b 100644 --- a/spec/lib/guardian/topic_guardian_spec.rb +++ b/spec/lib/guardian/topic_guardian_spec.rb @@ -2,7 +2,7 @@ RSpec.describe TopicGuardian do fab!(:user) { Fabricate(:user, refresh_auto_groups: true) } - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) fab!(:tl3_user) { Fabricate(:trust_level_3) } fab!(:tl4_user) { Fabricate(:trust_level_4) } fab!(:moderator) diff --git a/spec/lib/guardian_spec.rb b/spec/lib/guardian_spec.rb index 82d01611a53..cae76cdaba6 100644 --- a/spec/lib/guardian_spec.rb +++ b/spec/lib/guardian_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Guardian do fab!(:member) { Fabricate(:user) } fab!(:owner) { Fabricate(:user) } fab!(:moderator) { Fabricate(:moderator, refresh_auto_groups: true) } - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) fab!(:anonymous_user) { Fabricate(:anonymous) } fab!(:staff_post) { Fabricate(:post, user: moderator) } fab!(:group) diff --git a/spec/lib/post_action_creator_spec.rb b/spec/lib/post_action_creator_spec.rb index 471bd6ceb5a..5dd003871a6 100644 --- a/spec/lib/post_action_creator_spec.rb +++ b/spec/lib/post_action_creator_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe PostActionCreator do - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) fab!(:user) { Fabricate(:user, refresh_auto_groups: true) } fab!(:post) let(:like_type_id) { PostActionType.types[:like] } diff --git a/spec/lib/post_creator_spec.rb b/spec/lib/post_creator_spec.rb index b7ac5dd2146..d8812785aa1 100644 --- a/spec/lib/post_creator_spec.rb +++ b/spec/lib/post_creator_spec.rb @@ -5,7 +5,7 @@ require "topic_subtype" RSpec.describe PostCreator do fab!(:user) { Fabricate(:user, refresh_auto_groups: true) } - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) fab!(:coding_horror) { Fabricate(:coding_horror, refresh_auto_groups: true) } fab!(:evil_trout) { Fabricate(:evil_trout, refresh_auto_groups: true) } let(:topic) { Fabricate(:topic, user: user) } diff --git a/spec/lib/post_destroyer_spec.rb b/spec/lib/post_destroyer_spec.rb index 4ae3f2a446e..dcd0e1d8eec 100644 --- a/spec/lib/post_destroyer_spec.rb +++ b/spec/lib/post_destroyer_spec.rb @@ -4,7 +4,7 @@ RSpec.describe PostDestroyer do before { UserActionManager.enable } fab!(:moderator) { Fabricate(:moderator, refresh_auto_groups: true) } - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) fab!(:coding_horror) { Fabricate(:coding_horror, refresh_auto_groups: true) } let(:post) { create_post } diff --git a/spec/lib/post_revisor_spec.rb b/spec/lib/post_revisor_spec.rb index 7c5a9fcdc38..ffff3bcfdc7 100644 --- a/spec/lib/post_revisor_spec.rb +++ b/spec/lib/post_revisor_spec.rb @@ -854,7 +854,7 @@ RSpec.describe PostRevisor do end describe "admin editing a new user's post" do - fab!(:changed_by) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:changed_by) { Fabricate(:admin) } before do SiteSetting.newuser_max_embedded_media = 0 diff --git a/spec/lib/topic_creator_spec.rb b/spec/lib/topic_creator_spec.rb index 2c9bb9721bc..556aa63a5f8 100644 --- a/spec/lib/topic_creator_spec.rb +++ b/spec/lib/topic_creator_spec.rb @@ -3,7 +3,7 @@ RSpec.describe TopicCreator do fab!(:user) { Fabricate(:user, trust_level: TrustLevel[2]) } fab!(:moderator) - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) let(:valid_attrs) { Fabricate.attributes_for(:topic) } let(:pm_valid_attrs) do diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 68c56594095..980879ff255 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -507,7 +507,7 @@ RSpec.describe Group do g = Group[:trust_level_2] expect(g.human_users.count).to eq(g.user_count) - expect(g.human_users).to contain_exactly(user) + expect(g.human_users).to contain_exactly(admin, user) end it "can set members via usernames helper" do diff --git a/spec/models/post_mover_spec.rb b/spec/models/post_mover_spec.rb index 140a41388b0..52c3c54f2bb 100644 --- a/spec/models/post_mover_spec.rb +++ b/spec/models/post_mover_spec.rb @@ -22,7 +22,7 @@ RSpec.describe PostMover do context "with topics" do before { freeze_time } - fab!(:user) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:user) { Fabricate(:admin) } fab!(:another_user) { evil_trout } fab!(:category) { Fabricate(:category, user: user) } fab!(:topic) { Fabricate(:topic, user: user, created_at: 4.hours.ago) } diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb index e0f582734bc..798018731ac 100644 --- a/spec/requests/topics_controller_spec.rb +++ b/spec/requests/topics_controller_spec.rb @@ -17,7 +17,7 @@ RSpec.describe TopicsController do fab!(:post_author5) { Fabricate(:user) } fab!(:post_author6) { Fabricate(:user) } fab!(:moderator) - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) fab!(:trust_level_0) fab!(:trust_level_1) fab!(:trust_level_4) diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 9a01baedd1b..348d3503403 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -11,7 +11,7 @@ RSpec.describe UsersController do fab!(:invitee) { Fabricate(:user) } fab!(:inviter) { Fabricate(:user) } - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) fab!(:moderator) fab!(:inactive_user) diff --git a/spec/serializers/topic_view_details_serializer_spec.rb b/spec/serializers/topic_view_details_serializer_spec.rb index 482e2a0a6ad..e9a9c4bcbf8 100644 --- a/spec/serializers/topic_view_details_serializer_spec.rb +++ b/spec/serializers/topic_view_details_serializer_spec.rb @@ -36,7 +36,7 @@ RSpec.describe TopicViewDetailsSerializer do before { SiteSetting.can_permanently_delete = true } it "is true for admins" do - admin = Fabricate(:admin, refresh_auto_groups: true) + admin = Fabricate(:admin) serializer = described_class.new(TopicView.new(post.topic, admin), scope: Guardian.new(admin)) expect(serializer.as_json.dig(:topic_view_details, :can_permanently_delete)).to eq(true) diff --git a/spec/serializers/topic_view_serializer_spec.rb b/spec/serializers/topic_view_serializer_spec.rb index a232c0787ec..a54fcf6b81c 100644 --- a/spec/serializers/topic_view_serializer_spec.rb +++ b/spec/serializers/topic_view_serializer_spec.rb @@ -14,7 +14,7 @@ RSpec.describe TopicViewSerializer do fab!(:topic) fab!(:user) { Fabricate(:user, refresh_auto_groups: true) } fab!(:user_2) { Fabricate(:user) } - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) describe "#featured_link and #featured_link_root_domain" do fab!(:featured_link) { "http://meta.discourse.org" } diff --git a/spec/services/user_destroyer_spec.rb b/spec/services/user_destroyer_spec.rb index eafc268cd03..36aaa5b1889 100644 --- a/spec/services/user_destroyer_spec.rb +++ b/spec/services/user_destroyer_spec.rb @@ -2,7 +2,7 @@ RSpec.describe UserDestroyer do fab!(:user) { Fabricate(:user_with_secondary_email, refresh_auto_groups: true) } - fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:admin) describe ".new" do it "raises an error when user is nil" do diff --git a/spec/system/flagging_post_spec.rb b/spec/system/flagging_post_spec.rb index 978b9ef6719..50cb7ebbb91 100644 --- a/spec/system/flagging_post_spec.rb +++ b/spec/system/flagging_post_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true describe "Flagging post", type: :system do - fab!(:current_user) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:current_user) { Fabricate(:admin) } fab!(:first_post) { Fabricate(:post) } fab!(:post_to_flag) { Fabricate(:post, topic: first_post.topic) }