Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diaspora
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milan
diaspora
Commits
02c0bf3c
Commit
02c0bf3c
authored
14 years ago
by
ilya
Browse files
Options
Downloads
Patches
Plain Diff
fixed the seed script
parent
94a7a3c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
db/seeds/backer.rb
+2
-9
2 additions, 9 deletions
db/seeds/backer.rb
db/seeds/dev.rb
+5
-2
5 additions, 2 deletions
db/seeds/dev.rb
db/seeds/tom.rb
+3
-1
3 additions, 1 deletion
db/seeds/tom.rb
spec/models/user/user_friending_spec.rb
+9
-0
9 additions, 0 deletions
spec/models/user/user_friending_spec.rb
with
19 additions
and
12 deletions
db/seeds/backer.rb
+
2
−
9
View file @
02c0bf3c
...
...
@@ -2,14 +2,6 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => citie
require
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
".."
,
"config"
,
"environment"
)
def
create
...
...
@@ -32,7 +24,8 @@ def create
:person
=>
Person
.
new
(
:profile
=>
Profile
.
new
(
:first_name
=>
backer_info
[
backer_number
][
'given_name'
],
:last_name
=>
backer_info
[
backer_number
][
'family_name'
],
:image_url
=>
"http://
#{
username
}
.joindiaspora.com/images/user/
#{
username
}
.jpg"
)
)).
save
))
user
.
save
user
.
person
.
save!
user
.
aspect
(
:name
=>
"Presidents"
)
...
...
This diff is collapsed.
Click to expand it.
db/seeds/dev.rb
+
5
−
2
View file @
02c0bf3c
...
...
@@ -24,7 +24,8 @@ user = User.build( :email => "tom@tom.joindiaspora.com",
:password_confirmation
=>
"evankorth"
,
:person
=>
Person
.
new
(
:profile
=>
Profile
.
new
(
:first_name
=>
"Alexander"
,
:last_name
=>
"Hamiltom"
))
).
save
)
user
.
save
user
.
person
.
save!
user
.
seed_aspects
...
...
@@ -33,8 +34,10 @@ user2 = User.build( :email => "korth@tom.joindiaspora.com",
:password
=>
"evankorth"
,
:password_confirmation
=>
"evankorth"
,
:person
=>
Person
.
new
(
:profile
=>
Profile
.
new
(
:first_name
=>
"Evan"
,
:last_name
=>
"Korth"
)))
.
save
:profile
=>
Profile
.
new
(
:first_name
=>
"Evan"
,
:last_name
=>
"Korth"
)))
user2
.
save
user2
.
person
.
save!
user2
.
seed_aspects
...
...
This diff is collapsed.
Click to expand it.
db/seeds/tom.rb
+
3
−
1
View file @
02c0bf3c
...
...
@@ -25,7 +25,8 @@ user = User.build( :email => "tom@tom.joindiaspora.com",
:person
=>
{
:profile
=>
{
:first_name
=>
"Alexander"
,
:last_name
=>
"Hamiltom"
,
:image_url
=>
"http://tom.joindiaspora.com/images/user/tom.jpg"
}}
).
save!
)
user
.
save!
user
.
seed_aspects
user
.
person
.
save!
...
...
@@ -35,6 +36,7 @@ user2 = User.build( :email => "korth@tom.joindiaspora.com",
:username
=>
"korth"
,
:person
=>
{
:profile
=>
{
:first_name
=>
"Evan"
,
:last_name
=>
"Korth"
,
:image_url
=>
"http://tom.joindiaspora.com/images/user/korth.jpg"
}})
user2
.
save!
user2
.
seed_aspects
user2
.
person
.
save!
...
...
This diff is collapsed.
Click to expand it.
spec/models/user/user_friending_spec.rb
+
9
−
0
View file @
02c0bf3c
...
...
@@ -7,6 +7,7 @@ require 'spec_helper'
describe
User
do
let
(
:user
)
{
Factory
.
create
:user
}
let
(
:aspect
)
{
user
.
aspect
(
:name
=>
'heroes'
)}
let
(
:aspect1
)
{
user
.
aspect
(
:name
=>
'other'
)}
let
(
:friend
)
{
Factory
.
create
(
:person
)
}
let
(
:person_one
)
{
Factory
.
create
:person
}
...
...
@@ -174,6 +175,14 @@ describe User do
aspect
.
reload
.
people
.
count
.
should
==
0
end
it
'should remove the friend from all aspects they are in'
do
user
.
add_person_to_aspect
(
user2
.
person
.
id
,
aspect1
.
id
)
lambda
{
user
.
unfriended_by
user2
.
person
}.
should
change
{
user
.
friends
.
count
}.
by
(
-
1
)
aspect
.
reload
.
people
.
count
.
should
==
0
aspect1
.
reload
.
people
.
count
.
should
==
0
end
context
'with a post'
do
before
do
@message
=
user
.
post
(
:status_message
,
:message
=>
"hi"
,
:to
=>
aspect
.
id
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment