Sha256: c42957178c3d4f90ea80375858a164f8718007571cd1b1ebbdf606e527b4fee5
Contents?: true
Size: 1.14 KB
Versions: 20
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Geoblacklight::BoundingBox do describe '#initialize' do it 'handles multiple input types as arguments' do expect(described_class.new('1', '1', '1', '1')).to be_an described_class expect(described_class.new(1, 2, 3, 3)).to be_an described_class expect(described_class.new(1.1, 2.1, 3.1, 3.1)).to be_an described_class end end describe '#to_envelope' do let(:example_box) { described_class.new(-160, -80, 120, 70) } it 'creates an envelope syntax version of the bounding box' do expect(example_box.to_envelope).to eq 'ENVELOPE(-160, 120, 70, -80)' end end describe '#from_rectangle' do let(:example_box) { described_class.from_rectangle('-160 -80 120 70') } it 'parses and creates a Geoblacklight::BoundingBox from a Solr lat-lon' do expect(example_box).to be_an described_class expect(example_box.to_envelope).to eq 'ENVELOPE(-160, 120, 70, -80)' end it 'checks for valididity' do expect { described_class.from_rectangle('-160 -80 120') }.to raise_error Geoblacklight::Exceptions::WrongBoundingBoxFormat end end end
Version data entries
20 entries across 20 versions & 1 rubygems