Sha256: 74989751216a2365b02a6dd9004a5531531e9d50ab039f6ea13a04d7f3c37a2b

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

RSpec.describe Counter::Cache::Counters::BufferCounter do
  let(:options) { {} }
  let(:source_object) { double }
  let(:counter) { Counter::Cache::Counters::BufferCounter.new(source_object, options) }

  describe "#update" do
    it "calls update! on an instance of an updater" do
      updater = double
      expect(updater).to receive(:update!).with(:blah)
      expect(Counter::Cache::Counters::BufferCounter::Updater).to receive(:new).with(source_object,
                                                                            an_instance_of(Counter::Cache::OptionsParser),
                                                                            "Counter::Cache::Counters::BufferCounter").and_return(updater)
      counter.update(:blah)
    end
  end

  describe "#save!" do
    it "calls save! on an instance of a saver" do
      saver = double
      expect(saver).to receive(:save!)
      expect(Counter::Cache::Counters::BufferCounter::Saver).to receive(:new).with(an_instance_of(Counter::Cache::OptionsParser)).and_return(saver)
      counter.save!
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
counter-cache-0.3.0 spec/lib/counter/cache/buffer_counter_spec.rb
counter-cache-0.2.0 spec/lib/counter/cache/buffer_counter_spec.rb
counter-cache-0.1.0 spec/lib/counter/cache/buffer_counter_spec.rb
counter-cache-0.0.2 spec/lib/counter/cache/buffer_counter_spec.rb
counter-cache-0.0.1 spec/lib/counter/cache/buffer_counter_spec.rb