Sha256: 35e73eec43cae537760b17f98c7127feca17014b40cb265b9e4c949983f458ea
Contents?: true
Size: 561 Bytes
Versions: 15
Compression:
Stored size: 561 Bytes
Contents
require_relative "helper" 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
15 entries across 15 versions & 3 rubygems