Skip to content

Commit

Permalink
Use double-quotes consistently throughout specs
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Jul 20, 2013
1 parent c207567 commit 7e68c6b
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 100 deletions.
12 changes: 6 additions & 6 deletions spec/twitter/action_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/api/direct_messages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/api/favorites_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/api/oauth_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions spec/twitter/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
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
end
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)
Expand Down
36 changes: 18 additions & 18 deletions spec/twitter/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/error/client_error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/error/server_error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/geo_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/media/photo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/media_factory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions spec/twitter/oembed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -57,7 +57,7 @@

describe "#html" do
it "returns the html" do
oembed = Twitter::OEmbed.new(:html => '<blockquote>all my <b>witty tweet</b> stuff here</blockquote>')
oembed = Twitter::OEmbed.new(:html => "<blockquote>all my <b>witty tweet</b> stuff here</blockquote>")
expect(oembed.html).to eq "<blockquote>all my <b>witty tweet</b> stuff here</blockquote>"
end

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
18 changes: 9 additions & 9 deletions spec/twitter/place_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion spec/twitter/profile_banner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 7e68c6b

Please sign in to comment.