Sha256: 2e02713ad803ec98605c53b4679d9c542532677018bd785f183f5a9773e32064
Contents?: true
Size: 538 Bytes
Versions: 21
Compression:
Stored size: 538 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
Version data entries
21 entries across 21 versions & 1 rubygems