Sha256: 600c2c7773e994e4d468eeb47c787b144e2194a8163a01d08c416a8fc7a4e8e2
Contents?: true
Size: 982 Bytes
Versions: 5
Compression:
Stored size: 982 Bytes
Contents
module FileHelpers ORIGINAL_SCHEMA_ROOT = JSON::Matchers.schema_root def create_schema(name, json) File.open("#{schema_root}/#{name}.json", "w") do |file| case json when NilClass, String file.write(json.to_s) else file.write(json.to_json) end end end def response_for(json) response_body = case json when String, NilClass json.to_s else json.to_json end double(body: response_body) end def schema_root JSON::Matchers.schema_root end end RSpec.configure do |config| config.include FileHelpers config.around do |example| JSON::Matchers.schema_root = File.join(Dir.pwd, "spec", "fixtures", "schemas") FileUtils.mkdir_p(JSON::Matchers.schema_root) example.run FileUtils.rm_rf(JSON::Matchers.schema_root) JSON::Matchers.schema_root = FileHelpers::ORIGINAL_SCHEMA_ROOT end end
Version data entries
5 entries across 5 versions & 1 rubygems