update seeds.rb to reflect asset pipeline, and a lil bit of refactoring

This commit is contained in:
Maxwell Salzberg 2012-03-30 09:27:31 -07:00
parent 8e0998ab88
commit 98b41d8f1d
2 changed files with 18 additions and 17 deletions

View file

@ -19,21 +19,23 @@ alice = Factory(:user_with_aspect, :username => "alice", :password => 'evankorth
bob = Factory(:user_with_aspect, :username => "bob", :password => 'evankorth') bob = Factory(:user_with_aspect, :username => "bob", :password => 'evankorth')
eve = Factory(:user_with_aspect, :username => "eve", :password => 'evankorth') eve = Factory(:user_with_aspect, :username => "eve", :password => 'evankorth')
def url_hash(name)
image_url = "/assets/user/#{name}jpg"
{
:image_url => image_url,
:image_url_small => image_url,
:image_url_medium => image_url
}
end
print "Creating seeded users... " print "Creating seeded users... "
alice.person.profile.update_attributes(:first_name => "Alice", :last_name => "Smith", alice.person.profile.update_attributes({:first_name => "Alice", :last_name => "Smith"}.merge(url_hash('uma')))
:image_url => "/images/user/uma.jpg", bob.person.profile.update_attributes({:first_name => "Bob", :last_name => "Grimm"}.merge(url_hash('wolf')))
:image_url_small => "/images/user/uma.jpg", eve.person.profile.update_attributes({:first_name => "Eve", :last_name => "Doe"}.merge(url_hash('angela')))
:image_url_medium => "/images/user/uma.jpg")
bob.person.profile.update_attributes(:first_name => "Bob", :last_name => "Grimm",
:image_url => "/images/user/wolf.jpg",
:image_url_small => "/images/user/wolf.jpg",
:image_url_medium => "/images/user/wolf.jpg")
eve.person.profile.update_attributes(:first_name => "Eve", :last_name => "Doe",
:image_url => "/images/user/angela.jpg",
:image_url_small => "/images/user/angela.jpg",
:image_url_medium => "/images/user/angela.jpg")
puts "done!" puts "done!"
print "Connecting users... " print "Connecting users... "
connect_users(bob, bob.aspects.first, alice, alice.aspects.first) connect_users(bob, bob.aspects.first, alice, alice.aspects.first)
connect_users(bob, bob.aspects.first, eve, eve.aspects.first) connect_users(bob, bob.aspects.first, eve, eve.aspects.first)
@ -79,5 +81,4 @@ end
puts " done!" puts " done!"
puts "Successfully seeded the db with users eve, bob, and alice (password: 'evankorth')" puts "Successfully seeded the db with users eve, bob, and alice (password: 'evankorth')"
puts "" puts ""

View file

@ -149,7 +149,7 @@ FactoryGirl.define do
sequence(:uid) { |id| "a#{id}"} sequence(:uid) { |id| "a#{id}"}
sequence(:name) { |num| "Rob Fergus the #{num.ordinalize}" } sequence(:name) { |num| "Rob Fergus the #{num.ordinalize}" }
association :service association :service
photo_url "/images/user/adams.jpg" photo_url "/assets/user/adams.jpg"
end end
factory(:comment) do factory(:comment) do
@ -170,7 +170,7 @@ FactoryGirl.define do
factory(:activity_streams_photo, :class => ActivityStreams::Photo) do factory(:activity_streams_photo, :class => ActivityStreams::Photo) do
association(:author, :factory => :person) association(:author, :factory => :person)
image_url "#{AppConfig[:pod_url]}/images/asterisk.png" image_url "#{AppConfig[:pod_url]}/assets/asterisk.png"
image_height 154 image_height 154
image_width 154 image_width 154
object_url "http://example.com/awesome_things.gif" object_url "http://example.com/awesome_things.gif"
@ -185,7 +185,7 @@ FactoryGirl.define do
sequence(:application_base_url) { |token| "http://chubbi#{token}.es/" } sequence(:application_base_url) { |token| "http://chubbi#{token}.es/" }
description "The best way to chub on the ne" description "The best way to chub on the ne"
icon_url "/images/chubbies48.png" icon_url "/assets/chubbies48.png"
permissions_overview "I will use the permissions this way!" permissions_overview "I will use the permissions this way!"
sequence(:public_key) {|n| OpenSSL::PKey::RSA.new(2048) } sequence(:public_key) {|n| OpenSSL::PKey::RSA.new(2048) }
end end