Skip to content

Commit

Permalink
Revert "Update specs to pass on webmock 1.10.0"
Browse files Browse the repository at this point in the history
This reverts commit 89bbc04.
  • Loading branch information
sferik committed Mar 2, 2013
1 parent 89bbc04 commit 0ff9f48
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ group :test do
gem 'rspec', '>= 2.11'
gem 'simplecov', :require => false
gem 'timecop'
gem 'webmock', '>= 1.10'
gem 'webmock'
end

gemspec
4 changes: 2 additions & 2 deletions spec/twitter/api/direct_messages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@

describe "#direct_message_create" do
before do
stub_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating+a+fixture+for+the+Twitter+gem"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.direct_message_create("pengwynn", "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
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
it "returns the sent message" do
direct_message = @client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem")
Expand Down
8 changes: 4 additions & 4 deletions spec/twitter/api/geo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@

describe "#similar_places" do
before do
stub_get("/1.1/geo/similar_places.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter+HQ"}).to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_get("/1.1/geo/similar_places.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"}).to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.similar_places(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ")
expect(a_get("/1.1/geo/similar_places.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter+HQ"})).to have_been_made
expect(a_get("/1.1/geo/similar_places.json").with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"})).to have_been_made
end
it "returns similar places" do
places = @client.similar_places(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ")
Expand All @@ -67,11 +67,11 @@

describe "#place_create" do
before do
stub_post("/1.1/geo/place.json").with(:body => {:name => "@sferik's+Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}).to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/geo/place.json").with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}).to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581")
expect(a_post("/1.1/geo/place.json").with(:body => {:name => "@sferik's+Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"})).to have_been_made
expect(a_post("/1.1/geo/place.json").with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"})).to have_been_made
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")
Expand Down
16 changes: 8 additions & 8 deletions spec/twitter/api/lists_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -593,11 +593,11 @@
describe "#list_update" do
context "with a screen name passed" do
before do
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents+of+the+United+States+of+America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.list_update("sferik", "presidents", :description => "Presidents of the United States of America")
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents+of+the+United+States+of+America"})).to have_been_made
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"})).to have_been_made
end
it "returns the updated list" do
list = @client.list_update("sferik", "presidents", :description => "Presidents of the United States of America")
Expand All @@ -608,30 +608,30 @@
context "without a screen name passed" do
before do
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents+of+the+United+States+of+America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.list_update("presidents", :description => "Presidents of the United States of America")
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents+of+the+United+States+of+America"})).to have_been_made
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"})).to have_been_made
end
end
context "with a list ID passed" do
before do
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678", :description => "Presidents+of+the+United+States+of+America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.list_update("sferik", 12345678, :description => "Presidents of the United States of America")
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678", :description => "Presidents+of+the+United+States+of+America"})).to have_been_made
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678", :description => "Presidents of the United States of America"})).to have_been_made
end
end
context "with a list object passed" do
before do
stub_post("/1.1/lists/update.json").with(:body => {:owner_id => "7505382", :list_id => "12345678", :description => "Presidents+of+the+United+States+of+America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/lists/update.json").with(:body => {:owner_id => "7505382", :list_id => "12345678", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
list = Twitter::List.new(:id => "12345678", :user => {:id => 7505382, :screen_name => "sferik"})
@client.list_update(list, :description => "Presidents of the United States of America")
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_id => "7505382", :list_id => "12345678", :description => "Presidents+of+the+United+States+of+America"})).to have_been_made
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_id => "7505382", :list_id => "12345678", :description => "Presidents of the United States of America"})).to have_been_made
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/api/tweets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@

describe "#tweet" do
before do
stub_post("/1.1/statuses/update.json").with(:body => {:status => "The+problem+with+your+code+is+that+it's+doing+exactly+what+you+told+it+to+do."}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_post("/1.1/statuses/update.json").with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.update("The problem with your code is that it's doing exactly what you told it to do.")
expect(a_post("/1.1/statuses/update.json").with(:body => {:status => "The+problem+with+your+code+is+that+it's+doing+exactly+what+you+told+it+to+do."})).to have_been_made
expect(a_post("/1.1/statuses/update.json").with(:body => {:status => "The problem with your code is that it's doing exactly what you told it to do."})).to have_been_made
end
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.")
Expand Down
4 changes: 2 additions & 2 deletions spec/twitter/api/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@

describe "#user_search" do
before do
stub_get("/1.1/users/search.json").with(:query => {:q => "Erik+Michaels-Ober"}).to_return(:body => fixture("user_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_get("/1.1/users/search.json").with(:query => {:q => "Erik Michaels-Ober"}).to_return(:body => fixture("user_search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
it "requests the correct resource" do
@client.user_search("Erik Michaels-Ober")
expect(a_get("/1.1/users/search.json").with(:query => {:q => "Erik+Michaels-Ober"})).to have_been_made
expect(a_get("/1.1/users/search.json").with(:query => {:q => "Erik Michaels-Ober"})).to have_been_made
end
it "returns an array of user search results" do
user_search = @client.user_search("Erik Michaels-Ober")
Expand Down

0 comments on commit 0ff9f48

Please sign in to comment.