avro_turf 1.18.0 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.github/workflows/ruby.yml +20 -11
 - data/CHANGELOG.md +10 -0
 - data/Gemfile +6 -1
 - data/README.md +1 -1
 - data/Rakefile +2 -1
 - data/avro_turf.gemspec +17 -17
 - data/lib/avro_turf/cached_confluent_schema_registry.rb +9 -8
 - data/lib/avro_turf/cached_schema_registry.rb +3 -1
 - data/lib/avro_turf/confluent_schema_registry.rb +35 -22
 - data/lib/avro_turf/core_ext/date.rb +2 -0
 - data/lib/avro_turf/core_ext/enumerable.rb +2 -0
 - data/lib/avro_turf/core_ext/false_class.rb +2 -0
 - data/lib/avro_turf/core_ext/hash.rb +4 -2
 - data/lib/avro_turf/core_ext/nil_class.rb +2 -0
 - data/lib/avro_turf/core_ext/numeric.rb +2 -0
 - data/lib/avro_turf/core_ext/string.rb +2 -0
 - data/lib/avro_turf/core_ext/symbol.rb +2 -0
 - data/lib/avro_turf/core_ext/time.rb +2 -0
 - data/lib/avro_turf/core_ext/true_class.rb +2 -0
 - data/lib/avro_turf/core_ext.rb +12 -10
 - data/lib/avro_turf/disk_cache.rb +13 -12
 - data/lib/avro_turf/in_memory_cache.rb +2 -0
 - data/lib/avro_turf/messaging.rb +31 -16
 - data/lib/avro_turf/mutable_schema_store.rb +25 -4
 - data/lib/avro_turf/schema_registry.rb +3 -1
 - data/lib/avro_turf/schema_store.rb +3 -2
 - data/lib/avro_turf/schema_to_avro_patch.rb +14 -12
 - data/lib/avro_turf/test/fake_confluent_schema_registry_server.rb +24 -23
 - data/lib/avro_turf/test/fake_prefixed_confluent_schema_registry_server.rb +12 -10
 - data/lib/avro_turf/test/fake_schema_registry_server.rb +3 -1
 - data/lib/avro_turf/version.rb +3 -1
 - data/lib/avro_turf.rb +15 -13
 - data/perf/encoding_size.rb +4 -2
 - data/perf/encoding_speed.rb +4 -2
 - data/spec/avro_turf_spec.rb +24 -23
 - data/spec/cached_confluent_schema_registry_spec.rb +9 -7
 - data/spec/confluent_schema_registry_spec.rb +31 -10
 - data/spec/core_ext/date_spec.rb +2 -0
 - data/spec/core_ext/enumerable_spec.rb +2 -0
 - data/spec/core_ext/false_class_spec.rb +2 -0
 - data/spec/core_ext/hash_spec.rb +3 -1
 - data/spec/core_ext/nil_class_spec.rb +2 -0
 - data/spec/core_ext/numeric_spec.rb +2 -0
 - data/spec/core_ext/string_spec.rb +2 -0
 - data/spec/core_ext/symbol_spec.rb +2 -0
 - data/spec/core_ext/time_spec.rb +2 -0
 - data/spec/core_ext/true_class_spec.rb +2 -0
 - data/spec/disk_cached_confluent_schema_registry_spec.rb +23 -21
 - data/spec/messaging_spec.rb +171 -86
 - data/spec/mutable_schema_store_spec.rb +134 -0
 - data/spec/schema_store_spec.rb +23 -21
 - data/spec/schema_to_avro_patch_spec.rb +8 -7
 - data/spec/spec_helper.rb +9 -9
 - data/spec/support/authorized_fake_confluent_schema_registry_server.rb +4 -2
 - data/spec/support/authorized_fake_prefixed_confluent_schema_registry_server.rb +4 -2
 - data/spec/support/confluent_schema_registry_context.rb +32 -30
 - data/spec/test/fake_confluent_schema_registry_server_spec.rb +97 -94
 - metadata +15 -33
 
