Sha256: f8c75cef4194e2771a7d65cf3bbf8f4df521d46889007a290676038627eed57a

Contents?: true

Size: 968 Bytes

Versions: 9

Compression:

Stored size: 968 Bytes

Contents

require "spec_helper"

describe Trifle do

  it "should extend InitializeWithRedis" do
    Trifle.included_modules.should include(Trifle::InitializeWithRedis)
  end

  describe "#load" do
    before do
      @redis = Redis.new
      @trifle = Trifle.new(@redis)
      @options = { filenames: "foobar.csv" }
    end

    it "should pass this to the loader" do
      loader = mock Trifle::Loader
      Trifle::Loader.should_receive(:new).with(@redis, key: @trifle.key).and_return(loader)
      loader.should_receive(:handle).with(@options)
      @trifle.load @options
    end
  end

  describe "#find" do
    before do
      @redis = Redis.new
      @trifle = Trifle.new(@redis)
      @ip = "127.0.0.1"
    end

    it "should pass this to the finder" do
      finder = mock Trifle::Finder
      Trifle::Finder.should_receive(:new).with(@redis, key: @trifle.key).and_return(finder)
      finder.should_receive(:handle).with(@ip)
      @trifle.find @ip
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
trifle-0.1.0 spec/trifle_spec.rb
trifle-0.0.9 spec/trifle_spec.rb
trifle-0.0.8 spec/trifle_spec.rb
trifle-0.0.7 spec/trifle_spec.rb
trifle-0.0.6 spec/trifle_spec.rb
trifle-0.0.5 spec/trifle_spec.rb
trifle-0.0.4 spec/trifle_spec.rb
trifle-0.0.3 spec/trifle_spec.rb
trifle-0.0.2 spec/trifle_spec.rb