3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/schema_test/test_helper.rb', line 3
def assert_api_schema(name, version:, structure: nil)
install_asset_api_expansion_hook
definition = ApiSchema::Definition.find(name, version)
raise "Unknown definition #{name}, version: #{version}" unless definition.present?
expected_structure = definition.as_structure
if structure != expected_structure
if ENV['CI']
flunk "Outdated API schema assertion at #{caller[0]}"
else
queue_write_expanded_assert_api_call(caller[0], __method__, name, version, expected_structure)
end
end
assert_json_response_structure(*expected_structure)
end
|