From 98b41d8f1d2b1e5bedf64317a61cf8d97bbb7be0 Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Fri, 30 Mar 2012 09:27:31 -0700 Subject: [PATCH] update seeds.rb to reflect asset pipeline, and a lil bit of refactoring --- db/seeds.rb | 29 +++++++++++++++-------------- spec/factories.rb | 6 +++--- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index af8ab7f9e..c6e1527ea 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -19,21 +19,23 @@ alice = Factory(:user_with_aspect, :username => "alice", :password => 'evankorth bob = Factory(:user_with_aspect, :username => "bob", :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... " -alice.person.profile.update_attributes(:first_name => "Alice", :last_name => "Smith", - :image_url => "/images/user/uma.jpg", - :image_url_small => "/images/user/uma.jpg", - :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") +alice.person.profile.update_attributes({:first_name => "Alice", :last_name => "Smith"}.merge(url_hash('uma'))) +bob.person.profile.update_attributes({:first_name => "Bob", :last_name => "Grimm"}.merge(url_hash('wolf'))) +eve.person.profile.update_attributes({:first_name => "Eve", :last_name => "Doe"}.merge(url_hash('angela'))) puts "done!" + print "Connecting users... " connect_users(bob, bob.aspects.first, alice, alice.aspects.first) connect_users(bob, bob.aspects.first, eve, eve.aspects.first) @@ -79,5 +81,4 @@ end puts " done!" puts "Successfully seeded the db with users eve, bob, and alice (password: 'evankorth')" -puts "" - +puts "" \ No newline at end of file diff --git a/spec/factories.rb b/spec/factories.rb index bde89c3c0..dcb35458d 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -149,7 +149,7 @@ FactoryGirl.define do sequence(:uid) { |id| "a#{id}"} sequence(:name) { |num| "Rob Fergus the #{num.ordinalize}" } association :service - photo_url "/images/user/adams.jpg" + photo_url "/assets/user/adams.jpg" end factory(:comment) do @@ -170,7 +170,7 @@ FactoryGirl.define do factory(:activity_streams_photo, :class => ActivityStreams::Photo) do association(:author, :factory => :person) - image_url "#{AppConfig[:pod_url]}/images/asterisk.png" + image_url "#{AppConfig[:pod_url]}/assets/asterisk.png" image_height 154 image_width 154 object_url "http://example.com/awesome_things.gif" @@ -185,7 +185,7 @@ FactoryGirl.define do sequence(:application_base_url) { |token| "http://chubbi#{token}.es/" } 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!" sequence(:public_key) {|n| OpenSSL::PKey::RSA.new(2048) } end