Sha256: de93a85308f813f59e7a04ed684b92893ecb8096cc832eed6fe0233295aa730b
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
require File.dirname(__FILE__) + '/../lib/twitter-search-watcher' require 'rubygems' require 'spec' require 'ostruct' require 'activesupport' # for stringify_keys TSW = TwitterSearchWatcher def readable value OpenStruct.new({ :read => value }) end def fake_response_for watcher end def fake_response options = {} { 'max_id' => 1234, 'since_id' => 0, 'total' => 15, # doesn't appear if next_page present? 'next_page' => '?page=2&max_id=1234&q=remitaylor', # only appears if there are additional pages 'refresh_url' => '?since_id=1234&q=remitaylor', 'page' => 1, 'results_per_page' => 15, 'completed_in' => 0.1234, 'query' => 'remitaylor', 'results' => fake_tweets }.merge(options.stringify_keys).to_json end def fake_tweets [ fake_tweet, fake_tweet ] end def fake_tweet { "created_at"=>"Wed, 05 Aug 2009 03:54:03 +0000", "profile_image_url"=>"http://s3.amazonaws.com/twitter_production/profile_images/346217637/tiltshiftdino_normal.jpg", "from_user"=>"BaddMann", "to_user_id"=>549282, "text"=>"@remitaylor What did you think of the badges at defcon Did you try anything with your badge", "id" => (rand * 1000000000).to_i, "from_user_id"=>160309, "to_user"=>"remitaylor", "iso_language_code"=>"en", "source"=>"<a href="http://twitter.com/">web</a>"} end Spec::Matchers.define :end_with do |expected| match do |actual| actual.end_with? expected end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devfu-twitter-search-watcher-0.1.2 | spec/spec_helper.rb |