Sha256: 4fafcaa9c08ecf4a533fe4eb69cff46a0f917b655213ac079c6fe39425d42485

Contents?: true

Size: 973 Bytes

Versions: 3

Compression:

Stored size: 973 Bytes

Contents

require 'spec_helper'

describe "Ripple Search Associations", :integration => true, :search => true do
  class SearchTransaction
    include Ripple::Document
    property :search_account_key, String
    property :name, String
  end

  class SearchAccount
    include Ripple::Document
    many :search_transactions, :using => :reference
    property :email, String
  end

  before :each do
    @account      = SearchAccount.new(:email => 'riak@ripple.com')
    @transaction1 = SearchTransaction.new(:name => 'One')
    @transaction2 = SearchTransaction.new(:name => 'Two')
  end

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

Version data entries

3 entries across 3 versions & 2 rubygems

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