Newer
Older
maxwell
a validé
require File.dirname(__FILE__) + '/../spec_helper'
describe DashboardsController do
maxwell
a validé
@user = Factory.create(:user, :profile => Profile.create( :first_name => "bob", :last_name => "smith"))
request.env['warden'] = mock_model(Warden, :authenticate? => @user, :authenticate! => @user, :authenticate => @user)
it "on index sets a variable containing all a user's friends when a user is signed in" do
sign_in :user, @user
danielvincent
a validé
Factory.create :person
assigns[:friends].should == Person.friends.all
maxwell
a validé
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
describe 'PubSubHubBuB intergration' do
describe 'incoming subscriptions' do
it 'should register a friend' do
Subscriber.all.count.should == 0
post :hub, {:callback => "http://example.com/",
:mode => 'subscribe',
:topic => '/status_messages',
:verify => 'async'}
response.status.should == 202
Subscriber.all.count.should == 1
end
it 'should keep track of what topic a subscriber wants' do
post :hub, {:callback => "http://example.com/",
:mode => 'subscribe',
:topic => '/status_messages',
:verify => 'async'}
Subscriber.first.topic.should == '/status_messages'
end
end
it 'should return a 204 for a sync request' do
post :hub, {:callback => "http://example.com/",
:mode => 'subscribe',
:topic => '/status_messages',
:verify => 'sync'}
response.status.should == 204
end
it 'should confirm subscription of a sync request' do
post :hub, {:callback => "http://example.com/",
:mode => 'subscribe',
:topic => '/status_messages',
:verify => 'sync'}
end
end