Sha256: cd99ad3c6a98c6d5e36cf80bb2b3d3526fabbc27bf43d0881980213a94f75bae

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

module Twinkies
  describe Item do
    describe "created" do
      before(:each) do
        @tweet = Twitter::Status.new
        @tweet.id = 123
        @tweet.text = "hello mang!"
        @tweet.created_at = DateTime.parse('7/24/1985')
        @user = Twitter::User.new
        @user.screen_name = 'padillac'
        @tweet.user = @user
        @item = Item.create :tweet => @tweet, :link => "http://foo"
      end

      it "should get the twitter ID from the tweet id" do
        @item.twitter_id.should == 123
      end

      it "should get the text from the tweet" do
        @item.text.should == "hello mang!"
      end

      it "should get the screen name from the tweet" do
        @item.user.should == 'padillac'
      end

      it "should get the date from the tweet" do
        @item.created_at.should == DateTime.parse('7/24/1985')
      end

      describe "created with the same twitter ID" do
        it "should return existing record if URLs are the same" do
          i = Item.create :tweet => @tweet, :link => "http://foo"
          i.should == @item
        end

        it "should create a new item if URLs are different" do
          i = Item.create :tweet => @tweet, :link => "http://bar"
          i.should_not == @item
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pat-maddox-twinkies-0.1.0 spec/item_spec.rb
pat-maddox-twinkies-0.1.1 spec/item_spec.rb
pat-maddox-twinkies-0.1.2 spec/item_spec.rb
pat-maddox-twinkies-0.1.3 spec/item_spec.rb
pat-maddox-twinkies-0.1.4 spec/item_spec.rb
pat-maddox-twinkies-0.1.5 spec/item_spec.rb