Welcome to mirror list, hosted at ThFree Co, Russian Federation.

requests_controller_spec.rb « controllers « spec - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d75b93f05035f325f99458b8fb1bd520d1a82b3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

require 'spec_helper'

describe RequestsController do
  render_views
  before do
    @user = Factory.create(:user)

    sign_in :user, @user
    @user.aspect(:name => "lame-os")
  end

  it "should not error out when requesting to be friends with yourself" do
    put("create", "request" => {
      "destination_url" => @user.diaspora_handle,
      "aspect_id" => @user.aspects[0].id 
      } 
    )
    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
    put("create", "request" => {
      "destination_url" => "johndoe@email.com:3000",
      "aspect_id" => @user.aspects[0].id 
      } 
    )
    response.should redirect_to aspects_manage_path
  end

  it "should not error out when requesting an identity from an invalid server" do
    stub_request(:get, /notadiasporaserver\.com/).to_raise(Errno::ETIMEDOUT)
    put("create", "request" => {
      "destination_url" => "johndoe@notadiasporaserver.com",
      "aspect_id" => @user.aspects[0].id 
      } 
    )
    response.should redirect_to aspects_manage_path
  end

  it 'should redirect to the page which you called it from ' do
    pending "i need to figure out how to do this"
  end

  it 'should not blow up if there is a problem mid way thru the webfinger process' do
    pending "i need to do this tomorrow"
  end
end