Sha256: 8c6932eb0402722f2284f6d349f4176ae8b7a534ee368998065af8be8c9ea878

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 Bytes

Contents

module LazyValueExamples

  extend Minitest::Spec::DSL

  def lazy_value(key)
    Asynchronic::DataStore::LazyValue.new data_store, key
  end

  it 'Get' do
    value = lazy_value :key
    value.must_be_nil

    data_store[:key] = 1
    value.must_equal 1
  end

  it 'Reload' do
    value = lazy_value :key

    data_store[:key] = 1
    value.must_equal 1

    data_store[:key] = 2
    value.must_equal 1
    value.reload.must_equal 2
  end

  it 'Transparent proxy' do
    value = lazy_value :key
    data_store[:key] = 1
    value.must_equal 1
  end

  it 'Inspect' do
    value = lazy_value :key
    value.inspect.must_match /#<Asynchronic::DataStore::LazyValue @data_store_class=.+ @data_store_connection_args=.+ @key=key>/
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
asynchronic-4.0.3 spec/data_store/lazy_value_examples.rb
asynchronic-4.0.2 spec/data_store/lazy_value_examples.rb
asynchronic-4.0.1 spec/data_store/lazy_value_examples.rb
asynchronic-4.0.0 spec/data_store/lazy_value_examples.rb