Sha256: 3ea2a9989824ddc7e2ed4370d7bebdb2587bd4cc255f003a5694aa1ce44eec88
Contents?: true
Size: 1.63 KB
Versions: 4
Compression:
Stored size: 1.63 KB
Contents
require File.dirname(__FILE__) + '/spec_helper.rb' attrs = {:now => Time.new.to_s, :then => 'Sat Sep 26 13:32:22 -0700 2009'} describe Tweetable::Persistable do before do RedisSpecHelper.reset end context 'when building' do before do Tweetable.login('l', 'p') end it "should have a twitter client" do item = Tweetable::Persistable.create(:created_at => attrs[:now], :updated_at => attrs[:now]) item.send(:client).class.should == Tweetable::TwitterClient end it "should store a persistable item with dates" do item = Tweetable::Persistable.create(:created_at => attrs[:now], :updated_at => attrs[:now]) item.should be_valid end it "should find or create new" do item = Tweetable::User.find_or_create(:screen_name, 'Flippyhead') item.should be_valid end it "should find or create existing" do existing = Tweetable::User.create(:screen_name => 'Flippyhead', :created_at => Time.now.utc.to_s) item = Tweetable::User.find_or_create(:screen_name, 'Flippyhead') existing.id.to_s.should == item.id.to_s end end context 'when needs update' do it "should not need_update when new" do item = Tweetable::Persistable.create(:updated_at => attrs[:now]) item.should_not be_needs_update end it "should need_update when old enough" do item = Tweetable::Persistable.create(:updated_at => attrs[:then]) item.should be_needs_update end it "should need_update when forced" do item = Tweetable::Persistable.create(:updated_at => attrs[:now]) item.should be_needs_update(true) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tweetable-0.1.14 | spec/persistable_spec.rb |
tweetable-0.1.13 | spec/persistable_spec.rb |
tweetable-0.1.11 | spec/persistable_spec.rb |
tweetable-0.1.10 | spec/persistable_spec.rb |