diff --git a/spec/discourse_code_review/lib/github_pr_syncer_spec.rb b/spec/discourse_code_review/lib/github_pr_syncer_spec.rb index e1cd315..6e9f4a3 100644 --- a/spec/discourse_code_review/lib/github_pr_syncer_spec.rb +++ b/spec/discourse_code_review/lib/github_pr_syncer_spec.rb @@ -89,6 +89,9 @@ def get_user_email(github_login) ) end + before { User.set_callback(:create, :after, :ensure_in_trust_level_group) } + after { User.skip_callback(:create, :after, :ensure_in_trust_level_group) } + describe "#sync_pull_request" do context "when there are no events" do let!(:syncer) do diff --git a/spec/discourse_code_review/lib/importer_spec.rb b/spec/discourse_code_review/lib/importer_spec.rb index 5330b27..b0eee4b 100644 --- a/spec/discourse_code_review/lib/importer_spec.rb +++ b/spec/discourse_code_review/lib/importer_spec.rb @@ -11,6 +11,9 @@ def first_post_of(topic_id) let(:parent_category) { Fabricate(:category) } let(:repo) { GithubRepo.new("discourse/discourse", Octokit::Client.new, nil, repo_id: 24) } + before { User.set_callback(:create, :after, :ensure_in_trust_level_group) } + after { User.skip_callback(:create, :after, :ensure_in_trust_level_group) } + it "creates categories with a description" do category = Category.find_by(id: Importer.new(repo).category_id) diff --git a/spec/discourse_code_review/lib/state/commit_topics_spec.rb b/spec/discourse_code_review/lib/state/commit_topics_spec.rb index 6b651cc..5f737d1 100644 --- a/spec/discourse_code_review/lib/state/commit_topics_spec.rb +++ b/spec/discourse_code_review/lib/state/commit_topics_spec.rb @@ -41,7 +41,7 @@ module DiscourseCodeReview end describe "#ensure_commit" do - fab!(:user) { Fabricate(:user) } + fab!(:user) { Fabricate(:user, refresh_auto_groups: true) } fab!(:category) { Fabricate(:category) } it "can handle commits without message" do diff --git a/spec/jobs/code_review_sync_commits_spec.rb b/spec/jobs/code_review_sync_commits_spec.rb index 74ada21..bf3dc9b 100644 --- a/spec/jobs/code_review_sync_commits_spec.rb +++ b/spec/jobs/code_review_sync_commits_spec.rb @@ -40,8 +40,12 @@ comment: { }, ) + + User.set_callback(:create, :after, :ensure_in_trust_level_group) end + after { User.skip_callback(:create, :after, :ensure_in_trust_level_group) } + it "creates a commit topic and a category topic, with a full sha in the first post" do expect { described_class.new.execute(repo_name: "10xninjarockstar/ultimatetodolist", repo_id: 24) diff --git a/spec/requests/discourse_code_review/code_review_controller_spec.rb b/spec/requests/discourse_code_review/code_review_controller_spec.rb index cfa6f35..a5475b8 100644 --- a/spec/requests/discourse_code_review/code_review_controller_spec.rb +++ b/spec/requests/discourse_code_review/code_review_controller_spec.rb @@ -99,8 +99,8 @@ end context "when signed in as an admin" do - fab!(:signed_in_user) { Fabricate(:admin) } - fab!(:another_admin) { Fabricate(:admin) } + fab!(:signed_in_user) { Fabricate(:admin, refresh_auto_groups: true) } + fab!(:another_admin) { Fabricate(:admin, refresh_auto_groups: true) } before do SiteSetting.code_review_enabled = true @@ -181,7 +181,7 @@ end it "skips commits from muted categories" do - admin2 = Fabricate(:admin) + admin2 = Fabricate(:admin, refresh_auto_groups: true) muted_category = Fabricate(:category) @@ -220,7 +220,7 @@ create_post( raw: "this is an old commit", tags: [SiteSetting.code_review_pending_tag], - user: Fabricate(:admin), + user: Fabricate(:admin, refresh_auto_groups: true), ) commit = @@ -430,7 +430,7 @@ end describe ".render_next_topic" do - let(:other_user) { Fabricate(:admin) } + let(:other_user) { Fabricate(:admin, refresh_auto_groups: true) } it "prefers unread topics over read ones" do commit =