Sha256: 815d10b91ec7e39b50c153a997b0d272245568557beafacda97f0ca923dc9e97

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require_relative './test_helper'

describe SparaMem do
  before { @db = SparaMem.new }

  it '#initialize' do
    @db.must_be_instance_of SparaMem
  end

  it '#set' do
    @db.set('defined', 'i am not nil').must_equal 'i am not nil'
    @db.get('defined').must_equal 'i am not nil'
  end

  describe SparaMem do
    before { @db.set('defined', 'i am not nil') }

    it '#get' do
      @db.get('defined').must_equal 'i am not nil'
      @db.get('undefined').must_equal nil
    end

    it '#del' do
      @db.del('defined').must_equal 'i am not nil'
      @db.get('defined').must_equal nil
    end

    it '#keys' do
      @db.keys.must_be_instance_of Array
      @db.keys.must_include 'defined'
      @db.keys.wont_include 'undefined'
    end

    it '#vals' do
      @db.vals.must_be_instance_of Array
      @db.vals.must_include 'i am not nil'
      @db.vals.wont_include nil
    end

    it '#all' do
      @db.all.must_be_instance_of Hash
      @db.all.keys.must_include 'defined'
      @db.all.keys.wont_include 'undefined'
      @db.all.values.must_include 'i am not nil'
      @db.all.values.wont_include nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spara-0.0.1 test/spara_mem_test.rb