spec/support/file_helpers.rb in json_matchers-0.7.3 vs spec/support/file_helpers.rb in json_matchers-0.8.0
- old
+ new
@@ -1,33 +1,7 @@
require "fileutils"
-require "json"
module FileHelpers
- FakeResponse = Struct.new(:body)
-
- def create_schema(name, json)
- path = File.join(JsonMatchers.schema_root, "#{name}.json")
-
- File.open(path, "w") do |file|
- case json
- when NilClass, String
- file.write(json.to_s)
- else
- file.write(JSON.generate(json))
- end
- end
- end
-
- def response_for(json)
- response_body = case json
- when String, NilClass
- json.to_s
- else
- json.to_json
- end
- FakeResponse.new(response_body)
- end
-
def setup_fixtures(*pathnames)
JSON::Validator.clear_cache
original_schema_root = JsonMatchers.schema_root
JsonMatchers.schema_root = File.join(*pathnames)