Skip to content

Commit

Permalink
rspec: Check that all jsons can be loaded into struct
Browse files Browse the repository at this point in the history
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
  • Loading branch information
kostyanf14 committed Mar 12, 2024
1 parent db1c10a commit 88aa947
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec/srb_json_load_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'json'

require './lib/models/driver'

JSON_TYPES_MAP = {
'./lib/engines/hcktest/drivers/*.json' => AutoHCK::Models::Driver,
}.freeze

describe 'srb_json_load' do
Dir['./**/*.json'].each do |json_file|
next if json_file.include? 'jtd.json'

it json_file.to_s do
pair = JSON_TYPES_MAP.find { File.fnmatch(_1[0], json_file) }

if pair.nil?
pending("NO TYPE FOR #{json_file}")
raise
end

expect { pair[1].from_json_file(json_file) }.not_to raise_error
end
end
end

0 comments on commit 88aa947

Please sign in to comment.