Sha256: b6f26c0c60c399f31a0b668a89e8bd8996eafef98ab1ea8a4e9e4584228a60a2

Contents?: true

Size: 964 Bytes

Versions: 19

Compression:

Stored size: 964 Bytes

Contents

require 'spec_helper'
require 'volt/models'

describe Volt::Persistors::Store do
  it 'should tell the persistor when the model has changed' do
    persistor = double('volt/persistor')
    persistor_instance = double('volt/persistor instance')
    expect(persistor_instance).to receive(:loaded)
    expect(persistor).to receive(:new).and_return(persistor_instance)

    @model = Volt::Model.new(nil, persistor: persistor)

    expect(persistor_instance).to receive(:changed)

    @model._attr = 'yes'
  end

  it 'should tell the persistor when something is added to an array model' do
    persistor = double('volt/persistor')
    persistor_instance = double('volt/persistor instance')
    expect(persistor_instance).to receive(:loaded)
    expect(persistor).to receive(:new).and_return(persistor_instance)

    @model = Volt::ArrayModel.new([1, 2, 3], persistor: persistor)

    expect(persistor_instance).to receive(:added).with(4, 3)

    @model << 4
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
volt-0.8.27.beta6 spec/models/persistors/store_spec.rb
volt-0.8.27.beta5 spec/models/persistors/store_spec.rb
volt-0.8.27.beta4 spec/models/persistors/store_spec.rb
volt-0.8.27.beta3 spec/models/persistors/store_spec.rb
volt-0.8.27.beta2 spec/models/persistors/store_spec.rb
volt-0.8.27.beta1 spec/models/persistors/store_spec.rb
volt-0.8.26.beta1 spec/models/persistors/store_spec.rb
volt-0.8.26 spec/models/persistors/store_spec.rb
volt-0.8.24 spec/models/persistors/store_spec.rb
volt-0.8.23 spec/models/persistors/store_spec.rb
volt-0.8.22 spec/models/persistors/store_spec.rb
volt-0.8.22.beta2 spec/models/persistors/store_spec.rb
volt-0.8.22.beta1 spec/models/persistors/store_spec.rb
volt-0.8.21 spec/models/persistors/store_spec.rb
volt-0.8.20 spec/models/persistors/store_spec.rb
volt-0.8.19 spec/models/persistors/store_spec.rb
volt-0.8.18 spec/models/persistors/store_spec.rb
volt-0.8.17 spec/models/persistors/store_spec.rb
volt-0.8.16 spec/models/persistors/store_spec.rb