Sha256: 05e18b40fd4235fb506624f81a4e2c687007d6d3b2a5560c6376696c7e240f86
Contents?: true
Size: 1.52 KB
Versions: 4
Compression:
Stored size: 1.52 KB
Contents
require 'helper' describe Toy::Identity::NativeUUIDKeyFactory do uses_constants('User') it "should use SimpleUUID::UUID as key_type" do subject.key_type.should be(SimpleUUID::UUID) end it "should use uuid for next_key" do result = subject.next_key(nil) result.should be_instance_of(SimpleUUID::UUID) end describe "#eql?" do it "returns true for same class and key type" do subject.eql?(described_class.new).should be_true end it "returns false for same class and different key type" do other = described_class.new other.stub(:key_type).and_return(Integer) subject.eql?(other).should be_false end it "returns false for different classes" do subject.eql?(Object.new).should be_false end end describe "#==" do it "returns true for same class and key type" do subject.==(described_class.new).should be_true end it "returns false for same class and different key type" do other = described_class.new other.stub(:key_type).and_return(Integer) subject.==(other).should be_false end it "returns false for different classes" do subject.==(Object.new).should be_false end end describe "Declaring key to be uuid" do before(:each) do User.key(:native_uuid) end it "returns SimpleUUID::UUID as .key_type" do User.key_type.should be(SimpleUUID::UUID) end it "sets id attribute to SimpleUUID::UUID type" do User.attributes['id'].type.should be(SimpleUUID::UUID) end end end
Version data entries
4 entries across 4 versions & 1 rubygems