Sha256: 3d5419ce39eeeccc36fb5bbc8f0d76492de497582524bbb36f746556b249c0e6

Contents?: true

Size: 1.42 KB

Versions: 9

Compression:

Stored size: 1.42 KB

Contents

require 'helper'
include Safubot::Twitter

describe Safubot::Twitter do
  before(:all) do
	Safubot::Test.clean_environment
	@raw_tweet = fixture('twitter/tweet')
	@raw_dm = fixture('twitter/direct_message')
  end

  it 'should store a tweet' do
	tweet = Tweet.from(@raw_tweet)
	tweet.reload
	tweet.raw.should == @raw_tweet
  end

  it 'should not store duplicate tweets' do
	tweet1 = Tweet.from(@raw_tweet)
	tweet2 = Tweet.from(@raw_tweet)
	tweet1.should == tweet2
  end

  it 'should make a request from a tweet' do
	tweet = Tweet.from(@raw_tweet)
	req = tweet.make_request
	req.source.should == tweet
	req.text.should == tweet.targetless_text
	req.user.should == tweet.user
  end

  it 'should not derive duplicate requests from a tweet' do
	tweet = Tweet.from(@raw_tweet)
	tweet.make_request.should == tweet.make_request
  end

  it 'should store a direct message' do
	dm = DirectMessage.from(@raw_dm)
	dm.reload
	dm.raw.should == @raw_dm
  end

  it 'should not store duplicate direct messages' do
	dm1 = DirectMessage.from(@raw_dm)
	dm2 = DirectMessage.from(@raw_dm)
	dm1.should == dm2
  end

  it 'should make a request from a direct message' do
	dm = DirectMessage.from(@raw_dm)
	req = dm.make_request
	req.source.should == dm
	req.text.should == dm.text
	req.user.should == dm.user
  end

  it 'should not derive duplicate requests from a direct message' do
	dm = DirectMessage.from(@raw_dm)
	dm.make_request.should == dm.make_request
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
safubot-0.0.9 spec/safubot/twitter_spec.rb
safubot-0.0.8 spec/safubot/twitter_spec.rb
safubot-0.0.7 spec/safubot/twitter_spec.rb
safubot-0.0.6 spec/safubot/twitter_spec.rb
safubot-0.0.5 spec/safubot/twitter_spec.rb
safubot-0.0.4 spec/safubot/twitter_spec.rb
safubot-0.0.3 spec/safubot/twitter_spec.rb
safubot-0.0.2 spec/safubot/twitter_spec.rb
safubot-0.0.1 spec/safubot/twitter_spec.rb