Sha256: 211f76a0800526f05dbe5182b95d0d3331d5d682002b3de66e0946233ed3a091

Contents?: true

Size: 947 Bytes

Versions: 5

Compression:

Stored size: 947 Bytes

Contents

require 'spec_helper'

describe Sources::Wrappers::Base do
  
  context "with backend" do
    it "doesn't fail" do
      lambda { Sources::Wrappers::Base.new(:something) }.should_not raise_error
    end
    before(:each) do
      @backend = stub :backend
      @wrapper = Sources::Wrappers::Base.new @backend
    end
    it "delegates harvest" do
      @backend.should_receive(:harvest).once.with :some_type, :some_field
      
      @wrapper.harvest :some_type, :some_field
    end
    it "delegates take_snapshot" do
      @backend.should_receive(:take_snapshot).once.with :some_type
      
      @wrapper.take_snapshot :some_type
    end
    it "delegates connect_backend" do
      @backend.should_receive(:connect_backend).once.with # nothing
      
      @wrapper.connect_backend
    end
  end
  context "without backend" do
    it "fails" do
      lambda { Sources::Wrappers::Base.new }.should raise_error(ArgumentError)
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
picky-0.12.1 spec/lib/sources/wrappers/base_spec.rb
picky-0.12.0 spec/lib/sources/wrappers/base_spec.rb
picky-0.11.2 spec/lib/sources/wrappers/base_spec.rb
picky-0.11.1 spec/lib/sources/wrappers/base_spec.rb
picky-0.11.0 spec/lib/sources/wrappers/base_spec.rb