fixed the seed script
This commit is contained in:
parent
94a7a3c6ad
commit
02c0bf3c43
4 changed files with 19 additions and 12 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue