prefabricate admin in search_spec.rb

prefabricate admin in search_spec.rb

diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb
index 7b23bb8..0eff908 100644
--- a/spec/components/search_spec.rb
+++ b/spec/components/search_spec.rb
@@ -5,6 +5,7 @@ require 'rails_helper'
 require_dependency 'search'
 
 describe Search do
+  fab!(:admin) { Fabricate(:admin) }
 
   before do
     SearchIndexer.enable
@@ -209,7 +210,7 @@ describe Search do
       results = Search.execute('mars',
                               type_filter: 'private_messages',
                               search_context: post.user,
-                              guardian: Guardian.new(Fabricate(:admin)))
+                              guardian: Guardian.new(admin))
 
       expect(results.posts.length).to eq(1)
 
@@ -399,10 +400,10 @@ describe Search do
         end
 
         it 'restricts result to messages' do
-          result = Search.execute(topic.relative_url, search_for_id: true, type_filter: 'private_messages', guardian: Guardian.new(Fabricate(:admin)), restrict_to_archetype: Archetype.private_message)
+          result = Search.execute(topic.relative_url, search_for_id: true, type_filter: 'private_messages', guardian: Guardian.new(admin), restrict_to_archetype: Archetype.private_message)
           expect(result.posts.length).to eq(0)
 
-          result = Search.execute(personal_message.relative_url, search_for_id: true, type_filter: 'private_messages', guardian: Guardian.new(Fabricate(:admin)), restrict_to_archetype: Archetype.private_message)
+          result = Search.execute(personal_message.relative_url, search_for_id: true, type_filter: 'private_messages', guardian: Guardian.new(admin), restrict_to_archetype: Archetype.private_message)
           expect(result.posts.length).to eq(1)
         end
       end
@@ -425,7 +426,7 @@ describe Search do
 
         expect(result(nil).posts).not_to be_present
         expect(result(Fabricate(:user)).posts).not_to be_present
-        expect(result(Fabricate(:admin)).posts).to be_present
+        expect(result(admin).posts).to be_present
 
       end
     end
@@ -567,7 +568,7 @@ describe Search do
 
       context 'staff logged in' do
         it 'shows group' do
-          expect(search(Fabricate(:admin)).groups.map(&:name)).to eq([group.name])
+          expect(search(admin).groups.map(&:name)).to eq([group.name])
         end
       end
 
@@ -631,7 +632,7 @@ describe Search do
       it 'shows staff tags' do
         create_staff_tags(["#{tag.name}9"])
 
-        expect(Search.execute(tag.name, guardian: Guardian.new(Fabricate(:admin))).tags.map(&:name)).to contain_exactly(tag.name, "#{tag.name}9")
+        expect(Search.execute(tag.name, guardian: Guardian.new(admin)).tags.map(&:name)).to contain_exactly(tag.name, "#{tag.name}9")
         expect(search.tags.map(&:name)).to contain_exactly(tag.name, "#{tag.name}9")
       end
 
@@ -642,7 +643,7 @@ describe Search do
         category.allowed_tag_groups = [tag_group.name]
         category.save!
 
-        expect(Search.execute(tag.name, guardian: Guardian.new(Fabricate(:admin))).tags).to contain_exactly(tag, category_tag)
+        expect(Search.execute(tag.name, guardian: Guardian.new(admin)).tags).to contain_exactly(tag, category_tag)
         expect(search.tags).to contain_exactly(tag, category_tag)
       end
     end

GitHub sha: 90c22694