diff --git a/test/test_chunks_write.rb b/test/test_chunks_write.rb index a7988d40..4f0a8676 100644 --- a/test/test_chunks_write.rb +++ b/test/test_chunks_write.rb @@ -71,7 +71,6 @@ def test_put_delete_data end def test_reentrant_queries - skip "TODO: why does this test fail?" ntriples_file_path = "./test/data/nemo_ontology.ntriples" # Bypass in chunks @@ -87,8 +86,8 @@ def test_reentrant_queries tput = Thread.new { Goo.sparql_data_client.put_triples(ONT_ID_EXTRA, ntriples_file_path, mime_type="application/x-turtle") + sleep(1.5) } - sleep(1.5) count_queries = 0 tq = Thread.new { 5.times do @@ -112,8 +111,8 @@ def test_reentrant_queries tdelete = Thread.new { Goo.sparql_data_client.delete_graph(ONT_ID_EXTRA) + sleep(1.5) } - sleep(1.5) count_queries = 0 tq = Thread.new { 5.times do diff --git a/test/test_collections.rb b/test/test_collections.rb index 390ad349..2177c669 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -91,18 +91,18 @@ def test_unique_per_collection def test_inverse_on_collection skip "Not supported inverse on collection" - john = User.find("John").include(:name).first || - User.new(name: "John").save() + john = User.find("John").include(:name).first || User.new(name: "John").save + 5.times do |i| - Issue.new(description: "issue_#{i}", owner: john).save + Issue.find("issue_#{i}").in(john) || Issue.new(description: "issue_#{i}", owner: john).save end - - binding.pry - User.find("John",include: [:issues]).first.issues - User.find("John",include: [issues: [:desciption]]).first.issues - 5.times do |i| - Issue.find("issue_#{i}", collection: john).delete + issues = User.find("John").include(:issues).first.issues + assert_equal 5, issues.size + + issues.each do |issue| + assert_equal "issue_#{i}", issue.description + assert_equal john, issue.collection end end diff --git a/test/test_read_only.rb b/test/test_read_only.rb index 4496c463..268f7c86 100644 --- a/test/test_read_only.rb +++ b/test/test_read_only.rb @@ -39,11 +39,17 @@ def test_struct_find end def test_embed_struct - skip "not yet" + students = Student.where(enrolled: [university: [name: "Stanford"]]) .include(:name) - .include(enrolled: [:name, university: [ :address ]]) + .include(enrolled: [:name, university: [ :address, :name ]]) .read_only.all + + assert_equal 3, students.size + students.each do |st| + assert st.enrolled.any? {|e| e.is_a?(Struct) && e.university.name.eql?('Stanford')} + end + end end end