From 1df9a2066c1adf89e2cc8b070467255e238b6110 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sun, 18 Aug 2013 10:34:55 +0200 Subject: [PATCH] Remove token stub --- spec/helper.rb | 4 -- spec/twitter/api/direct_messages_spec.rb | 16 ++--- spec/twitter/api/favorites_spec.rb | 12 ++-- .../twitter/api/friends_and_followers_spec.rb | 38 ++++++------ spec/twitter/api/geo_spec.rb | 12 ++-- spec/twitter/api/help_spec.rb | 10 +-- spec/twitter/api/lists_spec.rb | 38 ++++++------ spec/twitter/api/oauth_spec.rb | 8 +-- spec/twitter/api/saved_searches_spec.rb | 12 ++-- spec/twitter/api/search_spec.rb | 6 +- spec/twitter/api/spam_reporting_spec.rb | 4 +- spec/twitter/api/suggested_users_spec.rb | 8 +-- spec/twitter/api/timelines_spec.rb | 16 ++--- spec/twitter/api/trends_spec.rb | 8 +-- spec/twitter/api/tweets_spec.rb | 32 +++++----- spec/twitter/api/undocumented_spec.rb | 4 +- spec/twitter/api/users_spec.rb | 52 ++++++++-------- spec/twitter/client_spec.rb | 31 +++++----- spec/twitter/cursor_spec.rb | 6 +- spec/twitter/entity/uri_spec.rb | 6 +- spec/twitter/error_spec.rb | 10 +-- spec/twitter/geo/point_spec.rb | 2 +- spec/twitter/geo_results_spec.rb | 6 +- spec/twitter/list_spec.rb | 6 +- spec/twitter/media/photo_spec.rb | 10 +-- spec/twitter/oembed_spec.rb | 22 +++---- spec/twitter/place_spec.rb | 12 ++-- spec/twitter/rate_limit_spec.rb | 12 ++-- spec/twitter/relationship_spec.rb | 2 +- spec/twitter/search_results_spec.rb | 20 +++--- spec/twitter/trend_results_spec.rb | 4 +- spec/twitter/trend_spec.rb | 2 +- spec/twitter/tweet_spec.rb | 32 +++++----- spec/twitter/user_spec.rb | 62 +++++++++---------- spec/twitter_spec.rb | 14 +++-- 35 files changed, 270 insertions(+), 269 deletions(-) diff --git a/spec/helper.rb b/spec/helper.rb index a0b80e1b4..5902060fb 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -20,10 +20,6 @@ config.expect_with :rspec do |c| c.syntax = :expect end - - config.before(:each) do - stub_post("/oauth2/token").with(:body => "grant_type=client_credentials").to_return(:body => fixture("bearer_token.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - end end def a_delete(path) diff --git a/spec/twitter/api/direct_messages_spec.rb b/spec/twitter/api/direct_messages_spec.rb index a252034a1..7b35c0c6b 100644 --- a/spec/twitter/api/direct_messages_spec.rb +++ b/spec/twitter/api/direct_messages_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::DirectMessages do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#direct_messages_received" do @@ -18,7 +18,7 @@ direct_messages = @client.direct_messages_received expect(direct_messages).to be_an Array expect(direct_messages.first).to be_a Twitter::DirectMessage - expect(direct_messages.first.sender.id).to eq 7505382 + expect(direct_messages.first.sender.id).to eq(7505382) end end @@ -34,7 +34,7 @@ direct_messages = @client.direct_messages_sent expect(direct_messages).to be_an Array expect(direct_messages.first).to be_a Twitter::DirectMessage - expect(direct_messages.first.sender.id).to eq 7505382 + expect(direct_messages.first.sender.id).to eq(7505382) end end @@ -49,7 +49,7 @@ it "returns the specified direct message" do direct_message = @client.direct_message(1825786345) expect(direct_message).to be_a Twitter::DirectMessage - expect(direct_message.sender.id).to eq 7505382 + expect(direct_message.sender.id).to eq(7505382) end end @@ -66,7 +66,7 @@ direct_messages = @client.direct_messages(1825786345) expect(direct_messages).to be_an Array expect(direct_messages.first).to be_a Twitter::DirectMessage - expect(direct_messages.first.sender.id).to eq 7505382 + expect(direct_messages.first.sender.id).to eq(7505382) end end context "without ids passed" do @@ -81,7 +81,7 @@ direct_messages = @client.direct_messages expect(direct_messages).to be_an Array expect(direct_messages.first).to be_a Twitter::DirectMessage - expect(direct_messages.first.sender.id).to eq 7505382 + expect(direct_messages.first.sender.id).to eq(7505382) end end end @@ -98,7 +98,7 @@ direct_messages = @client.direct_message_destroy(1825785544) expect(direct_messages).to be_an Array expect(direct_messages.first).to be_a Twitter::DirectMessage - expect(direct_messages.first.sender.id).to eq 7505382 + expect(direct_messages.first.sender.id).to eq(7505382) end end @@ -113,7 +113,7 @@ it "returns the sent message" do direct_message = @client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem") expect(direct_message).to be_a Twitter::DirectMessage - expect(direct_message.text).to eq "Creating a fixture for the Twitter gem" + expect(direct_message.text).to eq("Creating a fixture for the Twitter gem") end context "with a URI object passed" do it "requests the correct resource" do diff --git a/spec/twitter/api/favorites_spec.rb b/spec/twitter/api/favorites_spec.rb index 687501ca3..63bb0e531 100644 --- a/spec/twitter/api/favorites_spec.rb +++ b/spec/twitter/api/favorites_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Favorites do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#favorites" do @@ -19,7 +19,7 @@ favorites = @client.favorites("sferik") expect(favorites).to be_an Array expect(favorites.first).to be_a Twitter::Tweet - expect(favorites.first.user.id).to eq 7505382 + expect(favorites.first.user.id).to eq(7505382) end context "with a URI object passed" do it "requests the correct resource" do @@ -47,7 +47,7 @@ favorites = @client.favorites expect(favorites).to be_an Array expect(favorites.first).to be_a Twitter::Tweet - expect(favorites.first.user.id).to eq 7505382 + expect(favorites.first.user.id).to eq(7505382) end end end @@ -64,7 +64,7 @@ tweets = @client.unfavorite(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end context "with a URI object passed" do it "requests the correct resource" do @@ -100,7 +100,7 @@ tweets = @client.favorite(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end context "already favorited" do before do @@ -144,7 +144,7 @@ tweets = @client.favorite!(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end context "forbidden" do before do diff --git a/spec/twitter/api/friends_and_followers_spec.rb b/spec/twitter/api/friends_and_followers_spec.rb index 9fbfb093a..e5a80dfe6 100644 --- a/spec/twitter/api/friends_and_followers_spec.rb +++ b/spec/twitter/api/friends_and_followers_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::FriendsAndFollowers do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#friend_ids" do @@ -18,7 +18,7 @@ it "returns an array of numeric IDs for every user the specified user is following" do friend_ids = @client.friend_ids("sferik") expect(friend_ids).to be_a Twitter::Cursor - expect(friend_ids.first).to eq 20009713 + expect(friend_ids.first).to eq(20009713) end context "with each" do before do @@ -63,7 +63,7 @@ it "returns an array of numeric IDs for every user the specified user is following" do friend_ids = @client.friend_ids expect(friend_ids).to be_a Twitter::Cursor - expect(friend_ids.first).to eq 20009713 + expect(friend_ids.first).to eq(20009713) end context "with each" do before do @@ -91,7 +91,7 @@ it "returns an array of numeric IDs for every user following the specified user" do follower_ids = @client.follower_ids("sferik") expect(follower_ids).to be_a Twitter::Cursor - expect(follower_ids.first).to eq 20009713 + expect(follower_ids.first).to eq(20009713) end context "with each" do before do @@ -136,7 +136,7 @@ it "returns an array of numeric IDs for every user following the specified user" do follower_ids = @client.follower_ids expect(follower_ids).to be_a Twitter::Cursor - expect(follower_ids.first).to eq 20009713 + expect(follower_ids.first).to eq(20009713) end context "with each" do before do @@ -165,8 +165,8 @@ friendships = @client.friendships("sferik", "pengwynn") expect(friendships).to be_an Array expect(friendships.first).to be_a Twitter::User - expect(friendships.first.id).to eq 7505382 - expect(friendships.first.connections).to eq ["none"] + expect(friendships.first.id).to eq(7505382) + expect(friendships.first.connections).to eq(["none"]) end end context "with numeric screen names passed" do @@ -211,8 +211,8 @@ friendships = @client.friendships("sferik", "pengwynn") expect(friendships).to be_an Array expect(friendships.first).to be_a Twitter::User - expect(friendships.first.id).to eq 7505382 - expect(friendships.first.connections).to eq ["none"] + expect(friendships.first.id).to eq(7505382) + expect(friendships.first.connections).to eq(["none"]) end end context "with numeric screen names passed" do @@ -255,7 +255,7 @@ it "returns an array of numeric IDs for every user who has a pending request to follow the authenticating user" do friendships_incoming = @client.friendships_incoming expect(friendships_incoming).to be_a Twitter::Cursor - expect(friendships_incoming.first).to eq 20009713 + expect(friendships_incoming.first).to eq(20009713) end context "with each" do before do @@ -279,7 +279,7 @@ it "returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request" do friendships_outgoing = @client.friendships_outgoing expect(friendships_outgoing).to be_a Twitter::Cursor - expect(friendships_outgoing.first).to eq 20009713 + expect(friendships_outgoing.first).to eq(20009713) end context "with each" do before do @@ -311,7 +311,7 @@ users = @client.follow("sferik", "pengwynn", :follow => true) expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end context "with :follow => false passed" do @@ -359,7 +359,7 @@ users = @client.follow!("sferik", :follow => true) expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end context "with :follow => false passed" do @@ -374,7 +374,7 @@ users = @client.follow!("sferik", :follow => false) expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end context "without :follow passed" do @@ -389,7 +389,7 @@ users = @client.follow!("sferik") expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end end @@ -406,7 +406,7 @@ users = @client.friendship_destroy("sferik") expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end @@ -421,7 +421,7 @@ it "returns detailed information about the relationship between two users" do relationship = @client.friendship_update("sferik", :retweets => true) expect(relationship).to be_a Twitter::Relationship - expect(relationship.source.id).to eq 7505382 + expect(relationship.source.id).to eq(7505382) end end @@ -437,7 +437,7 @@ it "returns detailed information about the relationship between two users" do relationship = @client.friendship("sferik", "pengwynn") expect(relationship).to be_a Twitter::Relationship - expect(relationship.source.id).to eq 7505382 + expect(relationship.source.id).to eq(7505382) end end context "with numeric screen names passed" do @@ -674,7 +674,7 @@ no_retweet_ids = @client.no_retweet_ids expect(no_retweet_ids).to be_an Array expect(no_retweet_ids.first).to be_an Integer - expect(no_retweet_ids.first).to eq 47 + expect(no_retweet_ids.first).to eq(47) end end end diff --git a/spec/twitter/api/geo_spec.rb b/spec/twitter/api/geo_spec.rb index 344e3b1e1..45942c0dd 100644 --- a/spec/twitter/api/geo_spec.rb +++ b/spec/twitter/api/geo_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::PlacesAndGeo do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#place" do @@ -16,7 +16,7 @@ end it "returns a place" do place = @client.place("247f43d441defc03") - expect(place.name).to eq "Twitter HQ" + expect(place.name).to eq("Twitter HQ") end end @@ -31,7 +31,7 @@ it "returns places" do places = @client.reverse_geocode(:lat => "37.7821120598956", :long => "-122.400612831116") expect(places).to be_a Twitter::GeoResults - expect(places.first.name).to eq "Bernal Heights" + expect(places.first.name).to eq("Bernal Heights") end end @@ -46,7 +46,7 @@ it "returns nearby places" do places = @client.geo_search(:ip => "74.125.19.104") expect(places).to be_a Twitter::GeoResults - expect(places.first.name).to eq "Bernal Heights" + expect(places.first.name).to eq("Bernal Heights") end end @@ -61,7 +61,7 @@ it "returns similar places" do places = @client.similar_places(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ") expect(places).to be_a Twitter::GeoResults - expect(places.first.name).to eq "Bernal Heights" + expect(places.first.name).to eq("Bernal Heights") end end @@ -75,7 +75,7 @@ end it "returns a place" do place = @client.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581") - expect(place.name).to eq "Twitter HQ" + expect(place.name).to eq("Twitter HQ") end end diff --git a/spec/twitter/api/help_spec.rb b/spec/twitter/api/help_spec.rb index 09a8e8afd..218ce327e 100644 --- a/spec/twitter/api/help_spec.rb +++ b/spec/twitter/api/help_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Help do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#configuration" do @@ -17,7 +17,7 @@ it "returns Twitter's current configuration" do configuration = @client.configuration expect(configuration).to be_a Twitter::Configuration - expect(configuration.characters_reserved_per_media).to eq 20 + expect(configuration.characters_reserved_per_media).to eq(20) end end @@ -33,7 +33,7 @@ languages = @client.languages expect(languages).to be_an Array expect(languages.first).to be_a Twitter::Language - expect(languages.first.name).to eq "Portuguese" + expect(languages.first.name).to eq("Portuguese") end end @@ -47,7 +47,7 @@ end it "returns Twitter's Privacy Policy" do privacy = @client.privacy - expect(privacy.split.first).to eq "Twitter" + expect(privacy.split.first).to eq("Twitter") end end @@ -61,7 +61,7 @@ end it "returns Twitter's Terms of Service" do tos = @client.tos - expect(tos.split.first).to eq "Terms" + expect(tos.split.first).to eq("Terms") end end diff --git a/spec/twitter/api/lists_spec.rb b/spec/twitter/api/lists_spec.rb index b779355a2..9ac715f2d 100644 --- a/spec/twitter/api/lists_spec.rb +++ b/spec/twitter/api/lists_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Lists do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#lists" do @@ -18,7 +18,7 @@ lists = @client.lists expect(lists).to be_an Array expect(lists.first).to be_a Twitter::List - expect(lists.first.name).to eq "Rubyists" + expect(lists.first.name).to eq("Rubyists") end end @@ -35,7 +35,7 @@ tweets = @client.list_timeline("sferik", "presidents") expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!" + expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!") end context "with a URI object passed" do it "requests the correct resource" do @@ -89,7 +89,7 @@ it "returns the list" do list = @client.list_remove_member("sferik", "presidents", 813286) expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "without a screen name passed" do @@ -117,7 +117,7 @@ memberships = @client.memberships("sferik") expect(memberships).to be_a Twitter::Cursor expect(memberships.first).to be_a Twitter::List - expect(memberships.first.name).to eq "developer" + expect(memberships.first.name).to eq("developer") end context "with each" do before do @@ -184,7 +184,7 @@ list_subscribers = @client.list_subscribers("sferik", "presidents") expect(list_subscribers).to be_a Twitter::Cursor expect(list_subscribers.first).to be_a Twitter::User - expect(list_subscribers.first.id).to eq 7505382 + expect(list_subscribers.first.id).to eq(7505382) end context "with each" do before do @@ -250,7 +250,7 @@ it "returns the specified list" do list = @client.list_subscribe("sferik", "presidents") expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "without a screen name passed" do @@ -350,7 +350,7 @@ it "returns the specified list" do list = @client.list_unsubscribe("sferik", "presidents") expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "without a screen name passed" do @@ -377,7 +377,7 @@ it "returns the list" do list = @client.list_add_members("sferik", "presidents", [813286, 18755393]) expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "with a combination of member IDs and member screen names to add" do @@ -487,7 +487,7 @@ list_members = @client.list_members("sferik", "presidents") expect(list_members).to be_a Twitter::Cursor expect(list_members.first).to be_a Twitter::User - expect(list_members.first.id).to eq 7505382 + expect(list_members.first.id).to eq(7505382) end context "with each" do before do @@ -553,7 +553,7 @@ it "returns the list" do list = @client.list_add_member("sferik", "presidents", 813286) expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "without a screen name passed" do @@ -580,7 +580,7 @@ it "returns the deleted list" do list = @client.list_destroy("sferik", "presidents") expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "without a screen name passed" do @@ -626,7 +626,7 @@ it "returns the updated list" do list = @client.list_update("sferik", "presidents", :description => "Presidents of the United States of America") expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "without a screen name passed" do @@ -671,7 +671,7 @@ it "returns the created list" do list = @client.list_create("presidents") expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end @@ -687,7 +687,7 @@ it "returns the updated list" do list = @client.list("sferik", "presidents") expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "with a user ID passed" do @@ -753,7 +753,7 @@ subscriptions = @client.subscriptions("sferik") expect(subscriptions).to be_a Twitter::Cursor expect(subscriptions.first).to be_a Twitter::List - expect(subscriptions.first.name).to eq "Rubyists" + expect(subscriptions.first.name).to eq("Rubyists") end context "with each" do before do @@ -819,7 +819,7 @@ it "returns the list" do list = @client.list_remove_members("sferik", "presidents", [813286, 18755393]) expect(list).to be_a Twitter::List - expect(list.name).to eq "presidents" + expect(list.name).to eq("presidents") end end context "with a user ID passed" do @@ -865,7 +865,7 @@ lists = @client.lists_owned("sferik") expect(lists).to be_a Twitter::Cursor expect(lists.first).to be_a Twitter::List - expect(lists.first.name).to eq "My favstar.fm list" + expect(lists.first.name).to eq("My favstar.fm list") end end context "without a screen name passed" do @@ -881,7 +881,7 @@ lists = @client.lists_owned expect(lists).to be_a Twitter::Cursor expect(lists.first).to be_a Twitter::List - expect(lists.first.name).to eq "My favstar.fm list" + expect(lists.first.name).to eq("My favstar.fm list") end end end diff --git a/spec/twitter/api/oauth_spec.rb b/spec/twitter/api/oauth_spec.rb index b5ebfac6e..13384241c 100644 --- a/spec/twitter/api/oauth_spec.rb +++ b/spec/twitter/api/oauth_spec.rb @@ -25,8 +25,8 @@ end it "returns the bearer token" do bearer_token = @client.token - expect(bearer_token.access_token).to eq "AAAA%2FAAA%3DAAAAAAAA" - expect(bearer_token.token_type).to eq "bearer" + expect(bearer_token.access_token).to eq("AAAA%2FAAA%3DAAAAAAAA") + expect(bearer_token.token_type).to eq("bearer") end end @@ -41,8 +41,8 @@ end it "returns the invalidated token" do token = @client.invalidate_token("AAAA%2FAAA%3DAAAAAAAA") - expect(token.access_token).to eq "AAAA%2FAAA%3DAAAAAAAA" - expect(token.token_type).to eq nil + expect(token.access_token).to eq("AAAA%2FAAA%3DAAAAAAAA") + expect(token.token_type).to be_nil end context "with a token" do it "requests the correct resource" do diff --git a/spec/twitter/api/saved_searches_spec.rb b/spec/twitter/api/saved_searches_spec.rb index b5c75332d..cc9bcfc59 100644 --- a/spec/twitter/api/saved_searches_spec.rb +++ b/spec/twitter/api/saved_searches_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::SavedSearches do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#saved_searches" do @@ -19,7 +19,7 @@ saved_searches = @client.saved_searches(16129012) expect(saved_searches).to be_an Array expect(saved_searches.first).to be_a Twitter::SavedSearch - expect(saved_searches.first.name).to eq "twitter" + expect(saved_searches.first.name).to eq("twitter") end end context "without ids passed" do @@ -34,7 +34,7 @@ saved_searches = @client.saved_searches expect(saved_searches).to be_an Array expect(saved_searches.first).to be_a Twitter::SavedSearch - expect(saved_searches.first.name).to eq "twitter" + expect(saved_searches.first.name).to eq("twitter") end end end @@ -50,7 +50,7 @@ it "returns a saved search" do saved_search = @client.saved_search(16129012) expect(saved_search).to be_a Twitter::SavedSearch - expect(saved_search.name).to eq "twitter" + expect(saved_search.name).to eq("twitter") end end @@ -65,7 +65,7 @@ it "returns the created saved search" do saved_search = @client.saved_search_create("twitter") expect(saved_search).to be_a Twitter::SavedSearch - expect(saved_search.name).to eq "twitter" + expect(saved_search.name).to eq("twitter") end end @@ -81,7 +81,7 @@ saved_searches = @client.saved_search_destroy(16129012) expect(saved_searches).to be_an Array expect(saved_searches.first).to be_a Twitter::SavedSearch - expect(saved_searches.first.name).to eq "twitter" + expect(saved_searches.first.name).to eq("twitter") end end diff --git a/spec/twitter/api/search_spec.rb b/spec/twitter/api/search_spec.rb index 38dabb2a5..a591ebbc7 100644 --- a/spec/twitter/api/search_spec.rb +++ b/spec/twitter/api/search_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Search do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#search" do @@ -18,11 +18,11 @@ search = @client.search("twitter") expect(search).to be_a Twitter::SearchResults expect(search.first).to be_a Twitter::Tweet - expect(search.first.text).to eq "Bubble Mailer #freebandnames" + expect(search.first.text).to eq("Bubble Mailer #freebandnames") end it "returns the max_id value for a search result" do search = @client.search("twitter") - expect(search.max_id).to eq 250126199840518145 + expect(search.max_id).to eq(250126199840518145) end context "when search API responds a malformed result" do diff --git a/spec/twitter/api/spam_reporting_spec.rb b/spec/twitter/api/spam_reporting_spec.rb index 88e95cfcc..61d62d0e9 100644 --- a/spec/twitter/api/spam_reporting_spec.rb +++ b/spec/twitter/api/spam_reporting_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::SpamReporting do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#report_spam" do @@ -18,7 +18,7 @@ users = @client.report_spam("sferik") expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end diff --git a/spec/twitter/api/suggested_users_spec.rb b/spec/twitter/api/suggested_users_spec.rb index 4a40a3e8b..52f72bc46 100644 --- a/spec/twitter/api/suggested_users_spec.rb +++ b/spec/twitter/api/suggested_users_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::SuggestedUsers do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#suggestions" do @@ -18,7 +18,7 @@ it "returns the users in a given category of the Twitter suggested user list" do suggestion = @client.suggestions("art-design") expect(suggestion).to be_a Twitter::Suggestion - expect(suggestion.name).to eq "Art & Design" + expect(suggestion.name).to eq("Art & Design") expect(suggestion.users).to be_an Array expect(suggestion.users.first).to be_a Twitter::User end @@ -35,7 +35,7 @@ suggestions = @client.suggestions expect(suggestions).to be_an Array expect(suggestions.first).to be_a Twitter::Suggestion - expect(suggestions.first.name).to eq "Art & Design" + expect(suggestions.first.name).to eq("Art & Design") end end end @@ -52,7 +52,7 @@ suggest_users = @client.suggest_users("art-design") expect(suggest_users).to be_an Array expect(suggest_users.first).to be_a Twitter::User - expect(suggest_users.first.id).to eq 13 + expect(suggest_users.first.id).to eq(13) end end diff --git a/spec/twitter/api/timelines_spec.rb b/spec/twitter/api/timelines_spec.rb index b8f578660..23bb4742c 100644 --- a/spec/twitter/api/timelines_spec.rb +++ b/spec/twitter/api/timelines_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Timelines do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#mentions_timeline" do @@ -18,7 +18,7 @@ tweets = @client.mentions_timeline expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!" + expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!") end end @@ -35,7 +35,7 @@ tweets = @client.user_timeline("sferik") expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!" + expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!") end end context "without a screen name passed" do @@ -63,7 +63,7 @@ tweets = @client.retweeted_by_user("sferik") expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k" + expect(tweets.first.text).to eq("RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k") end end @@ -81,7 +81,7 @@ tweets = @client.retweeted_by_me expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k" + expect(tweets.first.text).to eq("RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k") end end @@ -97,7 +97,7 @@ tweets = @client.home_timeline expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!" + expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!") end end @@ -115,7 +115,7 @@ tweets = @client.retweeted_to_me expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k" + expect(tweets.first.text).to eq("RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k") end end @@ -131,7 +131,7 @@ tweets = @client.retweets_of_me expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "Happy Birthday @imdane. Watch out for those @rally pranksters!" + expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!") end end diff --git a/spec/twitter/api/trends_spec.rb b/spec/twitter/api/trends_spec.rb index bf67beb5b..c978b9214 100644 --- a/spec/twitter/api/trends_spec.rb +++ b/spec/twitter/api/trends_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Trends do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#trends" do @@ -19,7 +19,7 @@ matching_trends = @client.trends(2487956) expect(matching_trends).to be_a Twitter::TrendResults expect(matching_trends.first).to be_a Twitter::Trend - expect(matching_trends.first.name).to eq "#sevenwordsaftersex" + expect(matching_trends.first.name).to eq("#sevenwordsaftersex") end end context "without arguments passed" do @@ -45,7 +45,7 @@ locations = @client.trends_available expect(locations).to be_an Array expect(locations.first).to be_a Twitter::Place - expect(locations.first.name).to eq "Ireland" + expect(locations.first.name).to eq("Ireland") end end @@ -61,7 +61,7 @@ locations = @client.trends_closest expect(locations).to be_an Array expect(locations.first).to be_a Twitter::Place - expect(locations.first.name).to eq "Ireland" + expect(locations.first.name).to eq("Ireland") end end diff --git a/spec/twitter/api/tweets_spec.rb b/spec/twitter/api/tweets_spec.rb index 1c3dd2c0e..822fa7e76 100644 --- a/spec/twitter/api/tweets_spec.rb +++ b/spec/twitter/api/tweets_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Tweets do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#retweets" do @@ -19,7 +19,7 @@ tweets = @client.retweets(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush." + expect(tweets.first.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.") end end context "with a URI object passed" do @@ -57,7 +57,7 @@ it "returns an array of numeric user IDs of retweeters of a Tweet" do ids = @client.retweeters_of(25938088801, :ids_only => true) expect(ids).to be_an Array - expect(ids.first).to eq 7505382 + expect(ids.first).to eq(7505382) end end end @@ -73,7 +73,7 @@ users = @client.retweeters_of(25938088801) expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end context "with a URI object passed" do it "requests the correct resource" do @@ -109,7 +109,7 @@ it "returns a Tweet" do tweet = @client.status(25938088801) expect(tweet).to be_a Twitter::Tweet - expect(tweet.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end context "with a URI object passed" do it "requests the correct resource" do @@ -145,7 +145,7 @@ tweets = @client.statuses(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end context "with a URI object passed" do it "requests the correct resource" do @@ -181,7 +181,7 @@ tweets = @client.status_destroy(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end context "with a URI object passed" do it "requests the correct resource" do @@ -216,7 +216,7 @@ it "returns a Tweet" do tweet = @client.update("The problem with your code is that it's doing exactly what you told it to do.") expect(tweet).to be_a Twitter::Tweet - expect(tweet.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end context "already posted" do before do @@ -240,9 +240,9 @@ tweets = @client.retweet(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush." - expect(tweets.first.retweeted_tweet.text).to eq "RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush." - expect(tweets.first.retweeted_tweet.id).not_to eq tweets.first.id + expect(tweets.first.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.") + expect(tweets.first.retweeted_tweet.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.") + expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id) end context "already retweeted" do before do @@ -286,9 +286,9 @@ tweets = @client.retweet!(25938088801) expect(tweets).to be_an Array expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.text).to eq "As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush." - expect(tweets.first.retweeted_tweet.text).to eq "RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush." - expect(tweets.first.retweeted_tweet.id).not_to eq tweets.first.id + expect(tweets.first.text).to eq("As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.") + expect(tweets.first.retweeted_tweet.text).to eq("RT @gruber: As for the Series, I'm for the Giants. Fuck Texas, fuck Nolan Ryan, fuck George Bush.") + expect(tweets.first.retweeted_tweet.id).not_to eq(tweets.first.id) end context "forbidden" do before do @@ -340,7 +340,7 @@ it "returns a Tweet" do tweet = @client.update_with_media("The problem with your code is that it's doing exactly what you told it to do.", fixture("pbjt.gif")) expect(tweet).to be_a Twitter::Tweet - expect(tweet.text).to eq "The problem with your code is that it's doing exactly what you told it to do." + expect(tweet.text).to eq("The problem with your code is that it's doing exactly what you told it to do.") end end context "a jpe image" do @@ -466,7 +466,7 @@ it "returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter" do retweeters_ids = @client.retweeters_ids(25938088801) expect(retweeters_ids).to be_a Twitter::Cursor - expect(retweeters_ids.first).to eq 20009713 + expect(retweeters_ids.first).to eq(20009713) end context "with each" do before do diff --git a/spec/twitter/api/undocumented_spec.rb b/spec/twitter/api/undocumented_spec.rb index 97a5f3c8c..df4d1cde3 100644 --- a/spec/twitter/api/undocumented_spec.rb +++ b/spec/twitter/api/undocumented_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Undocumented do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#following_followers_of" do @@ -89,7 +89,7 @@ it "returns a Tweet count" do tweet_count = @client.tweet_count("http://twitter.com") expect(tweet_count).to be_an Integer - expect(tweet_count).to eq 13845465 + expect(tweet_count).to eq(13845465) end context "with a URI" do it "requests the correct resource" do diff --git a/spec/twitter/api/users_spec.rb b/spec/twitter/api/users_spec.rb index 3bfa715e8..1f3533fcc 100644 --- a/spec/twitter/api/users_spec.rb +++ b/spec/twitter/api/users_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::Users do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#settings" do @@ -18,7 +18,7 @@ it "returns settings" do settings = @client.settings expect(settings).to be_a Twitter::Settings - expect(settings.language).to eq "en" + expect(settings.language).to eq("en") end it "requests the correct resource on POST" do @client.settings(:trend_location_woeid => "23424803") @@ -27,7 +27,7 @@ it "returns settings" do settings = @client.settings(:trend_location_woeid => "23424803") expect(settings).to be_a Twitter::Settings - expect(settings.language).to eq "en" + expect(settings.language).to eq("en") end end @@ -42,7 +42,7 @@ it "returns the requesting user" do user = @client.verify_credentials expect(user).to be_a Twitter::User - expect(user.id).to eq 7505382 + expect(user.id).to eq(7505382) end end @@ -57,7 +57,7 @@ it "returns a user" do user = @client.update_delivery_device("sms") expect(user).to be_a Twitter::User - expect(user.id).to eq 7505382 + expect(user.id).to eq(7505382) end end @@ -72,7 +72,7 @@ it "returns a user" do user = @client.update_profile(:url => "http://github.com/sferik/") expect(user).to be_a Twitter::User - expect(user.id).to eq 7505382 + expect(user.id).to eq(7505382) end end @@ -87,7 +87,7 @@ it "returns a user" do user = @client.update_profile_background_image(fixture("we_concept_bg2.png")) expect(user).to be_a Twitter::User - expect(user.id).to eq 7505382 + expect(user.id).to eq(7505382) end end @@ -102,7 +102,7 @@ it "returns a user" do user = @client.update_profile_colors(:profile_background_color => "000000") expect(user).to be_a Twitter::User - expect(user.id).to eq 7505382 + expect(user.id).to eq(7505382) end end @@ -117,7 +117,7 @@ it "returns a user" do user = @client.update_profile_image(fixture("me.jpeg")) expect(user).to be_a Twitter::User - expect(user.id).to eq 7505382 + expect(user.id).to eq(7505382) end end @@ -133,7 +133,7 @@ it "returns the users in a given category of the Twitter suggested user list" do suggestion = @client.suggestions("art-design") expect(suggestion).to be_a Twitter::Suggestion - expect(suggestion.name).to eq "Art & Design" + expect(suggestion.name).to eq("Art & Design") expect(suggestion.users).to be_an Array expect(suggestion.users.first).to be_a Twitter::User end @@ -150,7 +150,7 @@ suggestions = @client.suggestions expect(suggestions).to be_an Array expect(suggestions.first).to be_a Twitter::Suggestion - expect(suggestions.first.name).to eq "Art & Design" + expect(suggestions.first.name).to eq("Art & Design") end end end @@ -167,7 +167,7 @@ suggest_users = @client.suggest_users("art-design") expect(suggest_users).to be_an Array expect(suggest_users.first).to be_a Twitter::User - expect(suggest_users.first.id).to eq 13 + expect(suggest_users.first.id).to eq(13) end end @@ -183,7 +183,7 @@ blocking = @client.blocking expect(blocking).to be_a Twitter::Cursor expect(blocking.first).to be_a Twitter::User - expect(blocking.first.id).to eq 7505382 + expect(blocking.first.id).to eq(7505382) end context "with each" do before do @@ -208,7 +208,7 @@ it "returns an array of numeric user IDs the authenticating user is blocking" do blocked_ids = @client.blocked_ids expect(blocked_ids).to be_a Twitter::Cursor - expect(blocked_ids.first).to eq 20009713 + expect(blocked_ids.first).to eq(20009713) end context "with each" do before do @@ -282,7 +282,7 @@ users = @client.block("sferik") expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end @@ -298,7 +298,7 @@ users = @client.unblock("sferik") expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end end @@ -316,7 +316,7 @@ users = @client.users("sferik", "pengwynn") expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end context "with URI objects passed" do it "requests the correct resource" do @@ -385,7 +385,7 @@ users = @client.users("sferik", "pengwynn", :method => :get) expect(users).to be_an Array expect(users.first).to be_a Twitter::User - expect(users.first.id).to eq 7505382 + expect(users.first.id).to eq(7505382) end context "with URI objects passed" do it "requests the correct resource" do @@ -455,7 +455,7 @@ it "returns extended information of a given user" do user = @client.user("sferik") expect(user).to be_a Twitter::User - expect(user.id).to eq 7505382 + expect(user.id).to eq(7505382) end end context "with a screen name including '@' passed" do @@ -548,7 +548,7 @@ user_search = @client.user_search("Erik Michaels-Ober") expect(user_search).to be_an Array expect(user_search.first).to be_a Twitter::User - expect(user_search.first.id).to eq 7505382 + expect(user_search.first.id).to eq(7505382) end end @@ -565,7 +565,7 @@ contributees = @client.contributees("sferik") expect(contributees).to be_an Array expect(contributees.first).to be_a Twitter::User - expect(contributees.first.name).to eq "Twitter API" + expect(contributees.first.name).to eq("Twitter API") end end context "with a user ID passed" do @@ -590,7 +590,7 @@ contributees = @client.contributees expect(contributees).to be_an Array expect(contributees.first).to be_a Twitter::User - expect(contributees.first.name).to eq "Twitter API" + expect(contributees.first.name).to eq("Twitter API") end end end @@ -608,7 +608,7 @@ contributors = @client.contributors("sferik") expect(contributors).to be_an Array expect(contributors.first).to be_a Twitter::User - expect(contributors.first.id).to eq 13 + expect(contributors.first.id).to eq(13) end end context "with a user ID passed" do @@ -633,7 +633,7 @@ contributors = @client.contributors expect(contributors).to be_an Array expect(contributors.first).to be_a Twitter::User - expect(contributors.first.id).to eq 13 + expect(contributors.first.id).to eq(13) end end end @@ -679,7 +679,7 @@ banner = @client.profile_banner("sferik") expect(banner).to be_a Twitter::ProfileBanner expect(banner.sizes).to be_a Hash - expect(banner.sizes[:mobile].height).to eq 160 + expect(banner.sizes[:mobile].height).to eq(160) end end context "with a user ID passed" do @@ -705,7 +705,7 @@ banner = @client.profile_banner expect(banner).to be_a Twitter::ProfileBanner expect(banner.sizes).to be_a Hash - expect(banner.sizes[:mobile].height).to eq 160 + expect(banner.sizes[:mobile].height).to eq(160) end end end diff --git a/spec/twitter/client_spec.rb b/spec/twitter/client_spec.rb index cecaf8ece..5104ec282 100644 --- a/spec/twitter/client_spec.rb +++ b/spec/twitter/client_spec.rb @@ -23,7 +23,7 @@ it "inherits the module configuration" do client = Twitter::Client.new Twitter::Configurable.keys.each do |key| - expect(client.instance_variable_get(:"@#{key}")).to eq key + expect(client.instance_variable_get(:"@#{key}")).to eq(key) end end @@ -46,7 +46,7 @@ it "overrides the module configuration" do client = Twitter::Client.new(@configuration) Twitter::Configurable.keys.each do |key| - expect(client.instance_variable_get(:"@#{key}")).to eq @configuration[key] + expect(client.instance_variable_get(:"@#{key}")).to eq(@configuration[key]) end end end @@ -60,7 +60,7 @@ end end Twitter::Configurable.keys.each do |key| - expect(client.instance_variable_get(:"@#{key}")).to eq @configuration[key] + expect(client.instance_variable_get(:"@#{key}")).to eq(@configuration[key]) end end end @@ -70,11 +70,10 @@ it "does not cache the screen name across clients" do stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - client1 = Twitter::Client.new - expect(client1.verify_credentials.id).to eq 7505382 + user1 = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS").current_user stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("pengwynn.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - client2 = Twitter::Client.new - expect(client2.verify_credentials.id).to eq 14100886 + user2 = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS").current_user + expect(user1).not_to eq(user2) end describe "#delete" do @@ -136,7 +135,7 @@ end it "memoizes the connection" do c1, c2 = subject.send(:connection), subject.send(:connection) - expect(c1.object_id).to eq c2.object_id + expect(c1.object_id).to eq(c2.object_id) end end @@ -165,12 +164,12 @@ it "creates the correct auth headers" do uri = "/1.1/direct_messages.json" authorization = subject.send(:oauth_auth_header, :get, uri) - expect(authorization.options[:signature_method]).to eq "HMAC-SHA1" - expect(authorization.options[:version]).to eq "1.0" - expect(authorization.options[:consumer_key]).to eq "CK" - expect(authorization.options[:consumer_secret]).to eq "CS" - expect(authorization.options[:token]).to eq "OT" - expect(authorization.options[:token_secret]).to eq "OS" + expect(authorization.options[:signature_method]).to eq("HMAC-SHA1") + expect(authorization.options[:version]).to eq("1.0") + expect(authorization.options[:consumer_key]).to eq("CK") + expect(authorization.options[:consumer_secret]).to eq("CS") + expect(authorization.options[:token]).to eq("OT") + expect(authorization.options[:token_secret]).to eq("OS") end it "submits the correct auth header when no media is present" do # We use static values for nounce and timestamp to get a stable signature @@ -207,14 +206,14 @@ it "creates the correct auth headers with supplied bearer_token" do authorization = subject.send(:bearer_auth_header) - expect(authorization).to eq "Bearer BT" + expect(authorization).to eq("Bearer BT") end end describe "#bearer_token_credentials_auth_header" do it "creates the correct auth header with supplied consumer_key and consumer_secret" do authorization = subject.send(:bearer_token_credentials_auth_header) - expect(authorization).to eq "Basic Q0s6Q1M=" + expect(authorization).to eq("Basic Q0s6Q1M=") end end end diff --git a/spec/twitter/cursor_spec.rb b/spec/twitter/cursor_spec.rb index 42f6c713e..42a6145b7 100644 --- a/spec/twitter/cursor_spec.rb +++ b/spec/twitter/cursor_spec.rb @@ -4,7 +4,7 @@ describe "#each" do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"}) stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end @@ -16,13 +16,13 @@ it "iterates" do count = 0 @client.follower_ids("sferik").each{count += 1} - expect(count).to eq 6 + expect(count).to eq(6) end context "with start" do it "iterates" do count = 0 @client.follower_ids("sferik").each(5){count += 1} - expect(count).to eq 1 + expect(count).to eq(1) end end end diff --git a/spec/twitter/entity/uri_spec.rb b/spec/twitter/entity/uri_spec.rb index 3dc6c4fed..cd7e82070 100644 --- a/spec/twitter/entity/uri_spec.rb +++ b/spec/twitter/entity/uri_spec.rb @@ -6,7 +6,7 @@ it "returns a URI when the display_url is set" do uri = Twitter::Entity::URI.new(:display_url => "https://github.com/sferik") expect(uri.display_uri).to be_a URI - expect(uri.display_uri.to_s).to eq "https://github.com/sferik" + expect(uri.display_uri.to_s).to eq("https://github.com/sferik") end it "returns nil when the display_url is not set" do uri = Twitter::Entity::URI.new @@ -29,7 +29,7 @@ it "returns a URI when the expanded_url is set" do uri = Twitter::Entity::URI.new(:expanded_url => "https://github.com/sferik") expect(uri.expanded_uri).to be_a URI - expect(uri.expanded_uri.to_s).to eq "https://github.com/sferik" + expect(uri.expanded_uri.to_s).to eq("https://github.com/sferik") end it "returns nil when the expanded_url is not set" do uri = Twitter::Entity::URI.new @@ -52,7 +52,7 @@ it "returns a URI when the url is set" do uri = Twitter::Entity::URI.new(:url => "https://github.com/sferik") expect(uri.uri).to be_a URI - expect(uri.uri.to_s).to eq "https://github.com/sferik" + expect(uri.uri.to_s).to eq("https://github.com/sferik") end it "returns nil when the url is not set" do uri = Twitter::Entity::URI.new diff --git a/spec/twitter/error_spec.rb b/spec/twitter/error_spec.rb index bf19c7f8e..f61a80e06 100644 --- a/spec/twitter/error_spec.rb +++ b/spec/twitter/error_spec.rb @@ -3,7 +3,7 @@ describe Twitter::Error do before do - @client = Twitter::Client.new + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") end describe "#initialize" do @@ -14,8 +14,8 @@ begin raise Twitter::Error rescue Twitter::Error => error - expect(error.message).to eq "Oops" - expect(error.wrapped_exception.class).to eq Faraday::Error::ClientError + expect(error.message).to eq("Oops") + expect(error.wrapped_exception.class).to eq(Faraday::Error::ClientError) end end end @@ -44,7 +44,7 @@ end it "raises #{exception.name}" do expect{@client.user_timeline("sferik")}.to raise_error { |error| - expect(error.code).to eq nil + expect(error.code).to be_nil } end context "when error code is 187" do @@ -54,7 +54,7 @@ end it "raises #{exception.name}" do expect{@client.user_timeline("sferik")}.to raise_error { |error| - expect(error.code).to eq 187 + expect(error.code).to eq(187) } end end diff --git a/spec/twitter/geo/point_spec.rb b/spec/twitter/geo/point_spec.rb index 8cef97eb0..618473abc 100644 --- a/spec/twitter/geo/point_spec.rb +++ b/spec/twitter/geo/point_spec.rb @@ -34,7 +34,7 @@ describe "#longitude" do it "returns the longitude" do - expect(@point.longitude).to eq 37.788299 + expect(@point.longitude).to eq(37.788299) end end diff --git a/spec/twitter/geo_results_spec.rb b/spec/twitter/geo_results_spec.rb index 536beadc8..bc5ce1a83 100644 --- a/spec/twitter/geo_results_spec.rb +++ b/spec/twitter/geo_results_spec.rb @@ -9,13 +9,13 @@ it "iterates" do count = 0 @geo_results.each{count += 1} - expect(count).to eq 6 + expect(count).to eq(6) end context "with start" do it "iterates" do count = 0 @geo_results.each(5){count += 1} - expect(count).to eq 1 + expect(count).to eq(1) end end end @@ -24,7 +24,7 @@ it "returns a String when token is set" do geo_results = Twitter::GeoResults.new(:result => {}, :token => "abc123") expect(geo_results.token).to be_a String - expect(geo_results.token).to eq "abc123" + expect(geo_results.token).to eq("abc123") end it "returns nil when token is not set" do geo_results = Twitter::GeoResults.new(:result => {}) diff --git a/spec/twitter/list_spec.rb b/spec/twitter/list_spec.rb index c8723a292..9b7d614eb 100644 --- a/spec/twitter/list_spec.rb +++ b/spec/twitter/list_spec.rb @@ -45,21 +45,21 @@ describe "#members_uri" do it "returns the URI to the list members" do list = Twitter::List.new(:id => 8863586, :slug => "presidents", :user => {:id => 7505382, :screen_name => "sferik"}) - expect(list.members_uri.to_s).to eq "https://twitter.com/sferik/presidents/members" + expect(list.members_uri.to_s).to eq("https://twitter.com/sferik/presidents/members") end end describe "#subscribers_uri" do it "returns the URI to the list subscribers" do list = Twitter::List.new(:id => 8863586, :slug => "presidents", :user => {:id => 7505382, :screen_name => "sferik"}) - expect(list.subscribers_uri.to_s).to eq "https://twitter.com/sferik/presidents/subscribers" + expect(list.subscribers_uri.to_s).to eq("https://twitter.com/sferik/presidents/subscribers") end end describe "#uri" do it "returns the URI to the list" do list = Twitter::List.new(:id => 8863586, :slug => "presidents", :user => {:id => 7505382, :screen_name => "sferik"}) - expect(list.uri.to_s).to eq "https://twitter.com/sferik/presidents" + expect(list.uri.to_s).to eq("https://twitter.com/sferik/presidents") end end diff --git a/spec/twitter/media/photo_spec.rb b/spec/twitter/media/photo_spec.rb index 86c6185b6..8e5c28582 100644 --- a/spec/twitter/media/photo_spec.rb +++ b/spec/twitter/media/photo_spec.rb @@ -36,7 +36,7 @@ it "returns a URI when the display_url is set" do photo = Twitter::Media::Photo.new(:id => 1, :display_url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") expect(photo.display_uri).to be_a URI - expect(photo.display_uri.to_s).to eq "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png" + expect(photo.display_uri.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") end it "returns nil when the display_url is not set" do photo = Twitter::Media::Photo.new(:id => 1) @@ -59,7 +59,7 @@ it "returns a URI when the expanded_url is set" do photo = Twitter::Media::Photo.new(:id => 1, :expanded_url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") expect(photo.expanded_uri).to be_a URI - expect(photo.expanded_uri.to_s).to eq "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png" + expect(photo.expanded_uri.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") end it "returns nil when the expanded_url is not set" do photo = Twitter::Media::Photo.new(:id => 1) @@ -82,7 +82,7 @@ it "returns a URI when the media_url is set" do photo = Twitter::Media::Photo.new(:id => 1, :media_url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") expect(photo.media_uri).to be_a URI - expect(photo.media_uri.to_s).to eq "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png" + expect(photo.media_uri.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") end it "returns nil when the media_url is not set" do photo = Twitter::Media::Photo.new(:id => 1) @@ -105,7 +105,7 @@ it "returns a URI when the media_url_https is set" do photo = Twitter::Media::Photo.new(:id => 1, :media_url_https => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") expect(photo.media_uri_https).to be_a URI - expect(photo.media_uri_https.to_s).to eq "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png" + expect(photo.media_uri_https.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") end it "returns nil when the media_url_https is not set" do photo = Twitter::Media::Photo.new(:id => 1) @@ -128,7 +128,7 @@ it "returns a URI when the url is set" do photo = Twitter::Media::Photo.new(:id => 1, :url => "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") expect(photo.uri).to be_a URI - expect(photo.uri.to_s).to eq "http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png" + expect(photo.uri.to_s).to eq("http://pbs.twimg.com/media/BQD6MPOCEAAbCH0.png") end it "returns nil when the url is not set" do photo = Twitter::Media::Photo.new(:id => 1) diff --git a/spec/twitter/oembed_spec.rb b/spec/twitter/oembed_spec.rb index 5e0070d0a..84d816ab8 100644 --- a/spec/twitter/oembed_spec.rb +++ b/spec/twitter/oembed_spec.rb @@ -6,7 +6,7 @@ it "returns a URI when the author_url is set" do oembed = Twitter::OEmbed.new(:author_url => "https://twitter.com/sferik") expect(oembed.author_uri).to be_a URI - expect(oembed.author_uri.to_s).to eq "https://twitter.com/sferik" + expect(oembed.author_uri.to_s).to eq("https://twitter.com/sferik") end it "returns nil when the author_uri is not set" do oembed = Twitter::OEmbed.new @@ -28,7 +28,7 @@ describe "#author_name" do it "returns the author's name" do oembed = Twitter::OEmbed.new(:author_name => "Erik Michaels-Ober") - expect(oembed.author_name).to eq "Erik Michaels-Ober" + expect(oembed.author_name).to eq("Erik Michaels-Ober") end it "returns nil when not set" do author_name = Twitter::OEmbed.new.author_name @@ -39,7 +39,7 @@ describe "#cache_age" do it "returns the cache_age" do oembed = Twitter::OEmbed.new(:cache_age => "31536000000") - expect(oembed.cache_age).to eq "31536000000" + expect(oembed.cache_age).to eq("31536000000") end it "returns nil when not set" do cache_age = Twitter::OEmbed.new.cache_age @@ -50,7 +50,7 @@ describe "#height" do it "returns the height" do oembed = Twitter::OEmbed.new(:height => 200) - expect(oembed.height).to eq 200 + expect(oembed.height).to eq(200) end it "returns it as an Integer" do oembed = Twitter::OEmbed.new(:height => 200) @@ -65,7 +65,7 @@ describe "#html" do it "returns the html" do oembed = Twitter::OEmbed.new(:html => "
all my witty tweet stuff here
") - expect(oembed.html).to eq "
all my witty tweet stuff here
" + expect(oembed.html).to eq("
all my witty tweet stuff here
") end it "returns nil when not set" do html = Twitter::OEmbed.new.html @@ -76,7 +76,7 @@ describe "#provider_name" do it "returns the provider_name" do oembed = Twitter::OEmbed.new(:provider_name => "Twitter") - expect(oembed.provider_name).to eq "Twitter" + expect(oembed.provider_name).to eq("Twitter") end it "returns nil when not set" do provider_name = Twitter::OEmbed.new.provider_name @@ -88,7 +88,7 @@ it "returns a URI when the provider_url is set" do oembed = Twitter::OEmbed.new(:provider_url => "http://twitter.com") expect(oembed.provider_uri).to be_a URI - expect(oembed.provider_uri.to_s).to eq "http://twitter.com" + expect(oembed.provider_uri.to_s).to eq("http://twitter.com") end it "returns nil when the provider_uri is not set" do oembed = Twitter::OEmbed.new @@ -110,7 +110,7 @@ describe "#type" do it "returns the type" do oembed = Twitter::OEmbed.new(:type => "rich") - expect(oembed.type).to eq "rich" + expect(oembed.type).to eq("rich") end it "returns nil when not set" do type = Twitter::OEmbed.new.type @@ -121,7 +121,7 @@ describe "#width" do it "returns the width" do oembed = Twitter::OEmbed.new(:width => 550) - expect(oembed.width).to eq 550 + expect(oembed.width).to eq(550) end it "returns it as an Integer" do oembed = Twitter::OEmbed.new(:width => 550) @@ -137,7 +137,7 @@ it "returns a URI when the url is set" do oembed = Twitter::OEmbed.new(:url => "https://twitter.com/twitterapi/status/133640144317198338") expect(oembed.uri).to be_a URI - expect(oembed.uri.to_s).to eq "https://twitter.com/twitterapi/status/133640144317198338" + expect(oembed.uri.to_s).to eq("https://twitter.com/twitterapi/status/133640144317198338") end it "returns nil when the url is not set" do oembed = Twitter::OEmbed.new @@ -159,7 +159,7 @@ describe "#version" do it "returns the version" do oembed = Twitter::OEmbed.new(:version => "1.0") - expect(oembed.version).to eq "1.0" + expect(oembed.version).to eq("1.0") end it "returns nil when not set" do version = Twitter::OEmbed.new.version diff --git a/spec/twitter/place_spec.rb b/spec/twitter/place_spec.rb index b666175df..a61f58ce0 100644 --- a/spec/twitter/place_spec.rb +++ b/spec/twitter/place_spec.rb @@ -67,11 +67,11 @@ describe "#country_code" do it "returns a country code when set with country_code" do place = Twitter::Place.new(:id => "247f43d441defc03", :country_code => "US") - expect(place.country_code).to eq "US" + expect(place.country_code).to eq("US") end it "returns a country code when set with countryCode" do place = Twitter::Place.new(:id => "247f43d441defc03", :countryCode => "US") - expect(place.country_code).to eq "US" + expect(place.country_code).to eq("US") end it "returns nil when not set" do place = Twitter::Place.new(:id => "247f43d441defc03") @@ -82,7 +82,7 @@ describe "#parent_id" do it "returns a parent ID when set with parentid" do place = Twitter::Place.new(:id => "247f43d441defc03", :parentid => 1) - expect(place.parent_id).to eq 1 + expect(place.parent_id).to eq(1) end it "returns nil when not set" do place = Twitter::Place.new(:id => "247f43d441defc03") @@ -93,11 +93,11 @@ describe "#place_type" do it "returns a place type when set with place_type" do place = Twitter::Place.new(:id => "247f43d441defc03", :place_type => "city") - expect(place.place_type).to eq "city" + expect(place.place_type).to eq("city") end it "returns a place type when set with placeType[name]" do place = Twitter::Place.new(:id => "247f43d441defc03", :placeType => {:name => "Town"}) - expect(place.place_type).to eq "Town" + expect(place.place_type).to eq("Town") end it "returns nil when not set" do place = Twitter::Place.new(:id => "247f43d441defc03") @@ -109,7 +109,7 @@ it "returns a URI when the url is set" do place = Twitter::Place.new(:id => "247f43d441defc03", :url => "https://api.twitter.com/1.1/geo/id/247f43d441defc03.json") expect(place.uri).to be_a URI - expect(place.uri.to_s).to eq "https://api.twitter.com/1.1/geo/id/247f43d441defc03.json" + expect(place.uri.to_s).to eq("https://api.twitter.com/1.1/geo/id/247f43d441defc03.json") end it "returns nil when the url is not set" do place = Twitter::Place.new(:id => "247f43d441defc03") diff --git a/spec/twitter/rate_limit_spec.rb b/spec/twitter/rate_limit_spec.rb index aa03bfa67..329201c39 100644 --- a/spec/twitter/rate_limit_spec.rb +++ b/spec/twitter/rate_limit_spec.rb @@ -6,7 +6,7 @@ it "returns an Integer when x-rate-limit-limit header is set" do rate_limit = Twitter::RateLimit.new("x-rate-limit-limit" => "150") expect(rate_limit.limit).to be_an Integer - expect(rate_limit.limit).to eq 150 + expect(rate_limit.limit).to eq(150) end it "returns nil when x-rate-limit-limit header is not set" do rate_limit = Twitter::RateLimit.new @@ -18,7 +18,7 @@ it "returns an Integer when x-rate-limit-remaining header is set" do rate_limit = Twitter::RateLimit.new("x-rate-limit-remaining" => "149") expect(rate_limit.remaining).to be_an Integer - expect(rate_limit.remaining).to eq 149 + expect(rate_limit.remaining).to eq(149) end it "returns nil when x-rate-limit-remaining header is not set" do rate_limit = Twitter::RateLimit.new @@ -30,7 +30,7 @@ it "returns a Time when x-rate-limit-reset header is set" do rate_limit = Twitter::RateLimit.new("x-rate-limit-reset" => "1339019097") expect(rate_limit.reset_at).to be_a Time - expect(rate_limit.reset_at).to eq Time.at(1339019097) + expect(rate_limit.reset_at).to eq(Time.at(1339019097)) end it "returns nil when x-rate-limit-reset header is not set" do rate_limit = Twitter::RateLimit.new @@ -48,7 +48,7 @@ it "returns an Integer when x-rate-limit-reset header is set" do rate_limit = Twitter::RateLimit.new("x-rate-limit-reset" => "1339019097") expect(rate_limit.reset_in).to be_an Integer - expect(rate_limit.reset_in).to eq 15777 + expect(rate_limit.reset_in).to eq(15777) end it "returns nil when x-rate-limit-reset header is not set" do rate_limit = Twitter::RateLimit.new @@ -66,10 +66,10 @@ it "updates a rate limit" do rate_limit = Twitter::RateLimit.new("x-rate-limit-reset" => "1339019097") expect(rate_limit.reset_in).to be_an Integer - expect(rate_limit.reset_in).to eq 15777 + expect(rate_limit.reset_in).to eq(15777) rate_limit.update({"x-rate-limit-reset" => "1339019098"}) expect(rate_limit.reset_in).to be_an Integer - expect(rate_limit.reset_in).to eq 15778 + expect(rate_limit.reset_in).to eq(15778) end end diff --git a/spec/twitter/relationship_spec.rb b/spec/twitter/relationship_spec.rb index 1128c38dd..58885d61f 100644 --- a/spec/twitter/relationship_spec.rb +++ b/spec/twitter/relationship_spec.rb @@ -50,7 +50,7 @@ it "updates a relationship" do relationship = Twitter::Relationship.new(:relationship => {:target => {:id => 7505382}}) relationship.update(:relationship => {:target => {:id => 14100886}}) - expect(relationship.target.id).to eq 14100886 + expect(relationship.target.id).to eq(14100886) end end diff --git a/spec/twitter/search_results_spec.rb b/spec/twitter/search_results_spec.rb index 903b81b0b..8095bcb53 100644 --- a/spec/twitter/search_results_spec.rb +++ b/spec/twitter/search_results_spec.rb @@ -9,13 +9,13 @@ it "iterates" do count = 0 @search_results.each{count += 1} - expect(count).to eq 6 + expect(count).to eq(6) end context "with start" do it "iterates" do count = 0 @search_results.each(5){count += 1} - expect(count).to eq 1 + expect(count).to eq(1) end end end @@ -24,7 +24,7 @@ it "returns a number of seconds" do completed_in = Twitter::SearchResults.new(:search_metadata => {:completed_in => 0.029}).completed_in expect(completed_in).to be_a Float - expect(completed_in).to eq 0.029 + expect(completed_in).to eq(0.029) end it "is nil when not set" do completed_in = Twitter::SearchResults.new.completed_in @@ -36,7 +36,7 @@ it "returns an ID" do max_id = Twitter::SearchResults.new(:search_metadata => {:max_id => 250126199840518145}).max_id expect(max_id).to be_an Integer - expect(max_id).to eq 250126199840518145 + expect(max_id).to eq(250126199840518145) end it "is nil when not set" do max_id = Twitter::SearchResults.new.max_id @@ -48,7 +48,7 @@ it "returns page number" do page = Twitter::SearchResults.new(:search_metadata => {:page => 1}).page expect(page).to be_an Integer - expect(page).to eq 1 + expect(page).to eq(1) end it "is nil when not set" do page = Twitter::SearchResults.new.page @@ -60,7 +60,7 @@ it "returns the query" do query = Twitter::SearchResults.new(:search_metadata => {:query => "%23freebandnames"}).query expect(query).to be_a String - expect(query).to eq "%23freebandnames" + expect(query).to eq("%23freebandnames") end it "is nil when not set" do query = Twitter::SearchResults.new.query @@ -72,7 +72,7 @@ it "returns the number of results per page" do results_per_page = Twitter::SearchResults.new(:search_metadata => {:count => 4}).results_per_page expect(results_per_page).to be_an Integer - expect(results_per_page).to eq 4 + expect(results_per_page).to eq(4) end it "is nil when not set" do results_per_page = Twitter::SearchResults.new.results_per_page @@ -84,7 +84,7 @@ it "returns an ID" do since_id = Twitter::SearchResults.new(:search_metadata => {:since_id => 250126199840518145}).since_id expect(since_id).to be_an Integer - expect(since_id).to eq 250126199840518145 + expect(since_id).to eq(250126199840518145) end it "is nil when not set" do since_id = Twitter::SearchResults.new.since_id @@ -111,7 +111,7 @@ it "returns a hash of query parameters" do search_results = Twitter::SearchResults.new(:search_metadata => {:next_results => "?max_id=249279667666817023&q=%23freebandnames&count=4&include_entities=1&result_type=mixed"}) expect(search_results.next_results).to be_a Hash - expect(search_results.next_results[:max_id]).to eq "249279667666817023" + expect(search_results.next_results[:max_id]).to eq("249279667666817023") end end @@ -119,7 +119,7 @@ it "returns a hash of query parameters" do search_results = Twitter::SearchResults.new(:search_metadata => {:refresh_url => "?since_id=249279667666817023&q=%23freebandnames&count=4&include_entities=1&result_type=recent"}) expect(search_results.refresh_results).to be_a Hash - expect(search_results.refresh_results[:since_id]).to eq "249279667666817023" + expect(search_results.refresh_results[:since_id]).to eq("249279667666817023") end end diff --git a/spec/twitter/trend_results_spec.rb b/spec/twitter/trend_results_spec.rb index 220019d37..2402d5c08 100644 --- a/spec/twitter/trend_results_spec.rb +++ b/spec/twitter/trend_results_spec.rb @@ -53,13 +53,13 @@ it "iterates" do count = 0 @trend_results.each{count += 1} - expect(count).to eq 6 + expect(count).to eq(6) end context "with start" do it "iterates" do count = 0 @trend_results.each(5){count += 1} - expect(count).to eq 1 + expect(count).to eq(1) end end end diff --git a/spec/twitter/trend_spec.rb b/spec/twitter/trend_spec.rb index bd86857a5..950272319 100644 --- a/spec/twitter/trend_spec.rb +++ b/spec/twitter/trend_spec.rb @@ -39,7 +39,7 @@ it "returns a URI when the url is set" do trend = Twitter::Trend.new(:url => "http://twitter.com/search/?q=%23sevenwordsaftersex") expect(trend.uri).to be_a URI - expect(trend.uri.to_s).to eq "http://twitter.com/search/?q=%23sevenwordsaftersex" + expect(trend.uri.to_s).to eq("http://twitter.com/search/?q=%23sevenwordsaftersex") end it "returns nil when the url is not set" do trend = Twitter::Trend.new diff --git a/spec/twitter/tweet_spec.rb b/spec/twitter/tweet_spec.rb index ecf9be3a5..a6212ee7b 100644 --- a/spec/twitter/tweet_spec.rb +++ b/spec/twitter/tweet_spec.rb @@ -75,11 +75,11 @@ it "returns the filter level when filter_level is set" do tweet = Twitter::Tweet.new(:id => 28669546014, :filter_level => "high") expect(tweet.filter_level).to be_a String - expect(tweet.filter_level).to eq "high" + expect(tweet.filter_level).to eq("high") end it "returns \"none\" when not set" do tweet = Twitter::Tweet.new(:id => 28669546014) - expect(tweet.filter_level).to eq "none" + expect(tweet.filter_level).to eq("none") end end @@ -87,17 +87,17 @@ it "returns the text of a Tweet" do tweet = Twitter::Tweet.new(:id => 28669546014, :text => "BOOSH") expect(tweet.full_text).to be_a String - expect(tweet.full_text).to eq "BOOSH" + expect(tweet.full_text).to eq("BOOSH") end it "returns the text of a Tweet without a user" do tweet = Twitter::Tweet.new(:id => 28669546014, :text => "BOOSH", :retweeted_status => {:id => 28561922517, :text => "BOOSH"}) expect(tweet.full_text).to be_a String - expect(tweet.full_text).to eq "BOOSH" + expect(tweet.full_text).to eq("BOOSH") end it "returns the full text of a retweeted Tweet" do tweet = Twitter::Tweet.new(:id => 28669546014, :text => "RT @sferik: BOOSH", :retweeted_status => {:id => 25938088801, :text => "BOOSH"}) expect(tweet.full_text).to be_a String - expect(tweet.full_text).to eq "RT @sferik: BOOSH" + expect(tweet.full_text).to eq("RT @sferik: BOOSH") end it "returns nil when retweeted_status is not set" do tweet = Twitter::Tweet.new(:id => 28669546014) @@ -138,8 +138,8 @@ hashtags = Twitter::Tweet.new(:id => 28669546014, :entities => {:hashtags => hashtags_array}).hashtags expect(hashtags).to be_an Array expect(hashtags.first).to be_a Twitter::Entity::Hashtag - expect(hashtags.first.indices).to eq [10, 33] - expect(hashtags.first.text).to eq "twitter" + expect(hashtags.first.indices).to eq([10, 33]) + expect(hashtags.first.text).to eq("twitter") end it "is empty when not set" do hashtags = Twitter::Tweet.new(:id => 28669546014).hashtags @@ -237,7 +237,7 @@ it "returns a Tweet when retweeted_status is set" do tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => "BOOSH"}) expect(tweet.retweeted_tweet).to be_a Twitter::Tweet - expect(tweet.retweeted_tweet.text).to eq "BOOSH" + expect(tweet.retweeted_tweet.text).to eq("BOOSH") end it "returns nil when retweeted_status is not set" do tweet = Twitter::Tweet.new(:id => 28669546014) @@ -264,10 +264,10 @@ ] symbols = Twitter::Tweet.new(:id => 28669546014, :entities => {:symbols => symbols_array}).symbols expect(symbols).to be_an Array - expect(symbols.size).to eq 2 + expect(symbols.size).to eq(2) expect(symbols.first).to be_a Twitter::Entity::Symbol - expect(symbols.first.indices).to eq [114, 118] - expect(symbols.first.text).to eq "PEP" + expect(symbols.first.indices).to eq([114, 118]) + expect(symbols.first.text).to eq("PEP") end it "is empty when not set" do symbols = Twitter::Tweet.new(:id => 28669546014).symbols @@ -292,9 +292,9 @@ tweet = Twitter::Tweet.new(:id => 28669546014, :entities => {:urls => urls_array}) expect(tweet.uris).to be_an Array expect(tweet.uris.first).to be_a Twitter::Entity::URI - expect(tweet.uris.first.indices).to eq [10, 33] + expect(tweet.uris.first.indices).to eq([10, 33]) expect(tweet.uris.first.display_uri).to be_a URI - expect(tweet.uris.first.display_uri.to_s).to eq "example.com/expanded" + expect(tweet.uris.first.display_uri.to_s).to eq("example.com/expanded") end it "is empty when not set" do tweet = Twitter::Tweet.new(:id => 28669546014) @@ -310,7 +310,7 @@ it "returns the URI to the tweet" do tweet = Twitter::Tweet.new(:id => 28669546014, :user => {:id => 7505382, :screen_name => "sferik"}) expect(tweet.uri).to be_a URI - expect(tweet.uri.to_s).to eq "https://twitter.com/sferik/status/28669546014" + expect(tweet.uri.to_s).to eq("https://twitter.com/sferik/status/28669546014") end end @@ -354,8 +354,8 @@ user_mentions = Twitter::Tweet.new(:id => 28669546014, :entities => {:user_mentions => user_mentions_array}).user_mentions expect(user_mentions).to be_an Array expect(user_mentions.first).to be_a Twitter::Entity::UserMention - expect(user_mentions.first.indices).to eq [0, 6] - expect(user_mentions.first.id).to eq 7505382 + expect(user_mentions.first.indices).to eq([0, 6]) + expect(user_mentions.first.id).to eq(7505382) end it "is empty when not set" do user_mentions = Twitter::Tweet.new(:id => 28669546014).user_mentions diff --git a/spec/twitter/user_spec.rb b/spec/twitter/user_spec.rb index 0bc77f82f..049c4629b 100644 --- a/spec/twitter/user_spec.rb +++ b/spec/twitter/user_spec.rb @@ -55,8 +55,8 @@ user = Twitter::User.new(:id => 7505382, :entities => {:description => {:urls => urls_array}}) expect(user.description_uris).to be_an Array expect(user.description_uris.first).to be_a Twitter::Entity::URI - expect(user.description_uris.first.indices).to eq [10, 33] - expect(user.description_uris.first.display_uri.to_s).to eq "example.com/expanded" + expect(user.description_uris.first.indices).to eq([10, 33]) + expect(user.description_uris.first.display_uri.to_s).to eq("example.com/expanded") end it "is empty when not set" do user = Twitter::User.new(:id => 7505382, :entities => {:description => {:urls => []}}) @@ -75,36 +75,36 @@ end it "returns the web-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri.to_s).to eq "http://si0.twimg.com/profile_banners/7505382/1348266581/web" + expect(user.profile_banner_uri.to_s).to eq("http://si0.twimg.com/profile_banners/7505382/1348266581/web") end context "with :web_retina passed" do it "returns the web retina-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri(:web_retina).to_s).to eq "http://si0.twimg.com/profile_banners/7505382/1348266581/web_retina" + expect(user.profile_banner_uri(:web_retina).to_s).to eq("http://si0.twimg.com/profile_banners/7505382/1348266581/web_retina") end end context "with :mobile passed" do it "returns the mobile-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri(:mobile).to_s).to eq "http://si0.twimg.com/profile_banners/7505382/1348266581/mobile" + expect(user.profile_banner_uri(:mobile).to_s).to eq("http://si0.twimg.com/profile_banners/7505382/1348266581/mobile") end end context "with :mobile_retina passed" do it "returns the mobile retina-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri(:mobile_retina).to_s).to eq "http://si0.twimg.com/profile_banners/7505382/1348266581/mobile_retina" + expect(user.profile_banner_uri(:mobile_retina).to_s).to eq("http://si0.twimg.com/profile_banners/7505382/1348266581/mobile_retina") end end context "with :ipad passed" do it "returns the mobile-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri(:ipad).to_s).to eq "http://si0.twimg.com/profile_banners/7505382/1348266581/ipad" + expect(user.profile_banner_uri(:ipad).to_s).to eq("http://si0.twimg.com/profile_banners/7505382/1348266581/ipad") end end context "with :ipad_retina passed" do it "returns the mobile retina-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri(:ipad_retina).to_s).to eq "http://si0.twimg.com/profile_banners/7505382/1348266581/ipad_retina" + expect(user.profile_banner_uri(:ipad_retina).to_s).to eq("http://si0.twimg.com/profile_banners/7505382/1348266581/ipad_retina") end end end @@ -120,36 +120,36 @@ end it "returns the web-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri_https.to_s).to eq "https://si0.twimg.com/profile_banners/7505382/1348266581/web" + expect(user.profile_banner_uri_https.to_s).to eq("https://si0.twimg.com/profile_banners/7505382/1348266581/web") end context "with :web_retina passed" do it "returns the web retina-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri_https(:web_retina).to_s).to eq "https://si0.twimg.com/profile_banners/7505382/1348266581/web_retina" + expect(user.profile_banner_uri_https(:web_retina).to_s).to eq("https://si0.twimg.com/profile_banners/7505382/1348266581/web_retina") end end context "with :mobile passed" do it "returns the mobile-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri_https(:mobile).to_s).to eq "https://si0.twimg.com/profile_banners/7505382/1348266581/mobile" + expect(user.profile_banner_uri_https(:mobile).to_s).to eq("https://si0.twimg.com/profile_banners/7505382/1348266581/mobile") end end context "with :mobile_retina passed" do it "returns the mobile retina-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri_https(:mobile_retina).to_s).to eq "https://si0.twimg.com/profile_banners/7505382/1348266581/mobile_retina" + expect(user.profile_banner_uri_https(:mobile_retina).to_s).to eq("https://si0.twimg.com/profile_banners/7505382/1348266581/mobile_retina") end end context "with :ipad passed" do it "returns the mobile-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri_https(:ipad).to_s).to eq "https://si0.twimg.com/profile_banners/7505382/1348266581/ipad" + expect(user.profile_banner_uri_https(:ipad).to_s).to eq("https://si0.twimg.com/profile_banners/7505382/1348266581/ipad") end end context "with :ipad_retina passed" do it "returns the mobile retina-sized image" do user = Twitter::User.new(:id => 7505382, :profile_banner_url => "https://si0.twimg.com/profile_banners/7505382/1348266581") - expect(user.profile_banner_uri_https(:ipad_retina).to_s).to eq "https://si0.twimg.com/profile_banners/7505382/1348266581/ipad_retina" + expect(user.profile_banner_uri_https(:ipad_retina).to_s).to eq("https://si0.twimg.com/profile_banners/7505382/1348266581/ipad_retina") end end end @@ -176,32 +176,32 @@ end it "returns the normal-sized image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri.to_s).to eq "http://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png" + expect(user.profile_image_uri.to_s).to eq("http://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") end context "with :original passed" do it "returns the original image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri(:original).to_s).to eq "http://a0.twimg.com/profile_images/1759857427/image1326743606.png" + expect(user.profile_image_uri(:original).to_s).to eq("http://a0.twimg.com/profile_images/1759857427/image1326743606.png") end end context "with :bigger passed" do it "returns the bigger-sized image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri(:bigger).to_s).to eq "http://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png" + expect(user.profile_image_uri(:bigger).to_s).to eq("http://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png") end end context "with :mini passed" do it "returns the mini-sized image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri(:mini).to_s).to eq "http://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png" + expect(user.profile_image_uri(:mini).to_s).to eq("http://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png") end end context "with capitalized file extension" do it "returns the correct image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://si0.twimg.com/profile_images/67759670/DSCN2136_normal.JPG") - expect(user.profile_image_uri(:original).to_s).to eq "http://si0.twimg.com/profile_images/67759670/DSCN2136.JPG" - expect(user.profile_image_uri(:bigger).to_s).to eq "http://si0.twimg.com/profile_images/67759670/DSCN2136_bigger.JPG" - expect(user.profile_image_uri(:mini).to_s).to eq "http://si0.twimg.com/profile_images/67759670/DSCN2136_mini.JPG" + expect(user.profile_image_uri(:original).to_s).to eq("http://si0.twimg.com/profile_images/67759670/DSCN2136.JPG") + expect(user.profile_image_uri(:bigger).to_s).to eq("http://si0.twimg.com/profile_images/67759670/DSCN2136_bigger.JPG") + expect(user.profile_image_uri(:mini).to_s).to eq("http://si0.twimg.com/profile_images/67759670/DSCN2136_mini.JPG") end end end @@ -217,32 +217,32 @@ end it "returns the normal-sized image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri_https.to_s).to eq "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png" + expect(user.profile_image_uri_https.to_s).to eq("https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") end context "with :original passed" do it "returns the original image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri_https(:original).to_s).to eq "https://a0.twimg.com/profile_images/1759857427/image1326743606.png" + expect(user.profile_image_uri_https(:original).to_s).to eq("https://a0.twimg.com/profile_images/1759857427/image1326743606.png") end end context "with :bigger passed" do it "returns the bigger-sized image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri_https(:bigger).to_s).to eq "https://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png" + expect(user.profile_image_uri_https(:bigger).to_s).to eq("https://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png") end end context "with :mini passed" do it "returns the mini-sized image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png") - expect(user.profile_image_uri_https(:mini).to_s).to eq "https://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png" + expect(user.profile_image_uri_https(:mini).to_s).to eq("https://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png") end end context "with capitalized file extension" do it "returns the correct image" do user = Twitter::User.new(:id => 7505382, :profile_image_url_https => "https://si0.twimg.com/profile_images/67759670/DSCN2136_normal.JPG") - expect(user.profile_image_uri_https(:original).to_s).to eq "https://si0.twimg.com/profile_images/67759670/DSCN2136.JPG" - expect(user.profile_image_uri_https(:bigger).to_s).to eq "https://si0.twimg.com/profile_images/67759670/DSCN2136_bigger.JPG" - expect(user.profile_image_uri_https(:mini).to_s).to eq "https://si0.twimg.com/profile_images/67759670/DSCN2136_mini.JPG" + expect(user.profile_image_uri_https(:original).to_s).to eq("https://si0.twimg.com/profile_images/67759670/DSCN2136.JPG") + expect(user.profile_image_uri_https(:bigger).to_s).to eq("https://si0.twimg.com/profile_images/67759670/DSCN2136_bigger.JPG") + expect(user.profile_image_uri_https(:mini).to_s).to eq("https://si0.twimg.com/profile_images/67759670/DSCN2136_mini.JPG") end end end @@ -270,7 +270,7 @@ it "includes a User when user is set" do tweet = Twitter::User.new(:id => 7505382, :screen_name => "sferik", :status => {:id => 25938088801}).status expect(tweet.user).to be_a Twitter::User - expect(tweet.user.id).to eq 7505382 + expect(tweet.user.id).to eq(7505382) end end @@ -289,7 +289,7 @@ it "returns the URI to the user" do user = Twitter::User.new(:id => 7505382, :screen_name => "sferik") expect(user.uri).to be_a URI - expect(user.uri.to_s).to eq "https://twitter.com/sferik" + expect(user.uri.to_s).to eq("https://twitter.com/sferik") end end @@ -297,7 +297,7 @@ it "returns a URI when the url is set" do user = Twitter::User.new(:id => 7505382, :url => "https://github.com/sferik") expect(user.website).to be_a URI - expect(user.website.to_s).to eq "https://github.com/sferik" + expect(user.website.to_s).to eq("https://github.com/sferik") end it "returns nil when the url is not set" do user = Twitter::User.new(:id => 7505382) diff --git a/spec/twitter_spec.rb b/spec/twitter_spec.rb index 818717062..9cd4f92c7 100644 --- a/spec/twitter_spec.rb +++ b/spec/twitter_spec.rb @@ -9,6 +9,12 @@ context "when delegating to a client" do before do + Twitter.configure do |config| + config.consumer_key = 'CK' + config.consumer_secret = 'CS' + config.oauth_token = 'OT' + config.oauth_token_secret = 'OS' + end stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end @@ -18,7 +24,7 @@ end it "returns the same results as a client" do - expect(Twitter.user_timeline('sferik')).to eq Twitter::Client.new.user_timeline('sferik') + expect(Twitter.user_timeline('sferik')).to eq(Twitter::Client.new.user_timeline('sferik')) end end @@ -39,7 +45,7 @@ context "when the options don't change" do it "caches the client" do - expect(Twitter.new).to eq Twitter.new + expect(Twitter.new).to eq(Twitter.new) end end context "when the options change" do @@ -50,7 +56,7 @@ config.consumer_secret = '123' end client2 = Twitter.new - expect(client1).not_to eq client2 + expect(client1).not_to eq(client2) end end end @@ -61,7 +67,7 @@ Twitter.configure do |config| config.send("#{key}=", key) end - expect(Twitter.instance_variable_get(:"@#{key}")).to eq key + expect(Twitter.instance_variable_get(:"@#{key}")).to eq(key) end end