Permalink
Browse files

Add #with method in specs to all POST stubs

Closes #113.
  • Loading branch information...
1 parent 36b303a commit 6605525fe69a39946b9f5515986734bbf4d0731d @sferik committed Nov 5, 2010
View
6 spec/twitter/client/account_spec.rb
@@ -71,12 +71,14 @@
before do
stub_post("account/update_delivery_device.#{format}").
+ with(:body => {:device => "sms"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.update_delivery_device("sms")
a_post("account/update_delivery_device.#{format}").
+ with(:body => {:device => "sms"}).
should have_been_made
end
@@ -91,12 +93,14 @@
before do
stub_post("account/update_profile_colors.#{format}").
+ with(:body => {:profile_background_color => "000000"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.update_profile_colors(:profile_background_color => "000000")
a_post("account/update_profile_colors.#{format}").
+ with(:body => {:profile_background_color => "000000"}).
should have_been_made
end
@@ -151,12 +155,14 @@
before do
stub_post("account/update_profile.#{format}").
+ with(:body => {:url => "http://github.com/sferik/"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.update_profile(:url => "http://github.com/sferik/")
a_post("account/update_profile.#{format}").
+ with(:body => {:url => "http://github.com/sferik/"}).
should have_been_made
end
View
1 spec/twitter/client/block_spec.rb
@@ -11,6 +11,7 @@
before do
stub_post("blocks/create.#{format}").
+ with(:body => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
View
2 spec/twitter/client/direct_messages_spec.rb
@@ -53,12 +53,14 @@
before do
stub_post("direct_messages/new.#{format}").
+ with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
to_return(:body => fixture("direct_message.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem")
a_post("direct_messages/new.#{format}").
+ with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}).
should have_been_made
end
View
2 spec/twitter/client/geo_spec.rb
@@ -99,12 +99,14 @@
before do
stub_post("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 "should get the correct resource" do
@client.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581")
a_post("geo/place.json").
+ with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}).
should have_been_made
end
View
4 spec/twitter/client/list_members_spec.rb
@@ -34,12 +34,14 @@
before do
stub_post("sferik/presidents/members.#{format}").
+ with(:body => {:id => "813286"}).
to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.list_add_member("sferik", "presidents", 813286)
a_post("sferik/presidents/members.#{format}").
+ with(:body => {:id => "813286"}).
should have_been_made
end
@@ -54,12 +56,14 @@
before do
stub_post("sferik/presidents/create_all.#{format}").
+ with(:body => {:user_id => "813286,18755393"}).
to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.list_add_members("sferik", "presidents", [813286, 18755393])
a_post("sferik/presidents/create_all.#{format}").
+ with(:body => {:user_id => "813286,18755393"}).
should have_been_made
end
View
2 spec/twitter/client/list_spec.rb
@@ -11,12 +11,14 @@
before do
stub_post("sferik/lists.#{format}").
+ with(:body => {:name => "presidents"}).
to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.list_create("sferik", "presidents")
a_post("sferik/lists.#{format}").
+ with(:body => {:name => "presidents"}).
should have_been_made
end
View
4 spec/twitter/client/notification_spec.rb
@@ -11,12 +11,14 @@
before do
stub_post("notifications/follow.#{format}").
+ with(:body => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.enable_notifications("sferik")
a_post("notifications/follow.#{format}").
+ with(:body => {:screen_name => "sferik"}).
should have_been_made
end
@@ -31,12 +33,14 @@
before do
stub_post("notifications/leave.#{format}").
+ with(:body => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.disable_notifications("sferik")
a_post("notifications/leave.#{format}").
+ with(:body => {:screen_name => "sferik"}).
should have_been_made
end
View
4 spec/twitter/client/saved_searches_spec.rb
@@ -52,17 +52,19 @@
before do
stub_post("saved_searches/create.#{format}").
+ with(:body => {:query => "twitter"}).
to_return(:body => fixture("saved_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.saved_search_create("twitter")
a_post("saved_searches/create.#{format}").
+ with(:body => {:query => "twitter"}).
should have_been_made
end
it "should return the created saved search" do
- saved_search = @client.saved_search_create(16129012)
+ saved_search = @client.saved_search_create("twitter")
saved_search.name.should == "twitter"
end
View
2 spec/twitter/client/spam_reporting_spec.rb
@@ -11,12 +11,14 @@
before do
stub_post("report_spam.#{format}").
+ with(:body => {:screen_name => "sferik"}).
to_return(:body => fixture("user.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.report_spam("sferik")
a_post("report_spam.#{format}").
+ with(:body => {:screen_name => "sferik"}).
should have_been_made
end
View
2 spec/twitter/client/tweets_spec.rb
@@ -31,12 +31,14 @@
before do
stub_post("statuses/update.#{format}").
+ with(:body => {:status => "@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!"}).
to_return(:body => fixture("status.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
@client.update("@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!")
a_post("statuses/update.#{format}").
+ with(:body => {:status => "@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!"}).
should have_been_made
end

0 comments on commit 6605525

Please sign in to comment.