More prefabrication

More prefabrication

diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb
index c176b46..3d60cc3 100644
--- a/spec/models/category_spec.rb
+++ b/spec/models/category_spec.rb
@@ -52,11 +52,11 @@ describe Category do
   end
 
   describe "#review_group_id" do
-    let(:group) { Fabricate(:group) }
-    let(:category) { Fabricate(:category, reviewable_by_group: group) }
-    let(:topic) { Fabricate(:topic, category: category) }
-    let(:post) { Fabricate(:post, topic: topic) }
-    let(:user) { Fabricate(:user) }
+    fab!(:group) { Fabricate(:group) }
+    fab!(:category) { Fabricate(:category, reviewable_by_group: group) }
+    fab!(:topic) { Fabricate(:topic, category: category) }
+    fab!(:post) { Fabricate(:post, topic: topic) }
+    fab!(:user) { Fabricate(:user) }
 
     it "will add the group to the reviewable" do
       SiteSetting.enable_category_group_review = true
diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rb
index 678b87e..eaecfd5 100644
--- a/spec/models/invite_spec.rb
+++ b/spec/models/invite_spec.rb
@@ -90,7 +90,7 @@ describe Invite do
         end
 
         context 'when added by another user' do
-          let(:coding_horror) { Fabricate(:coding_horror) }
+          fab!(:coding_horror) { Fabricate(:coding_horror) }
 
           let(:new_invite) do
             Invite.invite_by_email(iceking, coding_horror, topic)
@@ -199,7 +199,7 @@ describe Invite do
 
   context '.redeem' do
 
-    let!(:invite) { Fabricate(:invite) }
+    fab!(:invite) { Fabricate(:invite) }
 
     it 'creates a notification for the invitee' do
       expect { invite.redeem }.to change(Notification, :count)
diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb
index ffead07..99a4b48 100644
--- a/spec/models/notification_spec.rb
+++ b/spec/models/notification_spec.rb
@@ -89,7 +89,7 @@ describe Notification do
 
   describe 'unread counts' do
 
-    let(:user) { Fabricate(:user) }
+    fab!(:user) { Fabricate(:user) }
 
     context 'a regular notification' do
       it 'increases unread_notifications' do
@@ -254,7 +254,7 @@ describe Notification do
 
   describe '.filter_by_display_username_and_type' do
     let(:post) { Fabricate(:post) }
-    let(:user) { Fabricate(:user) }
+    fab!(:user) { Fabricate(:user) }
 
     before do
       PostActionNotifier.enable
@@ -287,7 +287,7 @@ end
 # pulling this out cause I don't want an observer
 describe Notification do
   describe '#recent_report' do
-    let(:user) { Fabricate(:user) }
+    fab!(:user) { Fabricate(:user) }
     let(:post) { Fabricate(:post) }
 
     def fab(type, read)
diff --git a/spec/requests/metadata_controller_spec.rb b/spec/requests/metadata_controller_spec.rb
index 0995078..473d65d 100644
--- a/spec/requests/metadata_controller_spec.rb
+++ b/spec/requests/metadata_controller_spec.rb
@@ -85,7 +85,7 @@ RSpec.describe MetadataController do
   end
 
   describe 'opensearch.xml' do
-    let(:upload) { Fabricate(:upload) }
+    fab!(:upload) { Fabricate(:upload) }
 
     it 'returns the right output' do
       title = 'MyApp'
diff --git a/spec/requests/post_action_users_controller_spec.rb b/spec/requests/post_action_users_controller_spec.rb
index e794389..4b6f637 100644
--- a/spec/requests/post_action_users_controller_spec.rb
+++ b/spec/requests/post_action_users_controller_spec.rb
@@ -3,7 +3,8 @@
 require 'rails_helper'
 
 describe PostActionUsersController do
-  let(:post) { Fabricate(:post, user: sign_in(Fabricate(:user))) }
+  fab!(:user) { Fabricate(:user) }
+  let(:post) { Fabricate(:post, user: sign_in(user)) }
 
   context 'with render' do
     it 'always allows you to see your own actions' do
diff --git a/spec/requests/reviewable_claimed_topics_controller_spec.rb b/spec/requests/reviewable_claimed_topics_controller_spec.rb
index 01df86f..134ba39 100644
--- a/spec/requests/reviewable_claimed_topics_controller_spec.rb
+++ b/spec/requests/reviewable_claimed_topics_controller_spec.rb
@@ -6,7 +6,7 @@ describe ReviewableClaimedTopicsController do
   fab!(:moderator) { Fabricate(:moderator) }
 
   describe '#create' do
