Skip to content

Commit

Permalink
Add failing test case for #136
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jan 16, 2011
1 parent 63979a8 commit cf825ea
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 43 deletions.
1 change: 1 addition & 0 deletions spec/fixtures/pengwynn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"profile_background_color":"efefef","listed_count":201,"lang":"en","verified":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/61741268\/twitter-small.png","created_at":"Sat Mar 08 16:34:22 +0000 2008","description":"Christian husband and father. Dev Experience @ HP Cloud Services. Co-host of the @changelogshow. Mashup of design & development.","screen_name":"pengwynn","status":{"in_reply_to_user_id_str":null,"text":"Flatstache is to Mustache what Zepto is to jQuery, from @natevw http:\/\/t.co\/gOjxJ1E","coordinates":null,"retweeted":false,"retweet_count":0,"created_at":"Sun Jan 16 21:01:10 +0000 2011","in_reply_to_user_id":null,"place":null,"source":"\u003Ca href=\"http:\/\/itunes.apple.com\/us\/app\/twitter\/id409789998?mt=12\" rel=\"nofollow\"\u003ETwitter for Mac\u003C\/a\u003E","in_reply_to_status_id":null,"truncated":false,"favorited":false,"in_reply_to_status_id_str":null,"id_str":"26745802235842561","geo":null,"id":26745802235842561,"contributors":null,"in_reply_to_screen_name":null},"url":"http:\/\/wynnnetherland.com","is_translator":false,"show_all_inline_media":false,"geo_enabled":true,"profile_text_color":"666666","followers_count":2902,"contributors_enabled":false,"following":true,"favourites_count":67,"profile_sidebar_fill_color":"dddddd","location":"Dallas, TX","profile_background_tile":false,"time_zone":"Central Time (US & Canada)","profile_link_color":"35abe9","protected":false,"follow_request_sent":false,"statuses_count":4160,"profile_sidebar_border_color":"cccccc","name":"Wynn Netherland","id_str":"14100886","friends_count":1710,"id":14100886,"notifications":false,"profile_use_background_image":true,"utc_offset":-21600,"profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1180321093\/komikazee_normal.png"}
53 changes: 53 additions & 0 deletions spec/fixtures/pengwynn.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<user>
<id>14100886</id>
<name>Wynn Netherland</name>
<screen_name>pengwynn</screen_name>
<location>Dallas, TX</location>
<description>Christian husband and father. Dev Experience @ HP Cloud Services. Co-host of the @changelogshow. Mashup of design &amp; development.</description>
<profile_image_url>http://a0.twimg.com/profile_images/1180321093/komikazee_normal.png</profile_image_url>
<url>http://wynnnetherland.com</url>
<protected>false</protected>
<followers_count>2902</followers_count>
<profile_background_color>efefef</profile_background_color>
<profile_text_color>666666</profile_text_color>
<profile_link_color>35abe9</profile_link_color>
<profile_sidebar_fill_color>dddddd</profile_sidebar_fill_color>
<profile_sidebar_border_color>cccccc</profile_sidebar_border_color>
<friends_count>1710</friends_count>
<created_at>Sat Mar 08 16:34:22 +0000 2008</created_at>
<favourites_count>67</favourites_count>
<utc_offset>-21600</utc_offset>
<time_zone>Central Time (US &amp; Canada)</time_zone>
<profile_background_image_url>http://a1.twimg.com/profile_background_images/61741268/twitter-small.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>false</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>true</following>
<statuses_count>4160</statuses_count>
<lang>en</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>201</listed_count>
<show_all_inline_media>false</show_all_inline_media>
<is_translator>false</is_translator>
<status>
<created_at>Sun Jan 16 21:01:10 +0000 2011</created_at>
<id>26745802235842561</id>
<text>Flatstache is to Mustache what Zepto is to jQuery, from @natevw http://t.co/gOjxJ1E</text>
<source>&lt;a href=&quot;http://itunes.apple.com/us/app/twitter/id409789998?mt=12&quot; rel=&quot;nofollow&quot;&gt;Twitter for Mac&lt;/a&gt;</source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count>1</retweet_count>
<retweeted>false</retweeted>
<geo/>
<coordinates/>
<place/>
<contributors/>
</status>
</user>
1 change: 1 addition & 0 deletions spec/fixtures/sferik.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"show_all_inline_media":true,"lang":"en","geo_enabled":true,"profile_background_image_url":"http:\/\/a2.twimg.com\/profile_background_images\/162641967\/we_concept_bg2.png","created_at":"Mon Jul 16 12:59:01 +0000 2007","description":"A mind forever voyaging through strange seas of thought, alone.","screen_name":"sferik","url":"https:\/\/github.com\/sferik","status":{"retweeted_status":{"coordinates":null,"retweeted":false,"retweet_count":8,"created_at":"Sun Jan 16 20:57:21 +0000 2011","in_reply_to_user_id":null,"place":null,"source":"\u003Ca href=\"http:\/\/www.echofon.com\/\" rel=\"nofollow\"\u003EEchofon\u003C\/a\u003E","in_reply_to_status_id":null,"truncated":false,"favorited":false,"in_reply_to_status_id_str":null,"id_str":"26744838716133376","geo":null,"contributors":null,"in_reply_to_screen_name":null,"id":26744838716133376,"in_reply_to_user_id_str":null,"text":"[ANN] sqlite3-ruby =&gt; sqlite3"},"coordinates":null,"retweeted":false,"retweet_count":8,"created_at":"Sun Jan 16 21:38:25 +0000 2011","in_reply_to_user_id":null,"place":null,"source":"\u003Ca href=\"http:\/\/itunes.apple.com\/us\/app\/twitter\/id409789998?mt=12\" rel=\"nofollow\"\u003ETwitter for Mac\u003C\/a\u003E","in_reply_to_status_id":null,"truncated":false,"favorited":false,"in_reply_to_status_id_str":null,"id_str":"26755176471724032","geo":null,"contributors":null,"in_reply_to_screen_name":null,"id":26755176471724032,"in_reply_to_user_id_str":null,"text":"RT @tenderlove: [ANN] sqlite3-ruby =&gt; sqlite3"},"profile_text_color":"333333","followers_count":1048,"listed_count":41,"following":false,"favourites_count":1040,"profile_sidebar_fill_color":"DDEEF6","location":"San Francisco","profile_background_tile":false,"time_zone":"Pacific Time (US & Canada)","contributors_enabled":false,"statuses_count":3479,"profile_link_color":"0084B4","is_translator":false,"profile_sidebar_border_color":"C0DEED","protected":false,"id_str":"7505382","name":"Erik Michaels-Ober","verified":false,"notifications":false,"profile_use_background_image":true,"friends_count":197,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1186912733\/Github_Square_normal.jpg","id":7505382,"follow_request_sent":false,"utc_offset":-28800,"profile_background_color":"000000"}
39 changes: 20 additions & 19 deletions spec/fixtures/user.xml → spec/fixtures/sferik.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,58 @@
<name>Erik Michaels-Ober</name>
<screen_name>sferik</screen_name>
<location>San Francisco</location>
<description>Adventures in hunger and foolishness.</description>
<profile_image_url>http://a0.twimg.com/profile_images/323331048/me_normal.jpg</profile_image_url>
<url></url>
<description>A mind forever voyaging through strange seas of thought, alone.</description>
<profile_image_url>http://a1.twimg.com/profile_images/1186912733/Github_Square_normal.jpg</profile_image_url>
<url>https://github.com/sferik</url>
<protected>false</protected>
<followers_count>898</followers_count>
<followers_count>1048</followers_count>
<profile_background_color>000000</profile_background_color>
<profile_text_color>333333</profile_text_color>
<profile_link_color>0084B4</profile_link_color>
<profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
<profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
<friends_count>88</friends_count>
<friends_count>197</friends_count>
<created_at>Mon Jul 16 12:59:01 +0000 2007</created_at>
<favourites_count>727</favourites_count>
<favourites_count>1040</favourites_count>
<utc_offset>-28800</utc_offset>
<time_zone>Pacific Time (US &amp; Canada)</time_zone>
<profile_background_image_url>http://a3.twimg.com/profile_background_images/162641967/we_concept_bg2.png</profile_background_image_url>
<profile_background_image_url>http://a2.twimg.com/profile_background_images/162641967/we_concept_bg2.png</profile_background_image_url>
<profile_background_tile>false</profile_background_tile>
<profile_use_background_image>true</profile_use_background_image>
<notifications>false</notifications>
<geo_enabled>true</geo_enabled>
<verified>false</verified>
<following>false</following>
<statuses_count>2962</statuses_count>
<statuses_count>3479</statuses_count>
<lang>en</lang>
<contributors_enabled>false</contributors_enabled>
<follow_request_sent>false</follow_request_sent>
<listed_count>29</listed_count>
<listed_count>41</listed_count>
<show_all_inline_media>true</show_all_inline_media>
<is_translator>false</is_translator>
<status>
<created_at>Fri Oct 22 21:56:04 +0000 2010</created_at>
<id>28443146015</id>
<text>RT @mojombo: A release three years and three months in the making. I give you...Chronic 0.3.0! http://rubygems.org/gems/chronic</text>
<source>&lt;a href=&quot;http://www.echofon.com/&quot; rel=&quot;nofollow&quot;&gt;Echofon&lt;/a&gt;</source>
<created_at>Sun Jan 16 21:38:25 +0000 2011</created_at>
<id>26755176471724032</id>
<text>RT @tenderlove: [ANN] sqlite3-ruby =&amp;gt; sqlite3</text>
<source>&lt;a href=&quot;http://itunes.apple.com/us/app/twitter/id409789998?mt=12&quot; rel=&quot;nofollow&quot;&gt;Twitter for Mac&lt;/a&gt;</source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count></retweet_count>
<retweet_count>9</retweet_count>
<retweeted>false</retweeted>
<retweeted_status>
<created_at>Fri Oct 22 21:34:32 +0000 2010</created_at>
<id>28441706055</id>
<text>A release three years and three months in the making. I give you...Chronic 0.3.0! http://rubygems.org/gems/chronic</text>
<source>web</source>
<created_at>Sun Jan 16 20:57:21 +0000 2011</created_at>
<id>26744838716133376</id>
<text>[ANN] sqlite3-ruby =&amp;gt; sqlite3</text>
<source>&lt;a href=&quot;http://www.echofon.com/&quot; rel=&quot;nofollow&quot;&gt;Echofon&lt;/a&gt;</source>
<truncated>false</truncated>
<favorited>false</favorited>
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
<in_reply_to_screen_name></in_reply_to_screen_name>
<retweet_count></retweet_count>
<retweet_count>9</retweet_count>
<retweeted>false</retweeted>
<geo/>
<coordinates/>
Expand Down
1 change: 0 additions & 1 deletion spec/fixtures/user.json

