Sha256: f5377c6af26843ae8746a7f31bc9e34224eb62f9ee2a027aad8448e693c01d68

Contents?: true

Size: 1.1 KB

Versions: 37

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

module Volt
  module Persistors
    describe Flash do
      let(:fake_parent) { double('Parent', delete: true) }
      let(:fake_passed_model) { double }

      let(:fake_model) do
        double(
          'Model',
          size: 1,
          parent: fake_parent,
          path: '12',
          delete: true
        )
      end

      describe '#added' do
        it 'returns nil' do
          flash = described_class.new double

          expect(flash.added(double, 0)).to be_nil
        end
      end

      describe '#clear_model' do
        it 'sends #delete to @model' do
          described_class.new(fake_model).clear_model fake_passed_model

          expect(fake_model).to have_received(:delete).with(fake_passed_model)
        end

        it 'with a size of zero, parent receives #delete' do
          collection_name = fake_model.path[-1]
          allow(fake_model).to receive(:size).and_return 0

          described_class.new(fake_model).clear_model fake_passed_model

          expect(fake_parent).to have_received(:delete).with(collection_name)
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 spec/models/persistors/flash_spec.rb
volt-0.9.7.pre7 spec/models/persistors/flash_spec.rb
volt-0.9.7.pre6 spec/models/persistors/flash_spec.rb
volt-0.9.7.pre5 spec/models/persistors/flash_spec.rb
volt-0.9.7.pre3 spec/models/persistors/flash_spec.rb
volt-0.9.7.pre2 spec/models/persistors/flash_spec.rb
volt-0.9.6 spec/models/persistors/flash_spec.rb
volt-0.9.6.pre3 spec/models/persistors/flash_spec.rb
volt-0.9.6.pre2 spec/models/persistors/flash_spec.rb
volt-0.9.6.pre1 spec/models/persistors/flash_spec.rb
volt-0.9.5 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre12 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre11 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre9 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre8 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre7 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre6 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre5 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre4 spec/models/persistors/flash_spec.rb
volt-0.9.5.pre3 spec/models/persistors/flash_spec.rb