Skip to content

Commit

Permalink
Remove token stub
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Aug 18, 2013
1 parent d3d39b9 commit 1df9a20
Show file tree
Hide file tree
Showing 35 changed files with 270 additions and 269 deletions.
4 changes: 0 additions & 4 deletions spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions spec/twitter/api/direct_messages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

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

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

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

Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions spec/twitter/api/favorites_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
38 changes: 19 additions & 19 deletions spec/twitter/api/friends_and_followers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

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

Expand All @@ -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
Expand Down Expand Up @@ -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
12 changes: 6 additions & 6 deletions spec/twitter/api/geo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

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

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

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

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

Expand Down
10 changes: 5 additions & 5 deletions spec/twitter/api/help_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

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

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

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

Expand Down
Loading

0 comments on commit 1df9a20

Please sign in to comment.