Sha256: 34ac0bf48fcad89f2cb59c80f1d4308d29b7410321d3fcad27d4b7eb51cdd49e
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require 'helper' describe Toy::Identity::UUIDKeyFactory do uses_constants('User') it "should use String as key_type" do subject.key_type.should be(String) end it "should use uuid for next_key" do subject.next_key(nil).length.should == 36 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(:uuid) end it "returns String as .key_type" do User.key_type.should be(String) end it "sets id attribute to String type" do User.attributes['id'].type.should be(String) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
toystore-0.13.2 | spec/toy/identity/uuid_key_factory_spec.rb |
toystore-0.13.1 | spec/toy/identity/uuid_key_factory_spec.rb |