test/test-persistence.rb in activegroonga-2.1.2 vs test/test-persistence.rb in activegroonga-2.1.3
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright (C) 2010 Kouhei Sutou <kou@clear-code.com>
+# Copyright (C) 2010-2013 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
@@ -28,15 +28,36 @@
found_site = Site.find(key)
assert_equal([key, title],
[found_site.key, found_site.title])
end
- def test_create_hash
- groonga = Site.create(:key => "http://groonga.org/",
- :title => "groonga")
- found_groonga = Site.find("http://groonga.org/")
- assert_equal(["http://groonga.org/", "groonga"],
- [found_groonga.key, found_groonga.title])
+ class TestCreate < self
+ def test_hash
+ groonga = Site.create(:key => "http://groonga.org/",
+ :title => "groonga")
+ found_groonga = Site.find("http://groonga.org/")
+ assert_equal(["http://groonga.org/", "groonga"],
+ [found_groonga.key, found_groonga.title])
+ end
+
+ class TestReference < self
+ def test_have_key
+ groonga = Site.create(:key => "http://groonga.org/",
+ :title => "groonga")
+ doc = Page.create(:key => "http://groonga.org/doc/",
+ :site => groonga)
+ found_doc = Page.find("http://groonga.org/doc/")
+ assert_equal(groonga.key, found_doc.site.key)
+ end
+
+ def test_no_key
+ daijiro = @user_records[:daijiro]
+ groonga = Bookmark.create(:uri => "http://groonga.org/",
+ :user => daijiro)
+ found_groonga = Bookmark.find(groonga.id)
+ assert_equal(daijiro.id, found_groonga.user.id)
+ end
+ end
end
def test_update
groonga = Site.new
groonga.key = "http://groonga.org/"