Sha256: 8e955c0d07bea4b1641fa942c8e553f408e55502676282312ece33aa512cae99

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe "Ripple Persistence" do
  before :each do
    @widget = Widget.new
  end

  it "should save an object to the riak database" do
    @widget.save
    @found = Widget.find(@widget.key)
    @found.should be_a(Widget)
  end

  it "should save attributes properly to riak" do
    @widget.attributes = {:name => 'Sprocket', :size => 10}
    @widget.save
    @found = Widget.find(@widget.key)
    @found.name.should == 'Sprocket'
    @found.size.should == 10
  end
end

describe Ripple::Document do
  let(:custom_data)        { Subscription::MyCustomType.new('bar') }
  let(:days_of_month)      { Set.new([1, 7, 15, 23]) }
  let(:subscription)       { Subscription.create!(:custom_data => custom_data, :days_of_month => days_of_month) }
  let(:found_subscription) { Subscription.find(subscription.key) }

  it 'allows properties with custom types to be saved and restored from riak' do
    found_subscription.custom_data.should == custom_data
  end

  it 'allows Set properties to be saved and restored from riak' do
    found_subscription.days_of_month.should == days_of_month
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
wyngle-ripple-0.1.0 spec/integration/ripple/persistence_spec.rb
ripple-1.0.0.beta2 spec/integration/ripple/persistence_spec.rb
ripple-1.0.0.beta spec/integration/ripple/persistence_spec.rb