-    let(:topic) { Fabricate(:topic) }
+    fab!(:topic) { Fabricate(:topic) }
     let(:params) do
       { reviewable_claimed_topic: { topic_id: topic.id } }
     end
@@ -37,7 +37,7 @@ describe ReviewableClaimedTopicsController do
   end
 
   describe '#destroy' do
-    let(:claimed) { Fabricate(:reviewable_claimed_topic) }
+    fab!(:claimed) { Fabricate(:reviewable_claimed_topic) }
 
     before do
       sign_in(moderator)
diff --git a/spec/requests/reviewables_controller_spec.rb b/spec/requests/reviewables_controller_spec.rb
index 56a9dc2..e821b15 100644
--- a/spec/requests/reviewables_controller_spec.rb
+++ b/spec/requests/reviewables_controller_spec.rb
@@ -291,7 +291,7 @@ describe ReviewablesController do
       end
 
       context "claims" do
-        let(:qp) { Fabricate(:reviewable_queued_post) }
+        fab!(:qp) { Fabricate(:reviewable_queued_post) }
 
         it "fails when reviewables must be claimed" do
           SiteSetting.reviewable_claiming = 'required'
diff --git a/spec/serializers/post_serializer_spec.rb b/spec/serializers/post_serializer_spec.rb
index 1ccb5ec..1e710b5 100644
--- a/spec/serializers/post_serializer_spec.rb
+++ b/spec/serializers/post_serializer_spec.rb
@@ -149,7 +149,7 @@ describe PostSerializer do
     end
 
     context "a hidden revised post" do
-      let(:post) { Fabricate(:post, raw: 'Hello world!', hidden: true) }
+      fab!(:post) { Fabricate(:post, raw: 'Hello world!', hidden: true) }
 
       before do
         SiteSetting.editing_grace_period_max_diff = 1
@@ -202,9 +202,9 @@ describe PostSerializer do
   end
 
   context "a post with notices" do
-    let(:user) { Fabricate(:user, trust_level: 1) }
-    let(:user_tl1) { Fabricate(:user, trust_level: 1) }
-    let(:user_tl2) { Fabricate(:user, trust_level: 2) }
+    fab!(:user) { Fabricate(:user, trust_level: 1) }
+    fab!(:user_tl1) { Fabricate(:user, trust_level: 1) }
+    fab!(:user_tl2) { Fabricate(:user, trust_level: 2) }
 
     let(:post) {
       post = Fabricate(:post, user: user)
diff --git a/spec/serializers/user_serializer_spec.rb b/spec/serializers/user_serializer_spec.rb
index 8fed236..7f896a2 100644
--- a/spec/serializers/user_serializer_spec.rb
+++ b/spec/serializers/user_serializer_spec.rb
@@ -41,11 +41,11 @@ describe UserSerializer do
   end
 
   context "with a user" do
-    let(:user) { Fabricate(:user) }
+    fab!(:user) { Fabricate(:user) }
     let(:serializer) { UserSerializer.new(user, scope: Guardian.new, root: false) }
     let(:json) { serializer.as_json }
-    let(:upload) { Fabricate(:upload) }
-    let(:upload2) { Fabricate(:upload) }
+    fab!(:upload) { Fabricate(:upload) }
+    fab!(:upload2) { Fabricate(:upload) }
 
     context "with `enable_names` true" do
       before do
diff --git a/spec/services/user_anonymizer_spec.rb b/spec/services/user_anonymizer_spec.rb
index 8e57e11..3f9deb0 100644
--- a/spec/services/user_anonymizer_spec.rb
+++ b/spec/services/user_anonymizer_spec.rb
@@ -3,7 +3,6 @@
 require "rails_helper"
 
 describe UserAnonymizer do
-
   let(:admin) { Fabricate(:admin) }
 
   describe "event" do
@@ -27,7 +26,7 @@ describe UserAnonymizer do
   describe "make_anonymous" do
     let(:original_email) { "edward@example.net" }
     let(:user) { Fabricate(:user, username: "edward", email: original_email) }
-    let(:another_user) { Fabricate(:evil_trout) }
+    fab!(:another_user) { Fabricate(:evil_trout) }
     subject(:make_anonymous) { described_class.make_anonymous(user, admin) }
 
     it "changes username" do
@@ -297,7 +296,7 @@ describe UserAnonymizer do
     let(:old_ip) { "1.2.3.4" }
     let(:anon_ip) { "0.0.0.0" }
     let(:user) { Fabricate(:user, ip_address: old_ip, registration_ip_address: old_ip) }
-    let(:post) { Fabricate(:post) }
+    fab!(:post) { Fabricate(:post) }
     let(:topic) { post.topic }
 
     it "doesn't anonymize ips by default" do

GitHub sha: bf7594b3