Sha256: 334f086c57d35ff9504ca3f2701a26e60c4884ce34ba7c15e8db053aae43ecb6
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
begin require 'spec' rescue LoadError require 'rubygems' gem 'rspec' require 'spec' end $:.unshift(File.dirname(__FILE__) + '/../lib') require 'geo_ruby' require 'geo_ruby/shp4r' require 'geo_ruby/gpx4r' include GeoRuby include SimpleFeatures module GeorubyMatchers class BeGeometric def matches?(actual) actual.ancestors.include?(actual) || actual.kind_of?("Geometry") end def failure_message; "expected #{@actual.inspect} to be some geom"; end end class BeAPoint include Spec::Matchers def initialize(expect=nil) @expect = expect end def matches?(actual) if @expect [:x, :y, :z, :m].each_with_index do |c, i| next unless val = @expect[i] if val.kind_of? Numeric actual.send(c).should be_close(val, 0.1) else actual.send(c).should eql(val) end end end actual.should be_instance_of(Point) end def failure_message; "expected #{@expect} but received #{@actual.inspect}"; end def negative_failure_message; "expected something else then '#{@expect}' but got '#{@actual}'"; end end def be_a_point(*args) args.empty? ? BeAPoint.new : BeAPoint.new(args) end def be_geometric BeGeometric.new end end Spec::Runner.configure do |config| config.include GeorubyMatchers end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
georuby_remake-1.0.0 | spec/spec_helper.rb |