Sha256: 75149674189f44ebf0da0feb19aa689aa1156cb165b42daf026f944d12ae73bf

Contents?: true

Size: 1.95 KB

Versions: 27

Compression:

Stored size: 1.95 KB

Contents

require "#{File.dirname(__FILE__)}/test_helper"

class ReactionProcessorTest < Test::Unit::TestCase
  context "A default saver" do
    setup do
      db_user_object = TwitterAccount.create({:twitter_id => 15019521,:screen_name => 'sam1vp'})
      @processor = Pork::ReactionProcessor.new(Pork::TwitterUser.new(:twitter_id => 15019521, :db_object=> db_user_object))
    end
    should "be able to be created" do 
      @processor.inspect
    end
    context "given a tweet with '@username ...'" do
      tweet = Factory.build(:reply_tweet)
      should "be able to extract a reply screen_name" do 
        assert_equal "username", @processor.parse_tweet_for_influentials(tweet)[:reply_screen_name]
      end
    end
    context "given a tweet with '... @username ...'" do
      tweet = Factory.build(:mention_tweet)
      should "be able to extract a mention screen_name" do 
        assert_equal "username", @processor.parse_tweet_for_influentials(tweet)[:mention_screen_names].first
      end
    end
    context "given a tweet with 'RT @username ...'" do
      tweet = Factory.build(:retweet1_tweet)
      should "be able to extract a retweet influential" do 
        assert_equal "username", @processor.parse_tweet_for_influentials(tweet)[:rt_screen_names].first
      end
    end
    context "given a tweet with '...RT @username ...'" do
      tweet = Factory.build(:retweet2_tweet)
      should "be able to extract a retweet influential" do 
        assert_equal "username", @processor.parse_tweet_for_influentials(tweet)[:rt_screen_names].first
      end
    end
    context "given a tweet with '...@username...@username...'" do
      tweet = Factory.build(:double_mention_tweet)
      should "be able to extract a two mention influential" do 
        assert_equal "username1", @processor.parse_tweet_for_influentials(tweet)[:mention_screen_names].first
        assert_equal "username2", @processor.parse_tweet_for_influentials(tweet)[:mention_screen_names].last
      end
    end
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
pork_sandwich-0.4.23 test/reaction_processor_test.rb
pork_sandwich-0.4.22 test/reaction_processor_test.rb
pork_sandwich-0.4.21 test/reaction_processor_test.rb
pork_sandwich-0.4.20 test/reaction_processor_test.rb
pork_sandwich-0.4.19 test/reaction_processor_test.rb
pork_sandwich-0.4.18 test/reaction_processor_test.rb
pork_sandwich-0.4.17 test/reaction_processor_test.rb
pork_sandwich-0.4.16 test/reaction_processor_test.rb
pork_sandwich-0.4.15 test/reaction_processor_test.rb
pork_sandwich-0.4.14 test/reaction_processor_test.rb
pork_sandwich-0.4.13 test/reaction_processor_test.rb
pork_sandwich-0.4.12 test/reaction_processor_test.rb
pork_sandwich-0.4.11 test/reaction_processor_test.rb
pork_sandwich-0.4.10 test/reaction_processor_test.rb
pork_sandwich-0.4.9 test/reaction_processor_test.rb
pork_sandwich-0.4.8 test/reaction_processor_test.rb
pork_sandwich-0.4.7 test/reaction_processor_test.rb
pork_sandwich-0.4.6 test/reaction_processor_test.rb
pork_sandwich-0.4.5 test/reaction_processor_test.rb
pork_sandwich-0.4.4 test/reaction_processor_test.rb