test/facebook/test_api.rb in rest-more-3.2.0 vs test/facebook/test_api.rb in rest-more-3.3.0

- old
+ new

@@ -4,17 +4,17 @@ describe RC::Facebook do after do WebMock.reset! end - should 'generate correct url' do + would 'generate correct url' do RC::Facebook.new(:access_token => 'awesome'). url('path', :query => 'str').should.eq \ 'https://graph.facebook.com/path?access_token=awesome&query=str' end - should 'request to correct server' do + would 'request to correct server' do stub_request(:get, 'http://nothing.godfat.org/me').with( :headers => {'Accept' => 'text/plain', 'Accept-Language' => 'zh-tw', 'Accept-Encoding' => /^gzip, ?deflate$/, # this is by ruby 'User-Agent' => 'Ruby' # this is by ruby @@ -24,11 +24,11 @@ :lang => 'zh-tw', :accept => 'text/plain'). get('me').should.eq({'data' => []}) end - should 'pass custom headers' do + would 'pass custom headers' do stub_request(:get, 'http://example.com/').with( :headers => {'Accept' => 'application/json', 'Accept-Language' => 'en-us', 'Accept-Encoding' => /^gzip, ?deflate$/, # this is by ruby 'User-Agent' => 'Ruby', # this is by ruby @@ -38,19 +38,19 @@ RC::Facebook.new.get('http://example.com', {}, {:headers => {'X-Forwarded-For' => '127.0.0.1'}} ). should.eq({'data' => []}) end - should 'post right' do + would 'post right' do stub_request(:post, 'https://graph.facebook.com/feed/me'). with(:body => 'message=hi%20there').to_return(:body => 'ok') RC::Facebook.new(:json_response => false). post('feed/me', :message => 'hi there').should == 'ok' end - should 'use secret_access_token' do + would 'use secret_access_token' do stub_request(:get, 'https://graph.facebook.com/me?access_token=1|2'). to_return(:body => 'ok') rg = RC::Facebook.new( @@ -61,28 +61,28 @@ 'https://graph.facebook.com/me?access_token=1%7C2' rg.url('me', {}, :secret => true, :site => '/').should.eq \ '/me?access_token=1%7C2' end - should 'suppress auto-decode in an api call' do + would 'suppress auto-decode in an api call' do stub_request(:get, 'https://graph.facebook.com/woot'). to_return(:body => 'bad json') rg = RC::Facebook.new(:json_response => true) rg.get('woot', {}, :json_response => false).should.eq 'bad json' rg.json_response.should == true end - should 'not raise exception when encountering error' do + would 'not raise exception when encountering error' do [500, 401, 402, 403].each{ |status| stub_request(:delete, 'https://graph.facebook.com/123').to_return( :body => '[]', :status => status) RC::Facebook.new.delete('123').should.eq [] } end - should 'convert query to string' do + would 'convert query to string' do o = Object.new def o.to_s; 'i am mock'; end stub_request(:get, "https://graph.facebook.com/search?q=i%20am%20mock"). to_return(:body => 'ok') RC::Facebook.new(:json_response => false).