Sha256: 3ab719bff7de3cdf82f74fc427b33f650f094bc28326c49a0e15fa0c4af12f9c
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
require File.expand_path('../test_helper', __FILE__) # TODO use association_test classes class QueryTest < MiniTest::Unit::TestCase def setup super @model = Fauna::Resource.create 'classes/message_boards' @posts_set = @model.set 'posts' @posts = [] @comments = [] 3.times do |i| post = Fauna::Resource.create( 'classes/posts', { :data => { :topic => "The Horned King" } }) @posts << post @posts_set.add(post) 3.times do |j| comment = Fauna::Resource.create( 'classes/comments', { :data => { :text => "Do not show the Horned King the whereabouts of the Black Cauldron!" } }) @comments << comment Fauna::CustomSet.new("#{post.ref}/sets/comments").add(comment) end end end def test_join query = Fauna::Set.join @posts_set, '_/sets/comments' assert_equal 9, query.page.size @comments.flatten.each do |comment| assert query.page.include? comment.ref end end def test_match query = Fauna::Set.match 'classes/posts', 'data.topic', 'The Horned King' assert query.page.size > 1 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fauna-1.3.2 | test/query_test.rb |
fauna-1.3 | test/query_test.rb |
fauna-1.2 | test/query_test.rb |