From abbaf7f7ecb2009b38171f072ba0b4ad3ea0c0d8 Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 16 Sep 2011 15:39:08 -0400 Subject: [PATCH] more randomized seed data --- db/seeds.rb | 6 +++++- script/testing/reset_db.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 764d6118d..4b0a1a18c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -24,7 +24,11 @@ CurrentUser.ip_addr = "127.0.0.1" if Upload.count == 0 puts "Creating uploads" 1.upto(100) do |i| - url = "http://dummyimage.com/#{i * 10}x400/000/fff" + color1 = rand(4096).to_s(16) + color2 = rand(4096).to_s(16) + width = rand(2000) + 100 + height = rand(2000) + 100 + url = "http://dummyimage.com/#{width}x#{height}/#{color1}/#{color2}" tags = (i * i * i).to_s.scan(/./).uniq.join(" ") Upload.create(:source => url, :content_type => "image/gif", :rating => "q", :tag_string => tags) diff --git a/script/testing/reset_db.sh b/script/testing/reset_db.sh index 11b69ce9d..72963a035 100755 --- a/script/testing/reset_db.sh +++ b/script/testing/reset_db.sh @@ -3,4 +3,4 @@ rake db:drop db:create createlang plpgsql danbooru2 rake db:migrate - +rake db:seed