forked from salsify/avro-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec_helper.rb
40 lines (33 loc) · 1005 Bytes
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'json_spec'
require 'rspec/its'
require 'simplecov'
SimpleCov.start do
add_filter 'spec'
end
require 'avro/builder'
RSpec.configure do |config|
config.before do
Avro::Builder::DSL.load_paths.clear
Avro::Builder.add_load_path('spec/avro/dsl')
end
enum_default_supported = Avro::Schema::EnumSchema.instance_methods.include?(:default)
aliases_supported = Avro::Schema::NamedSchema.instance_methods.include?(:aliases)
config.around(:each, :enum_default) do |example|
# The Avro gem does not correctly set a version :(
# So check for functionality for examples that require it.
if enum_default_supported
example.run
else
skip "enum_default not supported by this Avro version"
end
end
config.around(:each, :aliases) do |example|
if aliases_supported
example.run
else
skip "aliases not supported by this Avro version"
end
end
end