Sha256: e3c32d399d43e06d7b9f45d5807ecbecddc0e1caaecb2ee45568e3bb6346482c

Contents?: true

Size: 858 Bytes

Versions: 9

Compression:

Stored size: 858 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Candy::CandyHash do
  before(:all) do
    @verifier = Zagnut.collection
  end

  before(:each) do
    @this = Zagnut.new
    @this.filling = {taste: 'caramel', ounces: 0.75}
  end
  
  it "writes the hash" do
    @verifier.find_one['filling']['ounces'].should == 0.75
  end
  
  it "reads the hash" do
    that = Zagnut(@this.id)
    that.filling.taste.should == 'caramel'
    that.filling.should be_a(Hash)
  end
  
  it "cascades changes" do
    @this.filling[:calories] = 250
    that = Zagnut(@this.id)
    that.filling.calories.should == 250
  end
  
  it "cascades deeply" do
    @this.filling.subfilling = {texture: :gravel}
    that = Zagnut(@this.id)
    that.filling.subfilling.texture.should == :gravel
  end
  
  after(:each) do
    Zagnut.collection.remove
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
candy-0.2.9 spec/candy/hash_spec.rb
candy-0.2.8 spec/candy/hash_spec.rb
candy-0.2.7 spec/candy/hash_spec.rb
candy-0.2.6 spec/candy/hash_spec.rb
candy-0.2.5 spec/candy/hash_spec.rb
candy-0.2.4 spec/candy/hash_spec.rb
candy-0.2.3 spec/candy/hash_spec.rb
candy-0.2.2 spec/candy/hash_spec.rb
candy-0.2.1 spec/candy/hash_spec.rb