Sha256: 3cada5b61f9a64bb6704b00699c2aeece51a2d83c18dd17a5ad029675f3dd785
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
require 'helper' describe Twitter::Identity do describe "#initialize" do it "raises an ArgumentError when type is not specified" do lambda do Twitter::Identity.new end.should raise_error(ArgumentError, "argument must have an :id key") end end context 'identity map enabled' do before do Twitter.identity_map = Twitter::IdentityMap end after do Twitter.identity_map = false end describe '.fetch' do it 'returns existing objects' do Twitter::Identity.store(Twitter::Identity.new(:id => 1)) Twitter::Identity.fetch(:id => 1).should be end it "raises an error on objects that don't exist" do lambda { Twitter::Identity.fetch(:id => 6) }.should raise_error(Twitter::Error::IdentityMapKeyError) end end end describe "#==" do it "returns true when objects IDs are the same" do one = Twitter::Identity.new(:id => 1, :screen_name => "sferik") two = Twitter::Identity.new(:id => 1, :screen_name => "garybernhardt") (one == two).should be_true end it "returns false when objects IDs are different" do one = Twitter::Identity.new(:id => 1) two = Twitter::Identity.new(:id => 2) (one == two).should be_false end it "returns false when classes are different" do one = Twitter::Identity.new(:id => 1) two = Twitter::Base.new(:id => 1) (one == two).should be_false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twitter-4.1.0 | spec/twitter/identifiable_spec.rb |
twitter-4.0.0 | spec/twitter/identifiable_spec.rb |