Enable Ruby verbose mode in specs (#387)

Enable Ruby verbose mode in specs (#387)

  • Enable Ruby verbose mode in specs

  • Explicitly undefine method as recommended by Ruby

  • Fix use of uninitialized instance variable

  • Avoid defining class multiple times in a spec

diff --git a/spec/lib/profiler_spec.rb b/spec/lib/profiler_spec.rb
index d1aed3f..be40a41 100644
--- a/spec/lib/profiler_spec.rb
+++ b/spec/lib/profiler_spec.rb
@@ -50,19 +50,20 @@ describe Rack::MiniProfiler do
   end
 
   describe 'profile method' do
-    before do
-      Rack::MiniProfiler.create_current
-      class TestClass
-        def foo(bar, baz)
-          return [bar, baz, yield]
-        end
+    class TestClass
+      def foo(bar, baz)
+        return [bar, baz, yield]
+      end
 
-        def self.bar(baz, boo)
-          return [baz, boo, yield]
-        end
+      def self.bar(baz, boo)
+        return [baz, boo, yield]
       end
     end
 
+    before do
+      Rack::MiniProfiler.create_current
+    end
+
     it 'should not destroy a method' do
       Rack::MiniProfiler.profile_method TestClass, :foo
       expect(TestClass.new.foo("a", "b") { "c" }).to eq(["a", "b", "c"])
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 122209e..f7a0999 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,5 +1,6 @@
 # frozen_string_literal: true
 
+$VERBOSE = true
 require 'simplecov'
 SimpleCov.start do
   add_filter "/spec/"
@@ -52,8 +53,9 @@ module Process
     end
     module_function :clock_travel
 
+    undef clock_gettime
     def clock_gettime(*)
-      @now || old_clock_gettime(Process::CLOCK_MONOTONIC)
+      defined?(@now) && @now || old_clock_gettime(Process::CLOCK_MONOTONIC)
     end
     module_function :clock_gettime

GitHub sha: e95095f6