From 7e68c6bfb765a1685745be43cf78e318088c184e Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sat, 20 Jul 2013 19:14:50 +0200 Subject: [PATCH] Use double-quotes consistently throughout specs --- spec/twitter/action_factory_spec.rb | 12 +++--- spec/twitter/api/direct_messages_spec.rb | 2 +- spec/twitter/api/favorites_spec.rb | 2 +- spec/twitter/api/oauth_spec.rb | 2 +- spec/twitter/base_spec.rb | 10 ++--- spec/twitter/client_spec.rb | 36 ++++++++-------- spec/twitter/configuration_spec.rb | 2 +- spec/twitter/error/client_error_spec.rb | 4 +- spec/twitter/error/server_error_spec.rb | 4 +- spec/twitter/geo_factory_spec.rb | 4 +- spec/twitter/media/photo_spec.rb | 2 +- spec/twitter/media_factory_spec.rb | 2 +- spec/twitter/oembed_spec.rb | 18 ++++---- spec/twitter/place_spec.rb | 18 ++++---- spec/twitter/profile_banner_spec.rb | 2 +- spec/twitter/rate_limit_spec.rb | 12 +++--- spec/twitter/search_results_spec.rb | 2 +- spec/twitter/settings_spec.rb | 2 +- spec/twitter/tweet_spec.rb | 54 ++++++++++++------------ spec/twitter/user_spec.rb | 10 ++--- 20 files changed, 100 insertions(+), 100 deletions(-) diff --git a/spec/twitter/action_factory_spec.rb b/spec/twitter/action_factory_spec.rb index 74ab66f90..ec572b8d5 100644 --- a/spec/twitter/action_factory_spec.rb +++ b/spec/twitter/action_factory_spec.rb @@ -4,27 +4,27 @@ describe ".new" do it "generates a Favorite" do - action = Twitter::ActionFactory.new(:action => 'favorite') + action = Twitter::ActionFactory.new(:action => "favorite") expect(action).to be_a Twitter::Action::Favorite end it "generates a Follow" do - action = Twitter::ActionFactory.new(:action => 'follow') + action = Twitter::ActionFactory.new(:action => "follow") expect(action).to be_a Twitter::Action::Follow end it "generates a ListMemberAdded" do - action = Twitter::ActionFactory.new(:action => 'list_member_added') + action = Twitter::ActionFactory.new(:action => "list_member_added") expect(action).to be_a Twitter::Action::ListMemberAdded end it "generates a Mention" do - action = Twitter::ActionFactory.new(:action => 'mention') + action = Twitter::ActionFactory.new(:action => "mention") expect(action).to be_a Twitter::Action::Mention end it "generates a Reply" do - action = Twitter::ActionFactory.new(:action => 'reply') + action = Twitter::ActionFactory.new(:action => "reply") expect(action).to be_a Twitter::Action::Reply end it "generates a Retweet" do - action = Twitter::ActionFactory.new(:action => 'retweet') + action = Twitter::ActionFactory.new(:action => "retweet") expect(action).to be_a Twitter::Action::Retweet end it "raises an ArgumentError when action is not specified" do diff --git a/spec/twitter/api/direct_messages_spec.rb b/spec/twitter/api/direct_messages_spec.rb index 2fd8963da..c4be6dd2a 100644 --- a/spec/twitter/api/direct_messages_spec.rb +++ b/spec/twitter/api/direct_messages_spec.rb @@ -117,7 +117,7 @@ end context "with a URI object passed" do it "requests the correct resource" do - user = URI.parse('https://twitter.com/pengwynn') + user = URI.parse("https://twitter.com/pengwynn") @client.direct_message_create(user, "Creating a fixture for the Twitter gem") expect(a_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"})).to have_been_made end diff --git a/spec/twitter/api/favorites_spec.rb b/spec/twitter/api/favorites_spec.rb index 23c1958fa..d3fb9c9f8 100644 --- a/spec/twitter/api/favorites_spec.rb +++ b/spec/twitter/api/favorites_spec.rb @@ -23,7 +23,7 @@ end context "with a URI object passed" do it "requests the correct resource" do - user = URI.parse('https://twitter.com/sferik') + user = URI.parse("https://twitter.com/sferik") @client.favorites(user) expect(a_get("/1.1/favorites/list.json").with(:query => {:screen_name => "sferik"})).to have_been_made end diff --git a/spec/twitter/api/oauth_spec.rb b/spec/twitter/api/oauth_spec.rb index 1a1ee4082..b5ebfac6e 100644 --- a/spec/twitter/api/oauth_spec.rb +++ b/spec/twitter/api/oauth_spec.rb @@ -3,7 +3,7 @@ describe Twitter::API::OAuth do before do - @client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS') + @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS") end describe "#token" do diff --git a/spec/twitter/base_spec.rb b/spec/twitter/base_spec.rb index a0bb53702..dce65969d 100644 --- a/spec/twitter/base_spec.rb +++ b/spec/twitter/base_spec.rb @@ -10,22 +10,22 @@ expect(@base[:object_id]).to be_an Integer end it "calls methods using [] with string" do - expect(@base['object_id']).to be_an Integer + expect(@base["object_id"]).to be_an Integer end it "returns nil for missing method" do expect(@base[:foo]).to be_nil - expect(@base['foo']).to be_nil + expect(@base["foo"]).to be_nil end end describe "#attrs" do - it 'returns a hash of attributes' do + it "returns a hash of attributes" do expect(@base.attrs).to eq({:id => 1}) end end describe "#delete" do - it 'deletes an attribute and returns its value' do + it "deletes an attribute and returns its value" do base = Twitter::Base.new(:id => 1) expect(base.delete(:id)).to eq(1) expect(base.attrs[:id]).to be_nil @@ -33,7 +33,7 @@ end describe "#update" do - it 'returns a hash of attributes' do + it "returns a hash of attributes" do base = Twitter::Base.new(:id => 1) base.update(:id => 2) expect(base.attrs[:id]).to eq(2) diff --git a/spec/twitter/client_spec.rb b/spec/twitter/client_spec.rb index a34a9a364..ca8fca126 100644 --- a/spec/twitter/client_spec.rb +++ b/spec/twitter/client_spec.rb @@ -32,13 +32,13 @@ before do @configuration = { :connection_options => {:timeout => 10}, - :consumer_key => 'CK', - :consumer_secret => 'CS', - :endpoint => 'http://tumblr.com/', + :consumer_key => "CK", + :consumer_secret => "CS", + :endpoint => "http://tumblr.com/", :middleware => Proc.new{}, - :oauth_token => 'OT', - :oauth_token_secret => 'OS', - :bearer_token => 'BT', + :oauth_token => "OT", + :oauth_token_secret => "OS", + :bearer_token => "BT", } end @@ -99,33 +99,33 @@ describe "#user_token?" do it "returns true if the user token/secret are present" do - client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT', :oauth_token_secret => 'OS') + client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") expect(client.user_token?).to be_true end it "returns false if the user token/secret are not completely present" do - client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT') + client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT") expect(client.user_token?).to be_false end end describe "#bearer_token?" do it "returns true if the app token is present" do - client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :bearer_token => 'BT') + client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :bearer_token => "BT") expect(client.bearer_token?).to be_true end it "returns false if the bearer_token is not present" do - client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS') + client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS") expect(client.bearer_token?).to be_false end end describe "#credentials?" do it "returns true if all credentials are present" do - client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT', :oauth_token_secret => 'OS') + client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS") expect(client.credentials?).to be_true end it "returns false if any credentials are missing" do - client = Twitter::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT') + client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT") expect(client.credentials?).to be_false end end @@ -174,9 +174,9 @@ 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 - secret = {:consumer_key => 'CK', :consumer_secret => 'CS', - :token => 'OT', :token_secret => 'OS', - :nonce => 'b6ebe4c2a11af493f8a2290fe1296965', :timestamp => '1370968658'} + secret = {:consumer_key => "CK", :consumer_secret => "CS", + :token => "OT", :token_secret => "OS", + :nonce => "b6ebe4c2a11af493f8a2290fe1296965", :timestamp => "1370968658"} header = {"Authorization" => /oauth_signature="FbthwmgGq02iQw%2FuXGEWaL6V6eM%3D"/} allow(subject).to receive(:credentials).and_return(secret) @@ -187,9 +187,9 @@ end it "submits the correct auth header when media is present" do # We use static values for nounce and timestamp to get a stable signature - secret = {:consumer_key => 'CK', :consumer_secret => 'CS', - :token => 'OT', :token_secret => 'OS', - :nonce => 'e08201ad0dab4897c99445056feefd95', :timestamp => '1370967652'} + secret = {:consumer_key => "CK", :consumer_secret => "CS", + :token => "OT", :token_secret => "OS", + :nonce => "e08201ad0dab4897c99445056feefd95", :timestamp => "1370967652"} header = {"Authorization" => /oauth_signature="9ziouUPwZT9IWWRbJL8r0BerKYA%3D"/} allow(subject).to receive(:credentials).and_return(secret) diff --git a/spec/twitter/configuration_spec.rb b/spec/twitter/configuration_spec.rb index 16fd5feac..b9647bd31 100644 --- a/spec/twitter/configuration_spec.rb +++ b/spec/twitter/configuration_spec.rb @@ -4,7 +4,7 @@ describe "#photo_sizes" do it "returns a hash of sizes when photo_sizes is set" do - photo_sizes = Twitter::Configuration.new(:photo_sizes => {:small => {:h => 226, :w => 340, :resize => 'fit'}, :large => {:h => 466, :w => 700, :resize => 'fit'}, :medium => {:h => 399, :w => 600, :resize => 'fit'}, :thumb => {:h => 150, :w => 150, :resize => 'crop'}}).photo_sizes + photo_sizes = Twitter::Configuration.new(:photo_sizes => {:small => {:h => 226, :w => 340, :resize => "fit"}, :large => {:h => 466, :w => 700, :resize => "fit"}, :medium => {:h => 399, :w => 600, :resize => "fit"}, :thumb => {:h => 150, :w => 150, :resize => "crop"}}).photo_sizes expect(photo_sizes).to be_a Hash expect(photo_sizes[:small]).to be_a Twitter::Size end diff --git a/spec/twitter/error/client_error_spec.rb b/spec/twitter/error/client_error_spec.rb index 5bd742662..70e06e6ee 100644 --- a/spec/twitter/error/client_error_spec.rb +++ b/spec/twitter/error/client_error_spec.rb @@ -11,10 +11,10 @@ context "when HTTP status is #{status} and body is #{body.inspect}" do before do body_message = '{"' + body + '":"Client Error"}' unless body.nil? - stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => 'sferik'}).to_return(:status => status, :body => body_message) + stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik"}).to_return(:status => status, :body => body_message) end it "raises #{exception.name}" do - expect{@client.user_timeline('sferik')}.to raise_error exception + expect{@client.user_timeline("sferik")}.to raise_error exception end end end diff --git a/spec/twitter/error/server_error_spec.rb b/spec/twitter/error/server_error_spec.rb index 4aee49216..13a8ff0da 100644 --- a/spec/twitter/error/server_error_spec.rb +++ b/spec/twitter/error/server_error_spec.rb @@ -9,10 +9,10 @@ Twitter::Error::ServerError.errors.each do |status, exception| context "when HTTP status is #{status}" do before do - stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => 'sferik'}).to_return(:status => status) + stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik"}).to_return(:status => status) end it "raises #{exception.name}" do - expect{@client.user_timeline('sferik')}.to raise_error exception + expect{@client.user_timeline("sferik")}.to raise_error exception end end end diff --git a/spec/twitter/geo_factory_spec.rb b/spec/twitter/geo_factory_spec.rb index b321749dc..f618a186e 100644 --- a/spec/twitter/geo_factory_spec.rb +++ b/spec/twitter/geo_factory_spec.rb @@ -4,11 +4,11 @@ describe ".new" do it "generates a Point" do - geo = Twitter::GeoFactory.new(:type => 'Point') + geo = Twitter::GeoFactory.new(:type => "Point") expect(geo).to be_a Twitter::Geo::Point end it "generates a Polygon" do - geo = Twitter::GeoFactory.new(:type => 'Polygon') + geo = Twitter::GeoFactory.new(:type => "Polygon") expect(geo).to be_a Twitter::Geo::Polygon end it "raises an ArgumentError when type is not specified" do diff --git a/spec/twitter/media/photo_spec.rb b/spec/twitter/media/photo_spec.rb index 97070d300..6b329c2db 100644 --- a/spec/twitter/media/photo_spec.rb +++ b/spec/twitter/media/photo_spec.rb @@ -22,7 +22,7 @@ describe "#sizes" do it "returns a hash of Sizes when sizes is set" do - sizes = Twitter::Media::Photo.new(:id => 110102452988157952, :sizes => {:small => {:h => 226, :w => 340, :resize => 'fit'}, :large => {:h => 466, :w => 700, :resize => 'fit'}, :medium => {:h => 399, :w => 600, :resize => 'fit'}, :thumb => {:h => 150, :w => 150, :resize => 'crop'}}).sizes + sizes = Twitter::Media::Photo.new(:id => 110102452988157952, :sizes => {:small => {:h => 226, :w => 340, :resize => "fit"}, :large => {:h => 466, :w => 700, :resize => "fit"}, :medium => {:h => 399, :w => 600, :resize => "fit"}, :thumb => {:h => 150, :w => 150, :resize => "crop"}}).sizes expect(sizes).to be_a Hash expect(sizes[:small]).to be_a Twitter::Size end diff --git a/spec/twitter/media_factory_spec.rb b/spec/twitter/media_factory_spec.rb index 832c12daa..fba725b17 100644 --- a/spec/twitter/media_factory_spec.rb +++ b/spec/twitter/media_factory_spec.rb @@ -4,7 +4,7 @@ describe ".new" do it "generates a Photo" do - media = Twitter::MediaFactory.new(:id => 1, :type => 'photo') + media = Twitter::MediaFactory.new(:id => 1, :type => "photo") expect(media).to be_a Twitter::Media::Photo end it "raises an ArgumentError when type is not specified" do diff --git a/spec/twitter/oembed_spec.rb b/spec/twitter/oembed_spec.rb index 15122ecf7..f42e6f27f 100644 --- a/spec/twitter/oembed_spec.rb +++ b/spec/twitter/oembed_spec.rb @@ -4,7 +4,7 @@ describe "#author_url" do it "returns the author's url" do - oembed = Twitter::OEmbed.new(:author_url => 'https://twitter.com/sferik') + oembed = Twitter::OEmbed.new(:author_url => "https://twitter.com/sferik") expect(oembed.author_url).to eq "https://twitter.com/sferik" end @@ -16,7 +16,7 @@ describe "#author_name" do it "returns the author's name" do - oembed = Twitter::OEmbed.new(:author_name => 'Erik Michaels-Ober') + oembed = Twitter::OEmbed.new(:author_name => "Erik Michaels-Ober") expect(oembed.author_name).to eq "Erik Michaels-Ober" end @@ -28,7 +28,7 @@ describe "#cache_age" do it "returns the cache_age" do - oembed = Twitter::OEmbed.new(:cache_age => '31536000000') + oembed = Twitter::OEmbed.new(:cache_age => "31536000000") expect(oembed.cache_age).to eq "31536000000" end @@ -57,7 +57,7 @@ describe "#html" do it "returns the html" do - oembed = Twitter::OEmbed.new(:html => '
all my witty tweet stuff here
') + oembed = Twitter::OEmbed.new(:html => "
all my witty tweet stuff here
") expect(oembed.html).to eq "
all my witty tweet stuff here
" end @@ -69,7 +69,7 @@ describe "#provider_name" do it "returns the provider_name" do - oembed = Twitter::OEmbed.new(:provider_name => 'Twitter') + oembed = Twitter::OEmbed.new(:provider_name => "Twitter") expect(oembed.provider_name).to eq "Twitter" end @@ -81,7 +81,7 @@ describe "#provider_url" do it "returns the provider_url" do - oembed = Twitter::OEmbed.new(:provider_url => 'http://twitter.com') + oembed = Twitter::OEmbed.new(:provider_url => "http://twitter.com") expect(oembed.provider_url).to eq "http://twitter.com" end @@ -93,7 +93,7 @@ describe "#type" do it "returns the type" do - oembed = Twitter::OEmbed.new(:type => 'rich') + oembed = Twitter::OEmbed.new(:type => "rich") expect(oembed.type).to eq "rich" end @@ -122,7 +122,7 @@ describe "#url" do it "returns the url" do - oembed = Twitter::OEmbed.new(:url => 'https://twitter.com/twitterapi/status/133640144317198338') + oembed = Twitter::OEmbed.new(:url => "https://twitter.com/twitterapi/status/133640144317198338") expect(oembed.url).to eq "https://twitter.com/twitterapi/status/133640144317198338" end @@ -134,7 +134,7 @@ describe "#version" do it "returns the version" do - oembed = Twitter::OEmbed.new(:version => '1.0') + oembed = Twitter::OEmbed.new(:version => "1.0") expect(oembed.version).to eq "1.0" end diff --git a/spec/twitter/place_spec.rb b/spec/twitter/place_spec.rb index 4419da4e1..712c43d60 100644 --- a/spec/twitter/place_spec.rb +++ b/spec/twitter/place_spec.rb @@ -22,7 +22,7 @@ describe "#bounding_box" do it "returns a Twitter::Place when set" do - place = Twitter::Place.new(:id => "247f43d441defc03", :bounding_box => {:type => 'Polygon', :coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]]}) + place = Twitter::Place.new(:id => "247f43d441defc03", :bounding_box => {:type => "Polygon", :coordinates => [[[-122.40348192, 37.77752898], [-122.387436, 37.77752898], [-122.387436, 37.79448597], [-122.40348192, 37.79448597]]]}) expect(place.bounding_box).to be_a Twitter::Geo::Polygon end it "returns nil when not set" do @@ -33,12 +33,12 @@ 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' + place = Twitter::Place.new(:id => "247f43d441defc03", :country_code => "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' + place = Twitter::Place.new(:id => "247f43d441defc03", :countryCode => "US") + expect(place.country_code).to eq "US" end it "returns nil when not set" do place = Twitter::Place.new(:id => "247f43d441defc03") @@ -59,12 +59,12 @@ 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' + place = Twitter::Place.new(:id => "247f43d441defc03", :place_type => "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' + place = Twitter::Place.new(:id => "247f43d441defc03", :placeType => {:name => "Town"}) + expect(place.place_type).to eq "Town" end it "returns nil when not set" do place = Twitter::Place.new(:id => "247f43d441defc03") diff --git a/spec/twitter/profile_banner_spec.rb b/spec/twitter/profile_banner_spec.rb index 7a3f8a514..820dd26e4 100644 --- a/spec/twitter/profile_banner_spec.rb +++ b/spec/twitter/profile_banner_spec.rb @@ -4,7 +4,7 @@ describe "#sizes" do it "returns a hash of Sizes when sizes is set" do - sizes = Twitter::ProfileBanner.new(:sizes => {:small => {:h => 226, :w => 340, :resize => 'fit'}, :large => {:h => 466, :w => 700, :resize => 'fit'}, :medium => {:h => 399, :w => 600, :resize => 'fit'}, :thumb => {:h => 150, :w => 150, :resize => 'crop'}}).sizes + sizes = Twitter::ProfileBanner.new(:sizes => {:small => {:h => 226, :w => 340, :resize => "fit"}, :large => {:h => 466, :w => 700, :resize => "fit"}, :medium => {:h => 399, :w => 600, :resize => "fit"}, :thumb => {:h => 150, :w => 150, :resize => "crop"}}).sizes expect(sizes).to be_a Hash expect(sizes[:small]).to be_a Twitter::Size end diff --git a/spec/twitter/rate_limit_spec.rb b/spec/twitter/rate_limit_spec.rb index 7ddaeb4b2..aa03bfa67 100644 --- a/spec/twitter/rate_limit_spec.rb +++ b/spec/twitter/rate_limit_spec.rb @@ -4,7 +4,7 @@ describe "#limit" do it "returns an Integer when x-rate-limit-limit header is set" do - rate_limit = Twitter::RateLimit.new('x-rate-limit-limit' => "150") + 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 end @@ -16,7 +16,7 @@ describe "#remaining" do it "returns an Integer when x-rate-limit-remaining header is set" do - rate_limit = Twitter::RateLimit.new('x-rate-limit-remaining' => "149") + 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 end @@ -28,7 +28,7 @@ describe "#reset_at" do it "returns a Time when x-rate-limit-reset header is set" do - rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => "1339019097") + 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) end @@ -46,7 +46,7 @@ Timecop.return end it "returns an Integer when x-rate-limit-reset header is set" do - rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => "1339019097") + 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 end @@ -64,10 +64,10 @@ Timecop.return end it "updates a rate limit" do - rate_limit = Twitter::RateLimit.new('x-rate-limit-reset' => "1339019097") + 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 - rate_limit.update({'x-rate-limit-reset' => "1339019098"}) + 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 end diff --git a/spec/twitter/search_results_spec.rb b/spec/twitter/search_results_spec.rb index b590e6c3b..e94e8ed52 100644 --- a/spec/twitter/search_results_spec.rb +++ b/spec/twitter/search_results_spec.rb @@ -4,7 +4,7 @@ describe "#statuses" do it "returns an array of Tweets" do - statuses = Twitter::SearchResults.new(:statuses => [{:id => 25938088801, :text => 'tweet!'}]).statuses + statuses = Twitter::SearchResults.new(:statuses => [{:id => 25938088801, :text => "tweet!"}]).statuses expect(statuses).to be_an Array expect(statuses.first).to be_a Twitter::Tweet end diff --git a/spec/twitter/settings_spec.rb b/spec/twitter/settings_spec.rb index 3795c9e71..760be109a 100644 --- a/spec/twitter/settings_spec.rb +++ b/spec/twitter/settings_spec.rb @@ -4,7 +4,7 @@ describe "#trend_location" do it "returns a Twitter::Place when set" do - place = Twitter::Settings.new(:trend_location => {:countryCode => 'US', :name => 'San Francisco', :country => 'United States', :placeType => {:name => 'Town', :code => 7}, :woeid => 2487956, :parentid => 23424977, :url => 'http://where.yahooapis.com/v1/place/2487956'}) + place = Twitter::Settings.new(:trend_location => {:countryCode => "US", :name => "San Francisco", :country => "United States", :placeType => {:name => "Town", :code => 7}, :woeid => 2487956, :parentid => 23424977, :url => "http://where.yahooapis.com/v1/place/2487956"}) expect(place.trend_location).to be_a Twitter::Place end it "returns nil when not set" do diff --git a/spec/twitter/tweet_spec.rb b/spec/twitter/tweet_spec.rb index 26e71218a..c8fcef07d 100644 --- a/spec/twitter/tweet_spec.rb +++ b/spec/twitter/tweet_spec.rb @@ -49,9 +49,9 @@ it "returns true if there are entities set" do urls_array = [ { - :url => 'http://example.com/t.co', - :expanded_url => 'http://example.com/expanded', - :display_url => 'example.com/expanded', + :url => "http://example.com/t.co", + :expanded_url => "http://example.com/expanded", + :display_url => "example.com/expanded", :indices => [10, 33], } ] @@ -62,12 +62,12 @@ describe "#from_user" do it "returns a screen name when from_user is set" do - tweet = Twitter::Tweet.new(:id => 28669546014, :from_user => 'sferik') + tweet = Twitter::Tweet.new(:id => 28669546014, :from_user => "sferik") expect(tweet.from_user).to be_a String expect(tweet.from_user).to eq "sferik" end it "returns a screen name when screen_name is set" do - tweet = Twitter::Tweet.new(:id => 28669546014, :user => {:id => 7505382, :screen_name => 'sferik'}) + tweet = Twitter::Tweet.new(:id => 28669546014, :user => {:id => 7505382, :screen_name => "sferik"}) expect(tweet.from_user).to be_a String expect(tweet.from_user).to eq "sferik" end @@ -79,7 +79,7 @@ describe "#filter_level" do it "returns the filter level when filter_level is set" do - tweet = Twitter::Tweet.new(:id => 28669546014, :filter_level => 'high') + tweet = Twitter::Tweet.new(:id => 28669546014, :filter_level => "high") expect(tweet.filter_level).to be_a String expect(tweet.filter_level).to eq "high" end @@ -91,17 +91,17 @@ describe "#full_text" do it "returns the text of a Tweet" do - tweet = Twitter::Tweet.new(:id => 28669546014, :text => 'BOOSH') + tweet = Twitter::Tweet.new(:id => 28669546014, :text => "BOOSH") expect(tweet.full_text).to be_a String 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'}) + 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" 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'}) + 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" end @@ -113,7 +113,7 @@ describe "#geo" do it "returns a Twitter::Geo::Point when set" do - tweet = Twitter::Tweet.new(:id => 28669546014, :geo => {:id => 1, :type => 'Point'}) + tweet = Twitter::Tweet.new(:id => 28669546014, :geo => {:id => 1, :type => "Point"}) expect(tweet.geo).to be_a Twitter::Geo::Point end it "returns nil when not set" do @@ -126,7 +126,7 @@ it "returns an Array of Entity::Hashtag when entities are set" do hashtags_array = [ { - :text => 'twitter', + :text => "twitter", :indices => [10, 33], } ] @@ -134,7 +134,7 @@ 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.text).to eq "twitter" end it "is empty when not set" do hashtags = Twitter::Tweet.new(:id => 28669546014).hashtags @@ -148,7 +148,7 @@ describe "#media" do it "returns media" do - media = Twitter::Tweet.new(:id => 28669546014, :entities => {:media => [{:id => 1, :type => 'photo'}]}).media + media = Twitter::Tweet.new(:id => 28669546014, :entities => {:media => [{:id => 1, :type => "photo"}]}).media expect(media).to be_an Array expect(media.first).to be_a Twitter::Media::Photo end @@ -197,7 +197,7 @@ describe "#retweet?" do it "returns true when there is a retweeted status" do - tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => 'BOOSH'}) + tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => "BOOSH"}) expect(tweet.retweet?).to be_true end it "returns false when retweeted_status is not set" do @@ -208,9 +208,9 @@ describe "#retweeted_status" do it "has text when retweeted_status is set" do - tweet = Twitter::Tweet.new(:id => 28669546014, :retweeted_status => {:id => 25938088801, :text => 'BOOSH'}) + 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) @@ -221,15 +221,15 @@ describe "#symbols" do it "returns an Array of Entity::Symbol when symbols are set" do symbols_array = [ - { :text => 'PEP', :indices => [114, 118] }, - { :text => 'COKE', :indices => [128, 133] } + { :text => "PEP", :indices => [114, 118] }, + { :text => "COKE", :indices => [128, 133] } ] 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.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.text).to eq "PEP" end it "is empty when not set" do symbols = Twitter::Tweet.new(:id => 28669546014).symbols @@ -245,9 +245,9 @@ it "returns an Array of Entity::Url when entities are set" do urls_array = [ { - :url => 'http://example.com/t.co', - :expanded_url => 'http://example.com/expanded', - :display_url => 'example.com/expanded', + :url => "http://example.com/t.co", + :expanded_url => "http://example.com/expanded", + :display_url => "example.com/expanded", :indices => [10, 33], } ] @@ -255,7 +255,7 @@ expect(urls).to be_an Array expect(urls.first).to be_a Twitter::Entity::Url expect(urls.first.indices).to eq [10, 33] - expect(urls.first.display_url).to eq 'example.com/expanded' + expect(urls.first.display_url).to eq "example.com/expanded" end it "is empty when not set" do urls = Twitter::Tweet.new(:id => 28669546014).urls @@ -277,7 +277,7 @@ expect(user).to be_nil end it "has a status when status is set" do - user = Twitter::Tweet.new(:id => 28669546014, :text => 'Tweet text.', :user => {:id => 7505382}).user + user = Twitter::Tweet.new(:id => 28669546014, :text => "Tweet text.", :user => {:id => 7505382}).user expect(user.status).to be_a Twitter::Tweet end end @@ -297,9 +297,9 @@ it "returns an Array of Entity::UserMention when entities are set" do user_mentions_array = [ { - :screen_name => 'sferik', - :name => 'Erik Michaels-Ober', - :id_str => '7505382', + :screen_name => "sferik", + :name => "Erik Michaels-Ober", + :id_str => "7505382", :indices => [0, 6], :id => 7505382, } diff --git a/spec/twitter/user_spec.rb b/spec/twitter/user_spec.rb index c19ca4982..4c5eefaa9 100644 --- a/spec/twitter/user_spec.rb +++ b/spec/twitter/user_spec.rb @@ -35,9 +35,9 @@ it "returns an Array of Entity::Url" do urls_array = [ { - :url => 'http://example.com/t.co', - :expanded_url => 'http://example.com/expanded', - :display_url => 'example.com/expanded', + :url => "http://example.com/t.co", + :expanded_url => "http://example.com/expanded", + :display_url => "example.com/expanded", :indices => [10, 33], } ] @@ -45,7 +45,7 @@ expect(description_urls).to be_an Array expect(description_urls.first).to be_a Twitter::Entity::Url expect(description_urls.first.indices).to eq [10, 33] - expect(description_urls.first.display_url).to eq 'example.com/expanded' + expect(description_urls.first.display_url).to eq "example.com/expanded" end it "is empty when not set" do description_urls = Twitter::User.new(:id => 7505382, :entities => {:description => {:urls => []}}).description_urls @@ -257,7 +257,7 @@ expect(tweet).to be_nil end it "includes a User when user is set" do - tweet = Twitter::User.new(:id => 7505382, :screen_name => 'sferik', :status => {:id => 25938088801}).status + 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 end