Sha256: d38a966c239a5800c3dde605a28ba00dc64e04335282930f70fccafbf7f68d40

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe "Ripple Search Associations" do
  require 'support/test_server'

  before :all do
    Object.module_eval do
      class Transaction
        include Ripple::Document
        property :account_key, String
        property :name, String
      end
      class Account
        include Ripple::Document
        many :transactions, :using => :reference
        property :email, String
      end
    end
  end

  before :each do
    pending("depends upon riak search, which is not available") unless $test_server.riak_search?
    @account      = Account.new(:email => 'riak@ripple.com')
    @transaction1 = Transaction.new(:name => 'One')
    @transaction2 = Transaction.new(:name => 'Two')
  end

  it "should save a many referenced association" do
    @account.save!
    @account.transactions << @transaction1 << @transaction2
    @transaction1.save!
    @transaction2.save!
    @found = Account.find(@account.key)
    @found.transactions.map(&:key).should include(@transaction1.key)
    @found.transactions.map(&:key).should include(@transaction2.key)
  end

  after :all do
    Object.send(:remove_const, :Account)
    Object.send(:remove_const, :Transaction)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seomoz-ripple-1.0.0.pre spec/integration/ripple/search_associations_spec.rb