Sha256: 90c5020b971343cab47f635de88a84376d15925563d41d6059c2d85979f36d62
Contents?: true
Size: 769 Bytes
Versions: 14
Compression:
Stored size: 769 Bytes
Contents
require 'spec_helper' require 'vagrant-notify/data' describe Vagrant::Notify::Data do let!(:data_dir) { Pathname.new(Dir.mktmpdir) } let(:key) { :pid } let(:value) { '123456' } subject { described_class.new(data_dir) } after { FileUtils.rm_rf data_dir.to_s } it 'writes data out to a file' do subject[key] = value data_dir.join(key.to_s).read.should eq value end it 'reads data from files' do data_dir.join(key.to_s).open('w+') { |f| f.write(value) } subject[key].should eq value end it 'handles unset keys' do subject[key].should be_nil end it 'removes the file when a value is set to nil' do subject.tap { |s| s[key] = value; s[key] = nil } data_dir.join(key.to_s).should_not be_file end end
Version data entries
14 entries across 14 versions & 1 rubygems