Skip to content

Commit

Permalink
test Schema#jsi_schema_module_exec
Browse files Browse the repository at this point in the history
  • Loading branch information
notEthan committed Nov 15, 2021
1 parent 3b1c1fe commit 3712569
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/schema_test.rb
Expand Up @@ -533,6 +533,15 @@
assert_equal(schema, schema.jsi_schema_module.schema)
end
end

describe '#jsi_schema_module_exec' do
it 'evaluates the block on the schema module' do
schema = JSI::JSONSchemaOrgDraft07.new_schema({'id' => 'https://schemas.jsi.unth.net/test/jsi_schema_module_exec'})
schema.jsi_schema_module_exec(foo: 'foo') { |foo: | define_method(:foo) { foo } }
assert_equal('foo', schema.new_jsi({}).foo)
end
end

describe '#jsi_schema_class' do
it 'returns the class for the schema' do
schema = JSI::JSONSchemaOrgDraft07.new_schema({'$id' => 'https://schemas.jsi.unth.net/test/schema_schema_class'})
Expand Down

0 comments on commit 3712569

Please sign in to comment.