Sha256: 24831767e57e89d41fbf0002a08e579c9236c8d9c3e4f8947dc49b79972652a8

Contents?: true

Size: 597 Bytes

Versions: 2

Compression:

Stored size: 597 Bytes

Contents

require "fileutils"

module FileHelpers
  def setup_fixtures(*pathnames)
    JSON::Validator.clear_cache
    original_schema_root = JsonMatchers.schema_root

    JsonMatchers.schema_root = File.join(*pathnames)
    FileUtils.mkdir_p(JsonMatchers.schema_root)

    original_schema_root
  end

  def teardown_fixtures(original_schema_root)
    FileUtils.rm_rf(JsonMatchers.schema_root)
    JsonMatchers.schema_root = original_schema_root
  end

  def ensure_fixtures(*pathnames)
    original_schema_root = setup_fixtures(*pathnames)

    yield

    teardown_fixtures(original_schema_root)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_matchers-0.9.0 spec/support/file_helpers.rb
json_matchers-0.8.0 spec/support/file_helpers.rb