Skip to content

Commit

Permalink
fixes for caching test on jruby
Browse files Browse the repository at this point in the history
diff --git a/test/caching_test.rb b/test/caching_test.rb
index 4ccef91..c6d9808 100644
--- a/test/caching_test.rb
+++ b/test/caching_test.rb
@@ -1,4 +1,5 @@
 require File.expand_path('../support/test_helper', __FILE__)
+require 'tempfile'

 class CachingTestTest < Minitest::Test
   def setup
@@ -6,8 +7,10 @@ class CachingTestTest < Minitest::Test
   end

   def teardown
-    @schema.close
-    @schema.unlink
+    if @Schema
+      @schema.close
+      @schema.unlink
+    end

     JSON::Validator.clear_cache
   end
  • Loading branch information
notEthan committed Mar 13, 2018
1 parent c045ab9 commit 3a6d994
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/caching_test.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
require File.expand_path('../support/test_helper', __FILE__)
require 'tempfile'

class CachingTestTest < Minitest::Test
def setup
@schema = Tempfile.new(['schema', '.json'])
end

def teardown
@schema.close
@schema.unlink
if @schema
@schema.close
@schema.unlink
end

JSON::Validator.clear_cache
end
Expand Down

0 comments on commit 3a6d994

Please sign in to comment.