Comments controller spec using fixtures

This commit is contained in:
Raphael 2011-01-18 10:48:06 -08:00
parent b580b7bd2c
commit ac3d037dc4
29 changed files with 354 additions and 13 deletions

View file

@ -35,7 +35,6 @@ describe CommentsController do
context "on a post from a contact" do
before do
connect_users(@user1, @aspect1, @user2, @aspect2)
@post = @user2.post :status_message, :message => 'GIANTS', :to => @aspect2.id
end
it 'comments' do
@ -57,7 +56,7 @@ describe CommentsController do
end
context 'on a post from a stranger' do
before do
@post = @user2.post :status_message, :message => 'GIANTS', :to => @aspect2.id
@post = eve.post :status_message, :message => 'GIANTS', :to => eve.aspects.first.id
end
it 'posts no comment' do
@user1.should_not_receive(:comment)

25
spec/fixtures/aspect_memberships.yml vendored Normal file
View file

@ -0,0 +1,25 @@
---
aspect_memberships_002:
created_at: 2011-01-18 18:44:07 Z
aspect_id: 1
updated_at: 2011-01-18 18:44:07 Z
contact_id: 2
id: 2
aspect_memberships_003:
created_at: 2011-01-18 18:44:07 Z
aspect_id: 2
updated_at: 2011-01-18 18:44:07 Z
contact_id: 3
id: 3
aspect_memberships_004:
created_at: 2011-01-18 18:44:07 Z
aspect_id: 3
updated_at: 2011-01-18 18:44:07 Z
contact_id: 4
id: 4
aspect_memberships_001:
created_at: 2011-01-18 18:44:07 Z
aspect_id: 2
updated_at: 2011-01-18 18:44:07 Z
contact_id: 1
id: 1

25
spec/fixtures/aspects.yml vendored Normal file
View file

@ -0,0 +1,25 @@
---
generic_1:
name: generic
mongo_id:
created_at: 2011-01-18 18:44:06 Z
updated_at: 2011-01-18 18:44:07 Z
id: 2
user_mongo_id:
user_id: 4
generic_2:
name: generic
mongo_id:
created_at: 2011-01-18 18:44:07 Z
updated_at: 2011-01-18 18:44:07 Z
id: 3
user_mongo_id:
user_id: 5
generic:
name: generic
mongo_id:
created_at: 2011-01-18 18:44:06 Z
updated_at: 2011-01-18 18:44:06 Z
id: 1
user_mongo_id:
user_id: 3

2
spec/fixtures/comments.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

33
spec/fixtures/contacts.yml vendored Normal file
View file

@ -0,0 +1,33 @@
---
contacts_003:
pending: false
mongo_id:
created_at: 2011-01-18 18:44:07 Z
updated_at: 2011-01-18 18:44:07 Z
id: 3
user_id: 4
person_id: 5
contacts_004:
pending: false
mongo_id:
created_at: 2011-01-18 18:44:07 Z
updated_at: 2011-01-18 18:44:07 Z
id: 4
user_id: 5
person_id: 4
contacts_001:
pending: false
mongo_id:
created_at: 2011-01-18 18:44:07 Z
updated_at: 2011-01-18 18:44:07 Z
id: 1
user_id: 4
person_id: 3
contacts_002:
pending: false
mongo_id:
created_at: 2011-01-18 18:44:07 Z
updated_at: 2011-01-18 18:44:07 Z
id: 2
user_id: 3
person_id: 4

2
spec/fixtures/invitations.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_aspects.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_comments.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_contacts.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_invitations.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_notifications.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_people.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_posts.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_profiles.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_requests.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_services.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/mongo_users.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/notifications.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

49
spec/fixtures/people.yml vendored Normal file
View file

