test/client/facebook/test_error.rb in rest-more-0.7.1 vs test/client/facebook/test_error.rb in rest-more-0.7.2
- old
+ new
@@ -1,64 +1,64 @@
require 'rest-more/test'
-describe RestCore::Facebook::Error do
+describe RC::Facebook::Error do
after do
WebMock.reset!
RR.verify
end
should 'have the right ancestors' do
- RestCore::Facebook::Error::AccessToken.should.lt RestCore::Facebook::Error
+ RC::Facebook::Error::AccessToken.should.lt RC::Facebook::Error
- RestCore::Facebook::Error::InvalidAccessToken.should.lt \
- RestCore::Facebook::Error::AccessToken
+ RC::Facebook::Error::InvalidAccessToken.should.lt \
+ RC::Facebook::Error::AccessToken
- RestCore::Facebook::Error::MissingAccessToken.should.lt \
- RestCore::Facebook::Error::AccessToken
+ RC::Facebook::Error::MissingAccessToken.should.lt \
+ RC::Facebook::Error::AccessToken
end
def error2env hash
- {RestCore::RESPONSE_BODY => hash,
- RestCore::REQUEST_PATH => '/' ,
- RestCore::REQUEST_QUERY => {}}
+ {RC::RESPONSE_BODY => hash,
+ RC::REQUEST_PATH => '/' ,
+ RC::REQUEST_QUERY => {}}
end
should 'parse right' do
%w[OAuthInvalidTokenException OAuthException].each{ |type|
- RestCore::Facebook::Error.call(error2env('error' => {'type' => type})).
- should.kind_of?(RestCore::Facebook::Error::InvalidAccessToken)
+ RC::Facebook::Error.call(error2env('error' => {'type' => type})).
+ should.kind_of?(RC::Facebook::Error::InvalidAccessToken)
}
- RestCore::Facebook::Error.call(
+ RC::Facebook::Error.call(
error2env('error'=>{'type' =>'QueryParseException',
'message'=>'An active access token..'})).
- should.kind_of?(RestCore::Facebook::Error::MissingAccessToken)
+ should.kind_of?(RC::Facebook::Error::MissingAccessToken)
- RestCore::Facebook::Error.call(
+ RC::Facebook::Error.call(
error2env('error'=>{'type' =>'QueryParseException',
'message'=>'Oh active access token..'})).
- should.not.kind_of?(RestCore::Facebook::Error::MissingAccessToken)
+ should.not.kind_of?(RC::Facebook::Error::MissingAccessToken)
- RestCore::Facebook::Error.call(error2env('error_code' => 190)).
- should.kind_of?(RestCore::Facebook::Error::InvalidAccessToken)
+ RC::Facebook::Error.call(error2env('error_code' => 190)).
+ should.kind_of?(RC::Facebook::Error::InvalidAccessToken)
- RestCore::Facebook::Error.call(error2env('error_code' => 104)).
- should.kind_of?(RestCore::Facebook::Error::MissingAccessToken)
+ RC::Facebook::Error.call(error2env('error_code' => 104)).
+ should.kind_of?(RC::Facebook::Error::MissingAccessToken)
- RestCore::Facebook::Error.call(error2env('error_code' => 999)).
- should.not.kind_of?(RestCore::Facebook::Error::AccessToken)
+ RC::Facebook::Error.call(error2env('error_code' => 999)).
+ should.not.kind_of?(RC::Facebook::Error::AccessToken)
- error = RestCore::Facebook::Error.call(error2env(['not a hash']))
- error.should.not.kind_of?(RestCore::Facebook::Error::AccessToken)
- error.should .kind_of?(RestCore::Facebook::Error)
+ error = RC::Facebook::Error.call(error2env(['not a hash']))
+ error.should.not.kind_of?(RC::Facebook::Error::AccessToken)
+ error.should .kind_of?(RC::Facebook::Error)
end
should 'nuke cache upon errors' do
stub_request(:get, 'https://graph.facebook.com/me').
to_return(:body => '{"error":"wrong"}').times(2)
- rg = RestCore::Facebook.new(:cache => {},
+ rg = RC::Facebook.new(:cache => {},
:error_handler => lambda{|env|env})
rg.get('me'); rg.get('me')
rg.cache.values.should.eq []
end
end