This file was deleted.

12 changes: 6 additions & 6 deletions spec/twitter/client/account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

before do
stub_get("account/verify_credentials.#{format}").
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand Down Expand Up @@ -72,7 +72,7 @@
before do
stub_post("account/update_delivery_device.#{format}").
with(:body => {:device => "sms"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -94,7 +94,7 @@
before do
stub_post("account/update_profile_colors.#{format}").
with(:body => {:profile_background_color => "000000"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -115,7 +115,7 @@

before do
stub_post("account/update_profile_image.#{format}").
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -135,7 +135,7 @@

before do
stub_post("account/update_profile_background_image.#{format}").
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -156,7 +156,7 @@
before do
stub_post("account/update_profile.#{format}").
with(:body => {:url => "http://github.com/sferik/"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand Down
6 changes: 3 additions & 3 deletions spec/twitter/client/block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
before do
stub_post("blocks/create.#{format}").
with(:body => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -33,7 +33,7 @@
before do
stub_delete("blocks/destroy.#{format}").
with(:query => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -55,7 +55,7 @@
before do
stub_get("blocks/exists.#{format}").
with(:query => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
stub_get("blocks/exists.#{format}").
with(:query => {:screen_name => "pengwynn"}).
to_return(:body => fixture("not_found.#{format}"), :status => 404, :headers => {:content_type => "application/#{format}; charset=utf-8"})
Expand Down
8 changes: 4 additions & 4 deletions spec/twitter/client/friendship_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
before do
stub_post("friendships/create.#{format}").
with(:body => {:screen_name => "sferik", :follow => "true"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -36,7 +36,7 @@
before do
stub_post("friendships/create.#{format}").
with(:body => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -58,7 +58,7 @@
before do
stub_post("friendships/create.#{format}").
with(:body => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand All @@ -82,7 +82,7 @@
before do
stub_delete("friendships/destroy.#{format}").
with(:query => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end

it "should get the correct resource" do
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/client/list_subscribers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@

before do
stub_get("sferik/presidents/subscribers/813286.#{format}").
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
stub_get("sferik/presidents/subscribers/18755393.#{format}").
to_return(:body => fixture("not_found.#{format}"), :status => 404, :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
Expand Down Expand Up @@ -166,7 +166,7 @@
before do
@client.stub!(:get_screen_name).and_return('sferik')
stub_get("sferik/presidents/subscribers/813286.#{format}").
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
stub_get("sferik/presidents/subscribers/18755393.#{format}").
to_return(:body => fixture("not_found.#{format}"), :status => 404, :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
Expand Down
Loading

0 comments on commit cf825ea

Please sign in to comment.