Sha256: c0c9af07f4ea00b2e6aa0d629b8fc664988fd5199ad2bbde71ca0b8b29bdfbac

Contents?: true

Size: 989 Bytes

Versions: 17

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true

module ThinkingSphinx
  module Panes; end
end

require 'thinking_sphinx/panes/distance_pane'

describe ThinkingSphinx::Panes::DistancePane do
  let(:pane)    {
    ThinkingSphinx::Panes::DistancePane.new context, object, raw }
  let(:context) { double('context') }
  let(:object)  { double('object') }
  let(:raw)     { {} }

  describe '#distance' do
    it "returns the object's geodistance attribute by default" do
      raw['geodist'] = 123.45

      expect(pane.distance).to eq(123.45)
    end

    it "converts string geodistances to floats" do
      raw['geodist'] = '123.450'

      expect(pane.distance).to eq(123.45)
    end
  end

  describe '#geodist' do
    it "returns the object's geodistance attribute by default" do
      raw['geodist'] = 123.45

      expect(pane.geodist).to eq(123.45)
    end

    it "converts string geodistances to floats" do
      raw['geodist'] = '123.450'

      expect(pane.geodist).to eq(123.45)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
thinking-sphinx-5.6.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.5.1 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.5.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.4.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.3.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.2.1 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.2.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.1.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-5.0.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.4.1 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.4.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.3.2 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.3.1 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.3.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.2.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.1.0 spec/thinking_sphinx/panes/distance_pane_spec.rb
thinking-sphinx-4.0.0 spec/thinking_sphinx/panes/distance_pane_spec.rb