Loading lib/labkit/covered_experience/registry.rb +0 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ module Labkit def initialize(dir: File.join("config", "covered_experiences")) @dir = Pathname.new(Dir.pwd).join(dir) @experiences = load_on_demand @invalid_definitions = {} end # Retrieve a definition experience given a covered_experience_id. Loading @@ -32,13 +31,6 @@ module Labkit @experiences[covered_experience_id.to_s] end # Retrieve invalid definitions (ignored because they didn't pass schema validation) # # @return [Hash] Invalid validation messages keyed by covered_experience_id def invalid_definitions @invalid_definitions.dup.freeze end private # Initialize a hash that loads experiences on-demand Loading Loading @@ -88,7 +80,6 @@ module Labkit errors = JSON::Validator.fully_validate(schema, content) return Experience.new(id: experience_id, **content.transform_keys(&:to_sym)) if errors.empty? @invalid_definitions[experience_id] = errors.join(', ') warn("Invalid schema for #{file_path}") nil Loading spec/labkit/covered_experience/registry_spec.rb +0 −14 Original line number Diff line number Diff line Loading @@ -123,20 +123,6 @@ RSpec.describe Labkit::CoveredExperience::Registry do expect(described_class.new(dir: covered_experiences_dir)).to be_empty end end context 'with invalid schema' do it 'ignores invalid schemas' do create_yaml_file('invalid_schema.yml', { 'invalid_key' => 'invalid_value' }) registry = described_class.new(dir: covered_experiences_dir) expect(registry).to be_empty # we need to force access the invalid schema to make it populate invalid_definitions expect(registry['invalid_schema']).to be_nil expect(registry.invalid_definitions).to match("invalid_schema" => String) end end end private Loading Loading
lib/labkit/covered_experience/registry.rb +0 −9 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ module Labkit def initialize(dir: File.join("config", "covered_experiences")) @dir = Pathname.new(Dir.pwd).join(dir) @experiences = load_on_demand @invalid_definitions = {} end # Retrieve a definition experience given a covered_experience_id. Loading @@ -32,13 +31,6 @@ module Labkit @experiences[covered_experience_id.to_s] end # Retrieve invalid definitions (ignored because they didn't pass schema validation) # # @return [Hash] Invalid validation messages keyed by covered_experience_id def invalid_definitions @invalid_definitions.dup.freeze end private # Initialize a hash that loads experiences on-demand Loading Loading @@ -88,7 +80,6 @@ module Labkit errors = JSON::Validator.fully_validate(schema, content) return Experience.new(id: experience_id, **content.transform_keys(&:to_sym)) if errors.empty? @invalid_definitions[experience_id] = errors.join(', ') warn("Invalid schema for #{file_path}") nil Loading
spec/labkit/covered_experience/registry_spec.rb +0 −14 Original line number Diff line number Diff line Loading @@ -123,20 +123,6 @@ RSpec.describe Labkit::CoveredExperience::Registry do expect(described_class.new(dir: covered_experiences_dir)).to be_empty end end context 'with invalid schema' do it 'ignores invalid schemas' do create_yaml_file('invalid_schema.yml', { 'invalid_key' => 'invalid_value' }) registry = described_class.new(dir: covered_experiences_dir) expect(registry).to be_empty # we need to force access the invalid schema to make it populate invalid_definitions expect(registry['invalid_schema']).to be_nil expect(registry.invalid_definitions).to match("invalid_schema" => String) end end end private Loading