Sha256: 74647de57e1545e4053a4c0d4d1cf985cea2f9c7a1e20bdd968f4bd65bd75242

Contents?: true

Size: 740 Bytes

Versions: 1

Compression:

Stored size: 740 Bytes

Contents

require 'spec_helper'

describe SSDB::Batch do

  let :futures do
    subject.instance_variable_get(:@futures)
  end

  let :calling do
    -> { subject.call cmd: ["incr", "key", 2] }
  end

  it { should be_a(Array) }

  describe "#call" do

    it 'should store commands' do
      calling.should change { subject.count }.by(1)
      subject.last.should include(:cmd)
    end

    it 'should remember futures' do
      calling.should change { futures.count }.by(1)
      futures.last.should be_instance_of(SSDB::Future)
    end

  end

  describe "applying values" do
    before { 3.times { calling.call } }

    it 'should set feature' do
      subject.values = [2, 4, 6]
      futures.map(&:value).should == [2, 4, 6]
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ssdb-0.1.0 spec/ssdb/batch_spec.rb