Sha256: d545557e25dc5ef028e0f8b95592df671e145e5b98ed1df794d8fa621fea7fb0

Contents?: true

Size: 1.43 KB

Versions: 22

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

describe Picky::Sources::Wrappers::Location do
  
  context "with backend" do
    before(:each) do
      @source   = stub :source
      @category = stub :category
    end
    context "without grid option" do
      it "fails" do
        lambda { described_class.new(:something) }.should raise_error
      end
    end
    context "with grid option" do
      before(:each) do
        @wrapper = described_class.new @source, 10
      end
      it "uses a default of 1 on the precision" do
        @wrapper.calculation.precision.should == 1
      end
      it "delegates harvest" do
        @category.stub! :indexing_exact => {}
        
        @source.should_receive(:harvest).once.with @category
        
        @wrapper.harvest @category
      end
      it "delegates take_snapshot" do
        @source.should_receive(:take_snapshot).once.with()
        
        @wrapper.take_snapshot
      end
      it "delegates connect_backend" do
        @source.should_receive(:connect_backend).once.with()
        
        @wrapper.connect_backend
      end
    end
    context "with grid and precision option" do
      before(:each) do
        @wrapper = described_class.new @category, 4, 2
      end
      it "uses the given precision" do
        @wrapper.calculation.precision.should == 2
      end
    end
  end
  context "without backend" do
    it "fails" do
      lambda { described_class.new }.should raise_error(ArgumentError)
    end
  end
  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
picky-3.2.0 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.13 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.12 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.11 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.10 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.9 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.8 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.7 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.6 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.5 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.4 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.3 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.2 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.1 spec/lib/sources/wrappers/location_spec.rb
picky-3.1.0 spec/lib/sources/wrappers/location_spec.rb
picky-3.0.1 spec/lib/sources/wrappers/location_spec.rb
picky-3.0.0 spec/lib/sources/wrappers/location_spec.rb
picky-3.0.0.pre5 spec/lib/sources/wrappers/location_spec.rb
picky-3.0.0.pre4 spec/lib/sources/wrappers/location_spec.rb
picky-3.0.0.pre3 spec/lib/sources/wrappers/location_spec.rb