Sha256: 970abefdfba3969b79e416d1baa8a7eda1b80a65e68e3871dd44c6cfdc660496

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

require 'valise'
require 'file-sandbox'

describe Valise do
  include FileSandbox

  let :valise do
    sandbox.new :directory => "base/test"
    Valise::Set.define do
      handle "test/yaml-file", :yaml
      rw "base"
    end
  end

  let :item do
    valise.get("test/yaml-file").first
  end

  it "should store data as YAML" do
    item.contents = { :a => "test hash" }
    item.save
    YAML::load( File::read(item.full_path)).should == { :a => "test hash" }
  end

  it "should load data from YAML" do
    File::open(item.full_path, "w") do |file|
      file.write(YAML::dump( :another => "test hash" ))
    end
    item.contents.should == {:another => "test hash"}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
valise-0.3 spec/dump_load.rb