Sha256: 664b78726ef99a47d6eac5a455ce7a6b7b62669b291626a274faa1c6ad9cdce8

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require 'simplecov'
SimpleCov.start do
  add_filter '/test/'
end

require 'bundler'
Bundler.require :default, :test

require 'minitest/autorun'
require 'minitest/pride'


lib = File.expand_path '../../lib', __FILE__
$:.unshift lib unless $:.include? lib
require 'terraformer'

module MiniTest::Expectations

  GEOJSON_VALIDATE_URL = 'http://geojsonlint.com/validate'
  GEOJSON_VALIDATE_HEADERS = {'Content-Type' => 'application/json'}

  HC = HTTPClient.new

  def validate_geojson geojson_h
    r = JSON.parse HC.post(GEOJSON_VALIDATE_URL, geojson_h.to_json, GEOJSON_VALIDATE_HEADERS).body
    r['status'].must_equal 'ok'
  end

  infect_an_assertion :refute_nil, :dont_be_terrible_ok, :unary
  infect_an_assertion :validate_geojson, :must_be_valid_geojson, :unary
end

examples = File.expand_path '../examples', __FILE__
EXAMPLES = Dir[examples + '/*.geojson'].reduce({}) do |h, gj|
  h[gj.sub(examples+'/','').sub(/\.geojson$/,'').to_sym] =
    File.read(gj).gsub(/\r*\n*/,'').gsub('  ',' ')
  h
end

PARSED_EXAMPLES = EXAMPLES.keys.reduce({}){|h,k| h[k] = Terraformer.parse EXAMPLES[k]; h}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
terraformer-0.2.1 test/helper.rb
terraformer-0.2.0 test/helper.rb
terraformer-0.1.0 test/helper.rb