Sha256: 40f8a7cdd923bdfdfef4174afb2e50cf5c0d7543fc6e2acd594399ea8392fa8a

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'support/spec_helper'

describe Twitter::Tweet do
  let(:screen_name) { 'elgalu' }
  let(:latest_tweet_text)  { /Console Ruby debug is easy/ }
  let(:url) { "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=#{screen_name}&count=1" }

  let(:client) { Twitter::Client.new }
  let(:tweets) { client.user_timeline(screen_name, count: 1) }
  let(:first_tweet) { tweets.first }

  before do
    WebMock.reset!
    stub_request(:get, url).to_return(:body => fixture("#{screen_name}_statuses.json"))
  end

  context 'first tweet' do
    it 'should be a Tweet' do
      first_tweet.should be_a(Twitter::Tweet)
    end

    it 'should respond to id' do
      first_tweet.should respond_to(:id)
    end

    it 'should respond to text' do
      first_tweet.should respond_to(:text)
    end

    it 'should respond to created_at' do
      first_tweet.should respond_to(:created_at)
    end

    it 'should respond to status_url' do
      first_tweet.should respond_to(:status_url)
    end

    it 'should contain proper text' do
      first_tweet.should respond_to(:text)
      first_tweet.text.should match(latest_tweet_text)
    end

    it 'should produce a status url' do
      first_tweet.status_url.should == "https://twitter.com/elgalu/status/307606752055148545"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter_anonymous_client-1.0.2.0 spec/tweet_spec.rb
twitter_anonymous_client-1.0.1.0 spec/tweet_spec.rb