Skip to content
Extraits de code Groupes Projets
Valider ccd92fb8 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

make requests controller spec a little clearer

parent 1951df8d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -13,48 +13,54 @@ describe RequestsController do ...@@ -13,48 +13,54 @@ describe RequestsController do
@user.aspects.create(:name => "lame-os") @user.aspects.create(:name => "lame-os")
end end
it "should not error out when requesting to be friends with yourself" do describe '#create' do
put("create", "request" => { it "redirects when requesting to be friends with yourself" do
"destination_url" => @user.diaspora_handle, put("create", "request" => {
"aspect_id" => @user.aspects[0].id "destination_url" => @user.diaspora_handle,
} "aspect_id" => @user.aspects[0].id
) }
response.should redirect_to aspects_manage_path )
end response.should redirect_to aspects_manage_path
end
it "should not error out when requesting an invalid identity" do
put("create", "request" => {
"destination_url" => "not_a_@valid_email",
"aspect_id" => @user.aspects[0].id
}
)
response.should redirect_to aspects_manage_path
end
it "should not error out when requesting an invalid identity with a port number" do it "flashes and redirects when requesting an invalid identity" do
put("create", "request" => { put("create", "request" => {
"destination_url" => "johndoe@email.com:3000", "destination_url" => "not_a_@valid_email",
"aspect_id" => @user.aspects[0].id "aspect_id" => @user.aspects[0].id
} }
) )
response.should redirect_to aspects_manage_path flash[:error].should_not be_blank
end response.should redirect_to aspects_manage_path
end
it "should not error out when requesting an identity from an invalid server" do it "flashes and redirects when requesting an invalid identity with a port number" do
stub_request(:get, /notadiasporaserver\.com/).to_raise(Errno::ETIMEDOUT) put("create", "request" => {
put("create", "request" => { "destination_url" => "johndoe@email.com:3000",
"destination_url" => "johndoe@notadiasporaserver.com", "aspect_id" => @user.aspects[0].id
"aspect_id" => @user.aspects[0].id }
} )
) flash[:error].should_not be_blank
response.should redirect_to aspects_manage_path response.should redirect_to aspects_manage_path
end end
it 'should redirect to the page which you called it from ' do it "redirects when requesting an identity from an invalid server" do
pending "i need to figure out how to do this" stub_request(:get, /notadiasporaserver\.com/).to_raise(Errno::ETIMEDOUT)
end put("create", "request" => {
"destination_url" => "johndoe@notadiasporaserver.com",
"aspect_id" => @user.aspects[0].id
}
)
response.should redirect_to aspects_manage_path
end
it 'should not blow up if there is a problem mid way thru the webfinger process' do it 'should redirect to the page which you called it from ' do
pending "i need to do this tomorrow" pending "This controller should probably redirect to :back"
put("create", "request" => {
"destination_url" => "johndoe@notadiasporaserver.com",
"aspect_id" => @user.aspects[0].id
}
)
response.should redirect_to(:back)
end
end end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter