test/spara_disk_test.rb in spara-0.0.1 vs test/spara_disk_test.rb in spara-0.0.2
- old
+ new
@@ -1,12 +1,11 @@
-require_relative './test_helper'
+require_relative 'test_helper'
describe SparaDisk do
before do
- file_name = File.expand_path('../test.db', __FILE__)
- File.delete(file_name) if File.exists?(file_name)
@db = SparaDisk.new('test.db')
+ @db.clean!
end
it '#initialize' do
@db.must_be_instance_of SparaDisk
end
@@ -45,8 +44,15 @@
@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
+
+ it '#clean!' do
+ @db.clean!
+ @db.keys.must_be_empty
+ @db.vals.must_be_empty
+ @db.all.must_equal({})
end
end
end