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

Version Path
geoblacklight-3.8.1 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.8.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0.pre.rc3 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.7.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0.pre.rc2 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0.pre.rc1 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.6.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.5.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0.pre.alpha.3 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0.pre.alpha.2 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0.pre.alpha.1 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-4.0.0.pre.alpha spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.4.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.3.1 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.3.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.2.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.1.0 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.0.1 spec/lib/geoblacklight/bounding_box_spec.rb
geoblacklight-3.0.0 spec/lib/geoblacklight/bounding_box_spec.rb