Sha256: 271ef062edad7ef5556e321b00b45b2cbc2cb2a872db407d14bcf42066e575ed
Contents?: true
Size: 615 Bytes
Versions: 10
Compression:
Stored size: 615 Bytes
Contents
# encoding: UTF-8 require File.expand_path("./helper", File.dirname(__FILE__)) class Tag < Ohm::Model attribute :name end test "using a new record as a hash key" do tag = Tag.new hash = { tag => "Ruby" } assert "Ruby" == hash[tag] assert hash[Tag.new].nil? end test "on a persisted model" do tag = Tag.create(:name => "Ruby") assert "Ruby" == { tag => "Ruby" }[tag] end test "on a reloaded model" do tag = Tag.create(:name => "Ruby") hash = { tag => "Ruby" } tag = Tag[tag.id] assert "Ruby" == hash[tag] end test "on attributes class method" do assert [:name] == Tag.attributes end
Version data entries
10 entries across 10 versions & 1 rubygems