@ -0,0 +1,49 @@
---
people_001:
mongo_id:
created_at: 2011-01-18 18:44:06 Z
guid: 89e32c010f204d98
updated_at: 2011-01-18 18:44:06 Z
url: http://google-1d915c9.com/
serialized_public_key: |
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAPEQ08ZWNCiEh/fV/aQ19fMGdeK2r0ns+MB8kcbrkduTqvQ/c/RFkhJX
KWti8QomQVudx30mKMuD+r8XY48xw3H3XQDK2rtpFQmgJ4f/Wj4E6yFJo5pC7OL9
253WWqLGAJOJy9IxF76Mlo9Qazm7Z7aj1zp5kUXYusge2XAfkb0fAgMBAAE=
-----END RSA PUBLIC KEY-----
owner_id: 3
id: 3
diaspora_handle: alice@example.org
people_002:
mongo_id:
created_at: 2011-01-18 18:44:07 Z
guid: 5d3d9ce10a10eafe
updated_at: 2011-01-18 18:44:07 Z
url: http://google-245c017.com/
serialized_public_key: |
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAPEQ08ZWNCiEh/fV/aQ19fMGdeK2r0ns+MB8kcbrkduTqvQ/c/RFkhJX
KWti8QomQVudx30mKMuD+r8XY48xw3H3XQDK2rtpFQmgJ4f/Wj4E6yFJo5pC7OL9
253WWqLGAJOJy9IxF76Mlo9Qazm7Z7aj1zp5kUXYusge2XAfkb0fAgMBAAE=
-----END RSA PUBLIC KEY-----
owner_id: 4
id: 4
diaspora_handle: bob@example.org
people_003:
mongo_id:
created_at: 2011-01-18 18:44:07 Z
guid: 742a7d253debf2d6
updated_at: 2011-01-18 18:44:07 Z
url: http://google-330296d.com/
serialized_public_key: |
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAPEQ08ZWNCiEh/fV/aQ19fMGdeK2r0ns+MB8kcbrkduTqvQ/c/RFkhJX
KWti8QomQVudx30mKMuD+r8XY48xw3H3XQDK2rtpFQmgJ4f/Wj4E6yFJo5pC7OL9
253WWqLGAJOJy9IxF76Mlo9Qazm7Z7aj1zp5kUXYusge2XAfkb0fAgMBAAE=
-----END RSA PUBLIC KEY-----
owner_id: 5
id: 5
diaspora_handle: eve@example.org

2
spec/fixtures/post_visibilities.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/posts.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

49
spec/fixtures/profiles.yml vendored Normal file
View file

@ -0,0 +1,49 @@
---
profiles_001:
image_url_medium:
mongo_id:
created_at: 2011-01-18 18:44:06 Z
searchable: true
image_url:
updated_at: 2011-01-18 18:44:06 Z
id: 3
gender:
diaspora_handle:
person_id: 3
last_name: Grimm1a80b30
birthday:
image_url_small:
bio:
first_name: Robert19c3152
profiles_002:
image_url_medium:
mongo_id:
created_at: 2011-01-18 18:44:06 Z
searchable: true
image_url:
updated_at: 2011-01-18 18:44:07 Z
id: 4
gender:
diaspora_handle:
person_id: 4
last_name: Grimm295050b
birthday:
image_url_small:
bio:
first_name: Robert2909f07
profiles_003:
image_url_medium:
mongo_id:
created_at: 2011-01-18 18:44:07 Z
searchable: true
image_url:
updated_at: 2011-01-18 18:44:07 Z
id: 5
gender:
diaspora_handle:
person_id: 5
last_name: Grimm3c16b10
birthday:
image_url_small:
bio:
first_name: Robert3574823

2
spec/fixtures/requests.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

2
spec/fixtures/services.yml vendored Normal file
View file

@ -0,0 +1,2 @@
--- {}

121
spec/fixtures/users.yml vendored Normal file
View file