| 
         @@ -1,22 +1,40 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "webmock/rspec"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "avro_turf/confluent_schema_registry"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "avro_turf/test/fake_confluent_schema_registry_server"
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            describe AvroTurf::ConfluentSchemaRegistry do
         
     | 
| 
       6 
8 
     | 
    
         
             
              let(:user) { "abc" }
         
     | 
| 
       7 
9 
     | 
    
         
             
              let(:password) { "xxyyzz" }
         
     | 
| 
       8 
10 
     | 
    
         
             
              let(:client_cert) { "test client cert" }
         
     | 
| 
      
 11 
     | 
    
         
            +
              let(:client_chain) { "test client cert chain" }
         
     | 
| 
       9 
12 
     | 
    
         
             
              let(:client_key) { "test client key" }
         
     | 
| 
       10 
13 
     | 
    
         
             
              let(:client_key_pass) { "test client key password" }
         
     | 
| 
       11 
14 
     | 
    
         
             
              let(:connect_timeout) { 10 }
         
     | 
| 
       12 
15 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
              context  
     | 
| 
      
 16 
     | 
    
         
            +
              context "authenticated by cert" do
         
     | 
| 
      
 17 
     | 
    
         
            +
                it_behaves_like "a confluent schema registry client" do
         
     | 
| 
      
 18 
     | 
    
         
            +
                  let(:registry) {
         
     | 
| 
      
 19 
     | 
    
         
            +
                    described_class.new(
         
     | 
| 
      
 20 
     | 
    
         
            +
                      registry_url,
         
     | 
| 
      
 21 
     | 
    
         
            +
                      logger: logger,
         
     | 
| 
      
 22 
     | 
    
         
            +
                      client_cert: client_cert,
         
     | 
| 
      
 23 
     | 
    
         
            +
                      client_key: client_key,
         
     | 
| 
      
 24 
     | 
    
         
            +
                      client_key_pass: client_key_pass
         
     | 
| 
      
 25 
     | 
    
         
            +
                    )
         
     | 
| 
      
 26 
     | 
    
         
            +
                  }
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              context "authenticated by cert with chain" do
         
     | 
| 
       14 
31 
     | 
    
         
             
                it_behaves_like "a confluent schema registry client" do
         
     | 
| 
       15 
