spec/evri/rpx/session_spec.rb in dbalatero-evri_rpx-1.0.1 vs spec/evri/rpx/session_spec.rb in dbalatero-evri_rpx-1.0.2
- old
+ new
@@ -15,53 +15,53 @@
after(:each) do
FakeWeb.clean_registry
end
it "should raise an APICallError if RPX returns an error message" do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/auth_info',
:body => fixture_path('session/normal_error.json'),
:status => ['400', 'Bad Request'])
lambda {
@session.auth_info('errortoken')
}.should raise_error(Evri::RPX::Session::APICallError)
end
it "should raise ServiceUnavailableError if the service is not available" do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/auth_info',
:body => fixture_path('session/service_down_error.json'),
:status => ['404', 'Not Found'])
lambda {
@session.auth_info('errortoken')
}.should raise_error(Evri::RPX::Session::ServiceUnavailableError)
end
it "should return a User object for a mapping" do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/auth_info',
:body => fixture_path('user/dbalatero_gmail.json'))
result = @session.auth_info('mytoken')
result.should be_a_kind_of(Evri::RPX::User)
end
end
describe "all_mappings" do
it "should return a set of identifiers to mappings" do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/all_mappings',
:body => fixture_path('session/all_mappings.json'))
result = @session.all_mappings
result['1'].should == ['http://cygnus.myopenid.com/']
result['2'].should == ['http://brianellin.com/', 'http://brian.myopenid.com/']
end
end
describe "get_contacts" do
before(:each) do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/get_contacts',
:body => fixture_path('session/get_contacts.json'))
end
after(:each) do
@@ -86,11 +86,11 @@
end
end
describe "map" do
before(:each) do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/map',
:body => fixture_path('session/map.json'))
end
it "should take in a User object as the second parameter" do
@@ -107,21 +107,21 @@
end
end
describe "mappings" do
it "should return a Mappings object" do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/mappings',
:body => fixture_path('mappings/identifiers.json'))
result = @session.mappings('dbalatero')
result.should be_a_kind_of(Evri::RPX::Mappings)
result.identifiers.should_not be_empty
end
it "should take a User object in" do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/mappings',
:body => fixture_path('mappings/identifiers.json'))
user = mock('user')
user.should_receive(:primary_key).and_return('dbalatero')
@@ -131,11 +131,11 @@
end
end
describe "set_status" do
it "should call set_status, and return true" do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com/api/v2/set_status',
:body => fixture_path('session/set_status.json'))
user = mock('user')
user.should_receive(:identifier).and_return('https://www.facebook.com/dbalatero')
@@ -144,10 +144,10 @@
end
end
describe "unmap" do
before(:each) do
- FakeWeb.register_uri(:get,
+ FakeWeb.register_uri(:post,
'https://rpxnow.com:443/api/v2/unmap',
:body => fixture_path('session/unmap.json'))
end
it "should take a string as the identifier" do