@ -0,0 +1,121 @@
---
alice:
encrypted_password: $2a$10$10wn.2788it4RyLvmIqap.zJfK8kAoM7IVsD6l0vPyzxQY7aH4m4m
serialized_private_key: |
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDxENPGVjQohIf31f2kNfXzBnXitq9J7PjAfJHG65Hbk6r0P3P0
RZISVylrYvEKJkFbncd9JijLg/q/F2OPMcNx910Aytq7aRUJoCeH/1o+BOshSaOa
Quzi/dud1lqixgCTicvSMRe+jJaPUGs5u2e2o9c6eZFF2LrIHtlwH5G9HwIDAQAB
AoGAIk7BxPVZwPZzn1ruGSOw2CBwQI69TakTEdnoqUW3YWeXqeEp8HbCPif3dhgD
s+0T2iUPUglPPv+OfQmoGqX7aYMTJOIrFPxYkBKkbfW8ZoNy/GHibblLJscJ54iF
iJcGL6bBGga36QSA+aw29N7+qtMQdebsBHsj6qZpFxS+N3ECQQD6/t4eX8BdHKoB
IfWpZV1JETyZAE+sGiUUF3QgyE3C7v5o99xtEZ6jvRMcwURf/3Dw3FeATSAgVC0Q
LReupEHZAkEA9d9GkOyioKoAEmVfjc08va0otSv9OR81MYWfXRuCliMMQC3wHdU4
kr912zY2FDHLZtxy12YImDG/hpHYbpYjtwJBALvoIxJKTRFobD381pXDNVuGc/93
pC4MRMYN6PrB+rV9hym+pl9hWYrr+msEpdPYwQ0RaNC87NhHLJV3rMsqXcECQFC8
UF+mVICNUhi4UPgvPJLMGWHkX/Ix3TW1uu7H6cmDGLK6Yu5o5XrKg9jHpFpdP303
Rj6Usp3HOCzoFzm482ECQQCYJ01wP0IsjFruXqhlclYxk/1cKuRt5NmhkNflJSWl
BrEFy9v3tTGVI6AAR1S7cYWFEyOj0OICMOqGHU72GIIv
-----END RSA PRIVATE KEY-----
mongo_id:
created_at: 2011-01-18 18:44:06 Z
updated_at: 2011-01-18 18:44:06 Z
last_sign_in_ip:
invites: 0
username: alice
last_sign_in_at:
language: en
sign_in_count: 0
id: 3
disable_mail: false
password_salt: $2a$10$10wn.2788it4RyLvmIqap.
reset_password_token:
remember_token:
current_sign_in_ip:
remember_created_at:
current_sign_in_at:
invitation_sent_at:
invitation_token:
getting_started: true
email: bob1f866f6@pivotallabs.com
eve:
encrypted_password: $2a$10$uDyK3VOraaekpPhbr8dPjuGqdshJlt9vSRUWvh9R1obnqqMgp60ry
serialized_private_key: |
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDxENPGVjQohIf31f2kNfXzBnXitq9J7PjAfJHG65Hbk6r0P3P0
RZISVylrYvEKJkFbncd9JijLg/q/F2OPMcNx910Aytq7aRUJoCeH/1o+BOshSaOa
Quzi/dud1lqixgCTicvSMRe+jJaPUGs5u2e2o9c6eZFF2LrIHtlwH5G9HwIDAQAB
AoGAIk7BxPVZwPZzn1ruGSOw2CBwQI69TakTEdnoqUW3YWeXqeEp8HbCPif3dhgD
s+0T2iUPUglPPv+OfQmoGqX7aYMTJOIrFPxYkBKkbfW8ZoNy/GHibblLJscJ54iF
iJcGL6bBGga36QSA+aw29N7+qtMQdebsBHsj6qZpFxS+N3ECQQD6/t4eX8BdHKoB
IfWpZV1JETyZAE+sGiUUF3QgyE3C7v5o99xtEZ6jvRMcwURf/3Dw3FeATSAgVC0Q
LReupEHZAkEA9d9GkOyioKoAEmVfjc08va0otSv9OR81MYWfXRuCliMMQC3wHdU4
kr912zY2FDHLZtxy12YImDG/hpHYbpYjtwJBALvoIxJKTRFobD381pXDNVuGc/93
pC4MRMYN6PrB+rV9hym+pl9hWYrr+msEpdPYwQ0RaNC87NhHLJV3rMsqXcECQFC8
UF+mVICNUhi4UPgvPJLMGWHkX/Ix3TW1uu7H6cmDGLK6Yu5o5XrKg9jHpFpdP303
Rj6Usp3HOCzoFzm482ECQQCYJ01wP0IsjFruXqhlclYxk/1cKuRt5NmhkNflJSWl
BrEFy9v3tTGVI6AAR1S7cYWFEyOj0OICMOqGHU72GIIv
-----END RSA PRIVATE KEY-----
mongo_id:
created_at: 2011-01-18 18:44:07 Z
updated_at: 2011-01-18 18:44:07 Z
last_sign_in_ip:
invites: 0
username: eve
last_sign_in_at:
language: en
sign_in_count: 0
id: 5
disable_mail: false
password_salt: $2a$10$uDyK3VOraaekpPhbr8dPju
reset_password_token:
remember_token:
current_sign_in_ip:
remember_created_at:
current_sign_in_at:
invitation_sent_at:
invitation_token:
getting_started: true
email: bob3884c35@pivotallabs.com
bob:
encrypted_password: $2a$10$YXDxHoVUIaIgyS405RS3NeenGVRrexiZei0.7l.LbyLDf.YqtCvfS
serialized_private_key: |
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDxENPGVjQohIf31f2kNfXzBnXitq9J7PjAfJHG65Hbk6r0P3P0
RZISVylrYvEKJkFbncd9JijLg/q/F2OPMcNx910Aytq7aRUJoCeH/1o+BOshSaOa
Quzi/dud1lqixgCTicvSMRe+jJaPUGs5u2e2o9c6eZFF2LrIHtlwH5G9HwIDAQAB
AoGAIk7BxPVZwPZzn1ruGSOw2CBwQI69TakTEdnoqUW3YWeXqeEp8HbCPif3dhgD
s+0T2iUPUglPPv+OfQmoGqX7aYMTJOIrFPxYkBKkbfW8ZoNy/GHibblLJscJ54iF
iJcGL6bBGga36QSA+aw29N7+qtMQdebsBHsj6qZpFxS+N3ECQQD6/t4eX8BdHKoB
IfWpZV1JETyZAE+sGiUUF3QgyE3C7v5o99xtEZ6jvRMcwURf/3Dw3FeATSAgVC0Q
LReupEHZAkEA9d9GkOyioKoAEmVfjc08va0otSv9OR81MYWfXRuCliMMQC3wHdU4
kr912zY2FDHLZtxy12YImDG/hpHYbpYjtwJBALvoIxJKTRFobD381pXDNVuGc/93
pC4MRMYN6PrB+rV9hym+pl9hWYrr+msEpdPYwQ0RaNC87NhHLJV3rMsqXcECQFC8
UF+mVICNUhi4UPgvPJLMGWHkX/Ix3TW1uu7H6cmDGLK6Yu5o5XrKg9jHpFpdP303
Rj6Usp3HOCzoFzm482ECQQCYJ01wP0IsjFruXqhlclYxk/1cKuRt5NmhkNflJSWl
BrEFy9v3tTGVI6AAR1S7cYWFEyOj0OICMOqGHU72GIIv
-----END RSA PRIVATE KEY-----
mongo_id:
created_at: 2011-01-18 18:44:07 Z
updated_at: 2011-01-18 18:44:07 Z
last_sign_in_ip:
invites: 0
username: bob
last_sign_in_at:
language: en
sign_in_count: 0
id: 4
disable_mail: false
password_salt: $2a$10$YXDxHoVUIaIgyS405RS3Ne
reset_password_token:
remember_token:
current_sign_in_ip:
remember_created_at:
current_sign_in_at:
invitation_sent_at:
invitation_token:
getting_started: true
email: bob25202ed@pivotallabs.com

View file

@ -35,6 +35,17 @@ RSpec.configure do |config|
end
end
def alice
User.where(:username => 'alice').first
end
def bob
User.where(:username => 'bob').first
end
def eve
User.where(:username => 'eve').first
end
module Diaspora::WebSocket
def self.redis
FakeRedis.new

View file

@ -14,14 +14,3 @@ FixtureBuilder.configure do |fbuilder|
end
end
def alice
User.where(:username => 'alice').first
end
def bob
User.where(:username => 'bob').first
end
def eve
User.where(:username => 'eve').first
end