32 
     | 
    
         
             
                  let(:registry) {
         
     | 
| 
       16 
33 
     | 
    
         
             
                    described_class.new(
         
     | 
| 
       17 
34 
     | 
    
         
             
                      registry_url,
         
     | 
| 
       18 
35 
     | 
    
         
             
                      logger: logger,
         
     | 
| 
       19 
36 
     | 
    
         
             
                      client_cert: client_cert,
         
     | 
| 
      
 37 
     | 
    
         
            +
                      client_chain: client_chain,
         
     | 
| 
       20 
38 
     | 
    
         
             
                      client_key: client_key,
         
     | 
| 
       21 
39 
     | 
    
         
             
                      client_key_pass: client_key_pass
         
     | 
| 
       22 
40 
     | 
    
         
             
                    )
         
     | 
| 
         @@ -24,23 +42,25 @@ describe AvroTurf::ConfluentSchemaRegistry do 
     | 
|
| 
       24 
42 
     | 
    
         
             
                end
         
     | 
| 
       25 
43 
     | 
    
         
             
              end
         
     | 
| 
       26 
44 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
              context  
     | 
| 
      
 45 
     | 
    
         
            +
              context "authenticated by basic auth" do
         
     | 
| 
       28 
46 
     | 
    
         
             
                it_behaves_like "a confluent schema registry client" do
         
     | 
| 
       29 
47 
     | 
    
         
             
                  let(:registry) {
         
     | 
| 
       30 
48 
     | 
    
         
             
                    described_class.new(
         
     | 
| 
       31 
49 
     | 
    
         
             
                      registry_url,
         
     | 
| 
      
 50 
     | 
    
         
            +
                      logger: logger,
         
     | 
| 
       32 
51 
     | 
    
         
             
                      user: user,
         
     | 
| 
       33 
     | 
    
         
            -
                      password: password 
     | 
| 
      
 52 
     | 
    
         
            +
                      password: password
         
     | 
| 
       34 
53 
     | 
    
         
             
                    )
         
     | 
| 
       35 
54 
     | 
    
         
             
                  }
         
     | 
| 
       36 
55 
     | 
    
         
             
                end
         
     | 
| 
       37 
56 
     | 
    
         
             
              end
         
     | 
| 
       38 
57 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
              context  
     | 
| 
      
 58 
     | 
    
         
            +
              context "with connect_timeout" do
         
     | 
| 
       40 
59 
     | 
    
         
             
                it_behaves_like "a confluent schema registry client" do
         
     | 
| 
       41 
60 
     | 
    
         
             
                  let(:registry) {
         
     | 
| 
       42 
61 
     | 
    
         
             
                    described_class.new(
         
     | 
| 
       43 
62 
     | 
    
         
             
                      registry_url,
         
     | 
| 
      
 63 
     | 
    
         
            +
                      logger: logger,
         
     | 
| 
       44 
64 
     | 
    
         
             
                      user: user,
         
     | 
| 
       45 
65 
     | 
    
         
             
                      password: password,
         
     | 
| 
       46 
66 
     | 
    
         
             
                      connect_timeout: connect_timeout
         
     | 
| 
         @@ -49,12 +69,13 @@ describe AvroTurf::ConfluentSchemaRegistry do 
     | 
|
| 
       49 
69 
     | 
    
         
             
                end
         
     | 
| 
       50 
70 
     | 
    
         
             
              end
         
     | 
| 
       51 
71 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
              context  
     | 
| 
       53 
     | 
    
         
            -
                it_behaves_like "a confluent schema registry client", schema_context:  
     | 
| 
      
 72 
     | 
    
         
            +
              context "with non default schema_context" do
         
     | 
| 
      
 73 
     | 
    
         
            +
                it_behaves_like "a confluent schema registry client", schema_context: "other" do
         
     | 
| 
       54 
74 
     | 
    
         
             
                  let(:registry) {
         
     | 
| 
       55 
75 
     | 
    
         
             
                    described_class.new(
         
     | 
| 
       56 
76 
     | 
    
         
             
                      registry_url,
         
     | 
| 
       57 
     | 
    
         
            -
                       
     | 
| 
      
 77 
     | 
    
         
            +
                      logger: logger,
         
     | 
| 
      
 78 
     | 
    
         
            +
                      schema_context: "other",
         
     | 
| 
       58 
79 
     | 
    
         
             
                      user: user,
         
     | 
| 
       59 
80 
     | 
    
         
             
                      password: password,
         
     | 
| 
       60 
81 
     | 
    
         
             
                      connect_timeout: connect_timeout
         
     | 
    
        data/spec/core_ext/date_spec.rb
    CHANGED
    
    
    
        data/spec/core_ext/hash_spec.rb
    CHANGED
    
    | 
         @@ -1,8 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            describe Hash, "#as_avro" do
         
     | 
| 
       2 
4 
     | 
    
         
             
              it "coerces the keys and values to Avro" do
         
     | 
| 
       3 
5 
     | 
    
         
             
                x = double(as_avro: "x")
         
     | 
| 
       4 
6 
     | 
    
         
             
                y = double(as_avro: "y")
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                expect({ 
     | 
| 
      
 8 
     | 
    
         
            +
                expect({x => y}.as_avro).to eq({"x" => "y"})
         
     | 
| 
       7 
9 
     | 
    
         
             
              end
         
     | 
| 
       8 
10 
     | 
    
         
             
            end
         
     | 
    
        data/spec/core_ext/time_spec.rb
    CHANGED
    
    
| 
         @@ -1,18 +1,20 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            require  
     | 
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "webmock/rspec"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "avro_turf/cached_confluent_schema_registry"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "avro_turf/test/fake_confluent_schema_registry_server"
         
     | 
| 
       4 
6 
     | 
    
         | 
| 
       5 
7 
     | 
    
         
             
            describe AvroTurf::CachedConfluentSchemaRegistry do
         
     | 
| 
       6 
8 
     | 
    
         
             
              let(:upstream) { instance_double(AvroTurf::ConfluentSchemaRegistry) }
         
     | 
| 
       7 
9 
     | 
    
         
             
              let(:logger_io) { StringIO.new }
         
     | 
| 
       8 
     | 
    
         
            -
              let(:cache) 
     | 
| 
      
 10 
     | 
    
         
            +
              let(:cache) { AvroTurf::DiskCache.new("spec/cache", logger: Logger.new(logger_io)) }
         
     | 
| 
       9 
11 
     | 
    
         
             
              let(:registry) { described_class.new(upstream, cache: cache) }
         
     | 
| 
       10 
12 
     | 
    
         
             
              let(:id) { rand(999) }
         
     | 
| 
       11 
13 
     | 
    
         
             
              let(:schema) do
         
     | 
| 
       12 
14 
     | 
    
         
             
                {
         
     | 
| 
       13 
15 
     | 
    
         
             
                  type: "record",
         
     | 
| 
       14 
16 
     | 
    
         
             
                  name: "person",
         
     | 
| 
       15 
     | 
    
         
            -
                  fields: [{ 
     | 
| 
      
 17 
     | 
    
         
            +
                  fields: [{name: "name", type: "string"}]
         
     | 
| 
       16 
18 
     | 
    
         
             
                }.to_json
         
     | 
| 
       17 
19 
     | 
    
         
             
              end
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
         @@ -21,21 +23,21 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       21 
23 
     | 
    
         
             
                {
         
     | 
| 
       22 
24 
     | 
    
         
             
                  type: "record",
         
     | 
| 
       23 
25 
     | 
    
         
             
                  name: "city",
         
     | 
| 
       24 
     | 
    
         
            -
                  fields: [{ 
     | 
| 
      
 26 
     | 
    
         
            +
                  fields: [{name: "name", type: "string"}]
         
     | 
| 
       25 
27 
     | 
    
         
             
                }.to_json
         
     | 
| 
       26 
28 
     | 
    
         
             
              end
         
     | 
| 
       27 
29 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
              let(:subject) {  
     | 
| 
      
 30 
     | 
    
         
            +
              let(:subject) { "subject" }
         
     | 
| 
       29 
31 
     | 
    
         
             
              let(:version) { rand(999) }
         
     | 
| 
       30 
32 
     | 
    
         
             
              let(:subject_version_schema) do
         
     | 
| 
       31 
33 
     | 
    
         
             
                {
         
     | 
| 
       32 
34 
     | 
    
         
             
                  subject: subject,
         
     | 
| 
       33 
35 
     | 
    
         
             
                  version: version,
         
     | 
| 
       34 
36 
     | 
    
         
             
                  id: id,
         
     | 
| 
       35 
     | 
    
         
            -
                  schema: 
     | 
| 
      
 37 
     | 
    
         
            +
                  schema: {
         
     | 
| 
       36 
38 
     | 
    
         
             
                    type: "record",
         
     | 
| 
       37 
39 
     | 
    
         
             
                    name: "city",
         
     | 
| 
       38 
     | 
    
         
            -
                    fields: { 
     | 
| 
      
 40 
     | 
    
         
            +
                    fields: {name: "name", type: "string"}
         
     | 
| 
       39 
41 
     | 
    
         
             
                  }
         
     | 
| 
       40 
42 
     | 
    
         
             
                }.to_json
         
     | 
| 
       41 
43 
     | 
    
         
             
              end
         
     | 
| 
         @@ -47,13 +49,13 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       47 
49 
     | 
    
         
             
              describe "#fetch" do
         
     | 
| 
       48 
50 
     | 
    
         
             
                let(:cache_before) do
         
     | 
| 
       49 
51 
     | 
    
         
             
                  {
         
     | 
| 
       50 
     | 
    
         
            -
                     
     | 
| 
      
 52 
     | 
    
         
            +
                    id.to_s => schema.to_s
         
     | 
| 
       51 
53 
     | 
    
         
             
                  }
         
     | 
| 
       52 
54 
     | 
    
         
             
                end
         
     | 
| 
       53 
55 
     | 
    
         
             
                let(:cache_after) do
         
     | 
| 
       54 
56 
     | 
    
         
             
                  {
         
     | 
| 
       55 
     | 
    
         
            -
                     
     | 
| 
       56 
     | 
    
         
            -
                     
     | 
| 
      
 57 
     | 
    
         
            +
                    id.to_s => schema.to_s,
         
     | 
| 
      
 58 
     | 
    
         
            +
                    city_id.to_s => city_schema.to_s
         
     | 
| 
       57 
59 
     | 
    
         
             
                  }
         
     | 
| 
       58 
60 
     | 
    
         
             
                end
         
     | 
| 
       59 
61 
     | 
    
         | 
| 
         @@ -84,13 +86,13 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       84 
86 
     | 
    
         
             
              describe "#fetch (zero length cache file)" do
         
     | 
| 
       85 
87 
     | 
    
         
             
                let(:cache_after) do
         
     | 
| 
       86 
88 
     | 
    
         
             
                  {
         
     | 
| 
       87 
     | 
    
         
            -
                     
     | 
| 
      
 89 
     | 
    
         
            +
                    id.to_s => schema.to_s
         
     | 
| 
       88 
90 
     | 
    
         
             
                  }
         
     | 
| 
       89 
91 
     | 
    
         
             
                end
         
     | 
| 
       90 
92 
     | 
    
         | 
| 
       91 
93 
     | 
    
         
             
                before do
         
     | 
| 
       92 
94 
     | 
    
         
             
                  # setup the disk cache with a zero length file
         
     | 
| 
       93 
     | 
    
         
            -
                  File.write(File.join("spec/cache", "schemas_by_id.json"),  
     | 
| 
      
 95 
     | 
    
         
            +
                  File.write(File.join("spec/cache", "schemas_by_id.json"), "")
         
     | 
| 
       94 
96 
     | 
    
         
             
                end
         
     | 
| 
       95 
97 
     | 
    
         | 
| 
       96 
98 
     | 
    
         
             
                it "skips zero length disk cache" do
         
     | 
| 
         @@ -107,11 +109,11 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       107 
109 
     | 
    
         
             
              describe "#fetch (corrupt cache file)" do
         
     | 
| 
       108 
110 
     | 
    
         
             
                before do
         
     | 
| 
       109 
111 
     | 
    
         
             
                  # setup the disk cache with a corrupt file (i.e. not json)
         
     | 
| 
       110 
     | 
    
         
            -
                  File.write(File.join("spec/cache", "schemas_by_id.json"),  
     | 
| 
      
 112 
     | 
    
         
            +
                  File.write(File.join("spec/cache", "schemas_by_id.json"), "NOTJSON")
         
     | 
| 
       111 
113 
     | 
    
         
             
                end
         
     | 
| 
       112 
114 
     | 
    
         | 
| 
       113 
115 
     | 
    
         
             
                it "raises error on corrupt cache file" do
         
     | 
| 
       114 
     | 
    
         
            -
                  expect{registry.fetch(id)}.to raise_error(JSON::ParserError, /unexpected token/)
         
     | 
| 
      
 116 
     | 
    
         
            +
                  expect { registry.fetch(id) }.to raise_error(JSON::ParserError, /unexpected token/)
         
     | 
| 
       115 
117 
     | 
    
         
             
                end
         
     | 
| 
       116 
118 
     | 
    
         
             
              end
         
     | 
| 
       117 
119 
     | 
    
         | 
| 
         @@ -124,7 +126,7 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       124 
126 
     | 
    
         
             
                end
         
     | 
| 
       125 
127 
     | 
    
         | 
| 
       126 
128 
     | 
    
         
             
                let(:city_name) { "a_city" }
         
     | 
| 
       127 
     | 
    
         
            -
                let(:cache_after) do 
     | 
| 
      
 129 
     | 
    
         
            +
                let(:cache_after) do
         
     | 
| 
       128 
130 
     | 
    
         
             
                  {
         
     | 
| 
       129 
131 
     | 
    
         
             
                    "#{subject_name}#{schema}" => id,
         
     | 
| 
       130 
132 
     | 
    
         
             
                    "#{city_name}#{city_schema}" => city_id
         
     | 
| 
         @@ -139,7 +141,7 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       139 
141 
     | 
    
         
             
                it "uses preloaded disk cache" do
         
     | 
| 
       140 
142 
     | 
    
         
             
                  # multiple calls return same result, with zero upstream calls
         
     | 
| 
       141 
143 
     | 
    
         
             
                  allow(upstream).to receive(:register).with(subject_name, schema).and_return(id)
         
     | 
| 
       142 
     | 
    
         
            -
                  expect(registry.register(subject_name, schema)).to eq(id) 
     | 
| 
      
 144 
     | 
    
         
            +
                  expect(registry.register(subject_name, schema)).to eq(id)
         
     | 
| 
       143 
145 
     | 
    
         
             
                  expect(registry.register(subject_name, schema)).to eq(id)
         
     | 
| 
       144 
146 
     | 
    
         
             
                  expect(upstream).to have_received(:register).exactly(0).times
         
     | 
| 
       145 
147 
     | 
    
         
             
                  expect(load_cache("ids_by_schema.json")).to eq cache_before
         
     | 
| 
         @@ -165,7 +167,7 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       165 
167 
     | 
    
         | 
| 
       166 
168 
     | 
    
         
             
                before do
         
     | 
| 
       167 
169 
     | 
    
         
             
                  # setup the disk cache with a zero length file
         
     | 
| 
       168 
     | 
    
         
            -
                  File.write(File.join("spec/cache", "ids_by_schema.json"),  
     | 
| 
      
 170 
     | 
    
         
            +
                  File.write(File.join("spec/cache", "ids_by_schema.json"), "")
         
     | 
| 
       169 
171 
     | 
    
         
             
                end
         
     | 
| 
       170 
172 
     | 
    
         | 
| 
       171 
173 
     | 
    
         
             
                it "skips zero length disk cache" do
         
     | 
| 
         @@ -182,11 +184,11 @@ describe AvroTurf::CachedConfluentSchemaRegistry do 
     | 
|
| 
       182 
184 
     | 
    
         
             
              describe "#register (corrupt cache file)" do
         
     | 
| 
       183 
185 
     | 
    
         
             
                before do
         
     | 
| 
       184 
186 
     | 
    
         
             
                  # setup the disk cache with a corrupt file (i.e. not json)
         
     | 
| 
       185 
     | 
    
         
            -
                  File.write(File.join("spec/cache", "ids_by_schema.json"),  
     | 
| 
      
 187 
     | 
    
         
            +
                  File.write(File.join("spec/cache", "ids_by_schema.json"), "NOTJSON")
         
     | 
| 
       186 
188 
     | 
    
         
             
                end
         
     | 
| 
       187 
189 
     | 
    
         | 
| 
       188 
190 
     | 
    
         
             
                it "raises error on corrupt cache file" do
         
     | 
| 
       189 
     | 
    
         
            -
                  expect{registry.register(subject_name, schema)}.to raise_error(JSON::ParserError, /unexpected token/)
         
     | 
| 
      
 191 
     | 
    
         
            +
                  expect { registry.register(subject_name, schema) }.to raise_error(JSON::ParserError, /unexpected token/)
         
     | 
| 
       190 
192 
     | 
    
         
             
                end
         
     | 
| 
       191 
193 
     | 
    
         
             
              end
         
     | 
| 
       192 
194 
     | 
    
         |