test/twitter/request_test.rb in szimek-twitter-0.6.4 vs test/twitter/request_test.rb in szimek-twitter-0.6.5

- old
+ new

@@ -18,11 +18,11 @@ should "have path" do @request.path.should == '/statuses/user_timeline.json' end should "have options" do - @request.options.should == {:query => {:since_id => 1234}} + @request.options[:query].should == {:since_id => 1234} end should "have uri" do @request.uri.should == '/statuses/user_timeline.json?since_id=1234' end @@ -58,11 +58,11 @@ should "return a single mash" do @object.class.should be(Mash) @object.text.should == 'Rob Dyrdek is the funniest man alive. That is all.' end - end + end context "with no query string" do should "not have any query string" do request = Twitter::Request.new(@client, :get, '/statuses/user_timeline.json') request.uri.should == '/statuses/user_timeline.json' @@ -196,8 +196,22 @@ should "raise Unavailable for 503" do stub_get('http://twitter.com:80/foo', '', ['503']) lambda { Twitter::Request.get(@client, '/foo') }.should raise_error(Twitter::Unavailable) + end + end + + context "Making request with mash option set to false" do + setup do + oauth = Twitter::OAuth.new('token', 'secret') + oauth.authorize_from_access('atoken', 'asecret') + @client = Twitter::Base.new(oauth) + end + + should "not attempt to create mash of return object" do + stub_get('http://twitter.com:80/foo', 'friend_ids.json') + object = Twitter::Request.get(@client, '/foo', :mash => false) + object.class.should_not be(Mash) end end end \ No newline at end of file