Sha256: b8d805c110e05aaa0087cc02a74748bcda5a4c092e25f70c24bab96fa9b2c972

Contents?: true

Size: 1.72 KB

Versions: 9

Compression:

Stored size: 1.72 KB

Contents

# Copyright (C) 2010  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.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

class TestPersistence < Test::Unit::TestCase
  include ActiveGroongaTestUtils

  def test_save_hash
    key = "http://groonga.org/"
    title = "groonga"

    site = Site.new
    site.key = key
    site.title = title
    assert_true(site.save)
    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])
  end

  def test_update
    groonga = Site.new
    groonga.key = "http://groonga.org/"
    assert_true(groonga.save)

    groonga.title = "groonga"
    assert_true(groonga.save)

    reloaded_groonga = Site.find("http://groonga.org/")
    assert_equal(["http://groonga.org/", "groonga"],
                 [reloaded_groonga.key, reloaded_groonga.title])
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activegroonga-2.1.2 test/test-persistence.rb
activegroonga-2.1.1 test/test-persistence.rb
activegroonga-1.0.7 test/test-persistence.rb
activegroonga-1.0.6 test/test-persistence.rb
activegroonga-1.0.5 test/test-persistence.rb
activegroonga-1.0.4 test/test-persistence.rb
activegroonga-1.0.3 test/test-persistence.rb
activegroonga-1.0.1 test/test-persistence.rb
activegroonga-1.0.0 test/test-persistence.rb