Fix specs. (#454)

Fix specs. (#454)

diff --git a/.rubocop.yml b/.rubocop.yml
index d46296c..f704310 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,2 +1,5 @@
 inherit_gem:
   rubocop-discourse: default.yml
+
+RSpec/MessageSpies:
+  Enabled: false
diff --git a/lib/mini_profiler/profiler.rb b/lib/mini_profiler/profiler.rb
index 786c005..b16de3f 100644
--- a/lib/mini_profiler/profiler.rb
+++ b/lib/mini_profiler/profiler.rb
@@ -373,7 +373,6 @@ module Rack
         return client_settings.handle_cookie(self.flamegraph(flamegraph))
       end
 
-
       begin
         @storage.save(page_struct)
         # no matter what it is, it should be unviewed, otherwise we will miss POST
diff --git a/spec/integration/mini_profiler_spec.rb b/spec/integration/mini_profiler_spec.rb
index dfe6f77..05d1dc7 100644
--- a/spec/integration/mini_profiler_spec.rb
+++ b/spec/integration/mini_profiler_spec.rb
@@ -338,8 +338,8 @@ describe Rack::MiniProfiler do
   describe 'error handling when storage_instance fails to save' do
     it "should recover gracefully" do
       Rack::MiniProfiler.config.pre_authorize_cb = lambda { |env| true }
-      allow_any_instance_of(Rack::MiniProfiler::MemoryStore).to have_received(:save) { raise "This error" }
-      expect(Rack::MiniProfiler.config.storage_failure).to have_received(:call)
+      allow_any_instance_of(Rack::MiniProfiler::MemoryStore).to receive(:save) { raise "This error" }
+      expect(Rack::MiniProfiler.config.storage_failure).to receive(:call)
       get '/html'
     end
   end
diff --git a/spec/integration/railtie_methods_spec.rb b/spec/integration/railtie_methods_spec.rb
index 9079c72..851d935 100644
--- a/spec/integration/railtie_methods_spec.rb
+++ b/spec/integration/railtie_methods_spec.rb
@@ -11,7 +11,7 @@ end
 describe Rack::MiniProfilerRailsMethods do
   describe '#render_notification_handler' do
     before do
-      allow(Process).to have_received(:clock_gettime).and_return(0)
+      allow(Process).to receive(:clock_gettime).and_return(0)
       Rack::MiniProfiler.create_current
       @current_timer = Rack::MiniProfiler.current.current_timer
 
@@ -22,7 +22,7 @@ describe Rack::MiniProfilerRailsMethods do
         ['SELECT E', 73,  77], # in node E
         ['SELECT F', 93,  96]  # in node F
       ]).each do |query, start, finish|
-        allow(Process).to have_received(:clock_gettime).and_return(finish)
+        allow(Process).to receive(:clock_gettime).and_return(finish)
         @current_timer.add_sql(
           query,
           finish - start,
@@ -39,7 +39,7 @@ describe Rack::MiniProfilerRailsMethods do
         ['custom1 B', 11, 16],
         ['custom1 B', 17, 19]
       ]).each do |type, start, finish|
-        allow(Process).to have_received(:clock_gettime).and_return(finish)
+        allow(Process).to receive(:clock_gettime).and_return(finish)
         timing = @current_timer.add_custom(
           type,
           finish - start,
@@ -68,7 +68,7 @@ describe Rack::MiniProfilerRailsMethods do
         ['A',  0,     80],
         ['F',  90,    100]
       ]).each do |name, start, finish|
-        allow(Process).to have_received(:clock_gettime).and_return(finish)
+        allow(Process).to receive(:clock_gettime).and_return(finish)
         described_class.render_notification_handler(name, finish, start, name_as_description: true)
       end
       @nodes = {
diff --git a/spec/lib/sql_patches_spec.rb b/spec/lib/sql_patches_spec.rb
index 4a8ffde..ed5b4d8 100644
--- a/spec/lib/sql_patches_spec.rb
+++ b/spec/lib/sql_patches_spec.rb
@@ -33,7 +33,7 @@ describe SqlPatches do
     it "uses detection of env variable is not defined" do
       with_patch_env(nil) do
         expect(SqlPatches.all_patch_files).to eq([])
-        expect(Rack::MiniProfiler).to have_received(:patch_rails?).and_return(true)
+        expect(Rack::MiniProfiler).to receive(:patch_rails?).and_return(true)
         expect(SqlPatches.all_patch_files).to eq(["activerecord"])
       end
     end
diff --git a/spec/lib/storage/memcache_store_spec.rb b/spec/lib/storage/memcache_store_spec.rb
index 7f1ff96..71f3e24 100644
--- a/spec/lib/storage/memcache_store_spec.rb
+++ b/spec/lib/storage/memcache_store_spec.rb
@@ -80,8 +80,8 @@ describe Rack::MiniProfiler::MemcacheStore do
         client = instance_double("memcache-client")
         store = Rack::MiniProfiler::MemcacheStore.new(client: client)
 
-        expect(client).to have_received(:get)
-        expect(Dalli::Client).not_to have_received(:new)
+        expect(client).to receive(:get)
+        expect(Dalli::Client).not_to receive(:new)
         store.load("XYZ")
       end
     end
diff --git a/spec/lib/storage/redis_store_spec.rb b/spec/lib/storage/redis_store_spec.rb
index 32bfa3f..d811f54 100644
--- a/spec/lib/storage/redis_store_spec.rb
+++ b/spec/lib/storage/redis_store_spec.rb
@@ -33,8 +33,8 @@ describe Rack::MiniProfiler::RedisStore do
         connection = instance_double("redis-connection")
         store = Rack::MiniProfiler::RedisStore.new(connection: connection)
 
-        expect(connection).to have_received(:get)
-        expect(Redis).not_to have_received(:new)
+        expect(connection).to receive(:get)
+        expect(Redis).not_to receive(:new)
         store.load("XYZ")
       end
     end
diff --git a/spec/lib/timer_struct/timer_struct_spec.rb b/spec/lib/timer_struct/timer_struct_spec.rb
index cfdc5d8..bb1da49 100644
--- a/spec/lib/timer_struct/timer_struct_spec.rb
+++ b/spec/lib/timer_struct/timer_struct_spec.rb
@@ -27,7 +27,7 @@ describe Rack::MiniProfiler::TimerStruct::Base do
     end
 
     it 'should not add a second (nil) argument if no arguments were passed' do
-      expect(::JSON).to have_received(:generate).once.with(@timer.attributes, max_nesting: 100).and_return(nil)
+      expect(::JSON).to receive(:generate).once.with(@timer.attributes, max_nesting: 100).and_return(nil)
       @timer.to_json
     end
 

GitHub sha: cea53b89

This commit appears in #454 which was merged by SamSaffron.