* Removed Pixa/Tinami sources

* Upgraded to Rails 3.2.3
* Fixed tests
This commit is contained in:
albert
2012-06-01 19:22:58 -04:00
parent 105cba5963
commit 17881068e1
124 changed files with 1063 additions and 1214 deletions

View File

@@ -1,8 +1,10 @@
Factory.define(:advertisement) do |f|
f.referral_url "http://google.com"
f.ad_type "vertical"
f.status "active"
f.width 728
f.height 90
f.file_name "google.gif"
FactoryGirl.define do
factory(:advertisement) do
referral_url "http://google.com"
ad_type "vertical"
status "active"
width 728
height 90
file_name "google.gif"
end
end

View File

@@ -1,4 +1,7 @@
Factory.define(:artist) do |f|
f.name {rand(1_000_000).to_s}
f.is_active true
FactoryGirl.define do
factory(:artist) do
name {rand(1_000_000).to_s}
is_active true
end
end

View File

@@ -1,4 +1,6 @@
Factory.define(:artist_url) do |f|
f.artist {|x| x.association(:artist)}
f.url {Faker::Internet.domain_name}
end
FactoryGirl.define do
factory(:artist_url) do
artist
url {Faker::Internet.domain_name}
end
end

View File

@@ -1,4 +1,6 @@
Factory.define(:ban) do |f|
f.reason {Faker::Lorem.words.join(" ")}
f.duration 60
end
FactoryGirl.define do
factory(:ban) do |f|
reason {Faker::Lorem.words.join(" ")}
duration 60
end
end

View File

@@ -1,4 +1,6 @@
Factory.define(:comment) do |f|
f.post {|x| x.association(:post)}
f.body {Faker::Lorem.sentences.join(" ")}
end
FactoryGirl.define do
factory(:comment) do |f|
post
body {Faker::Lorem.sentences.join(" ")}
end
end

View File

@@ -1,3 +1,5 @@
Factory.define(:comment_vote) do |f|
f.score 1
end
FactoryGirl.define do
factory(:comment_vote) do
score 1
end
end

View File

@@ -1,5 +1,7 @@
Factory.define(:dmail) do |f|
f.to {|x| x.association(:user)}
f.title {Faker::Lorem.words.join(" ")}
f.body {Faker::Lorem.sentences.join(" ")}
FactoryGirl.define do
factory(:dmail) do
to :factory => :user
title {Faker::Lorem.words.join(" ")}
body {Faker::Lorem.sentences.join(" ")}
end
end

View File

@@ -1,2 +1,3 @@
Factory.define(:favorite) do |f|
FactoryGirl.define do
factory(:favorite)
end

View File

@@ -1,3 +1,5 @@
Factory.define(:forum_post) do |f|
f.body {Faker::Lorem.sentences}
end
FactoryGirl.define do
factory(:forum_post) do
body {Faker::Lorem.sentences.join(" ")}
end
end

View File

@@ -1,5 +1,7 @@
Factory.define(:forum_topic) do |f|
f.title {Faker::Lorem.words}
f.is_sticky false
f.is_locked false
end
FactoryGirl.define do
factory(:forum_topic) do
title {Faker::Lorem.words.join(" ")}
is_sticky false
is_locked false
end
end

View File

@@ -1,5 +1,7 @@
Factory.define(:ip_ban) do |f|
f.creator {|x| x.association(:user)}
f.reason {Faker::Lorem.words.join(" ")}
f.ip_addr "127.0.0.1"
end
FactoryGirl.define do
factory(:ip_ban) do
creator :factory => :user
reason {Faker::Lorem.words.join(" ")}
ip_addr "127.0.0.1"
end
end

View File

@@ -1,3 +1,5 @@
Factory.define(:janitor_trial) do |f|
f.user {|x| x.association(:user)}
FactoryGirl.define do
factory(:janitor_trial) do
user
end
end

View File

@@ -1,4 +1,6 @@
Factory.define(:mod_action) do |f|
f.creator {|x| x.association(:user)}
f.description "1234"
FactoryGirl.define do
factory(:mod_action) do
creator :factory => :user
description "1234"
end
end

View File

@@ -1,3 +1,5 @@
Factory.define(:news_update) do |f|
f.message "xxx"
FactoryGirl.define do
factory(:news_update) do
message "xxx"
end
end

View File

@@ -1,12 +1,14 @@
Factory.define(:note) do |f|
f.creator {|x| x.association(:user)}
f.post {|x| x.association(:post)}
f.x 0
f.y 0
f.width 0
f.height 0
f.is_active true
f.body {Faker::Lorem.sentences.join}
f.updater_id {|x| x.association(:user)}
f.updater_ip_addr "127.0.0.1"
end
FactoryGirl.define do
factory(:note) do
creator :factory => :user
post
x 0
y 0
width 0
height 0
is_active true
body {Faker::Lorem.sentences.join(" ")}
updater_id :factory => :user
updater_ip_addr "127.0.0.1"
end
end

View File

@@ -1,5 +1,7 @@
Factory.define(:pool) do |f|
f.name {(rand(1_000_000) + 100).to_s}
f.creator {|x| x.association(:user)}
f.description {Faker::Lorem.sentences}
FactoryGirl.define do
factory(:pool) do
name {(rand(1_000_000) + 100).to_s}
association :creator, :factory => :user
description {Faker::Lorem.sentences.join(" ")}
end
end

View File

@@ -1,13 +1,15 @@
Factory.define(:post) do |f|
f.md5 {|x| Time.now.to_f.to_s}
f.uploader {|x| x.association(:user)}
f.uploader_ip_addr "127.0.0.1"
f.tag_string "tag1 tag2"
f.tag_count 2
f.tag_count_general 2
f.file_ext "jpg"
f.image_width 100
f.image_height 200
f.file_size 2000
f.rating "q"
end
FactoryGirl.define do
factory(:post) do
md5 {|x| Time.now.to_f.to_s}
uploader :factory => :user
uploader_ip_addr "127.0.0.1"
tag_string "tag1 tag2"
tag_count 2
tag_count_general 2
file_ext "jpg"
image_width 100
image_height 200
file_size 2000
rating "q"
end
end

View File

@@ -1,3 +1,5 @@
Factory.define(:post_appeal) do |f|
f.reason "xxx"
FactoryGirl.define do
factory(:post_appeal) do
reason "xxx"
end
end

View File

@@ -1,4 +1,6 @@
Factory.define(:post_flag) do |f|
f.reason "xxx"
f.is_resolved false
FactoryGirl.define do
factory(:post_flag) do
reason "xxx"
is_resolved false
end
end

View File

@@ -1,19 +1,21 @@
Factory.define(:tag) do |f|
f.name {Faker::Name.first_name.downcase}
f.post_count 0
f.category {Tag.categories.general}
f.related_tags ""
f.related_tags_updated_at {Time.now}
end
FactoryGirl.define do
factory(:tag) do
name {Faker::Name.first_name.downcase}
post_count 0
category {Tag.categories.general}
related_tags ""
related_tags_updated_at {Time.now}
factory(:artist_tag) do
category {Tag.categories.artist}
end
Factory.define(:artist_tag, :parent => :tag) do |f|
f.category {Tag.categories.artist}
end
factory(:copyright_tag) do
category {Tag.categories.copyright}
end
Factory.define(:copyright_tag, :parent => :tag) do |f|
f.category {Tag.categories.copyright}
end
Factory.define(:character_tag, :parent => :tag) do |f|
f.category {Tag.categories.character}
factory(:character_tag) do
category {Tag.categories.character}
end
end
end

View File

@@ -3,7 +3,7 @@ FactoryGirl.define do
antecedent_name "aaa"
consequent_name "bbb"
after_create do |tag_alias|
after(:create) do |tag_alias|
tag_alias.process!
end
end

View File

@@ -3,7 +3,7 @@ FactoryGirl.define do
antecedent_name "aaa"
consequent_name "bbb"
after_create do |tag_implication|
after(:create) do |tag_implication|
tag_implication.process!
end
end

View File

@@ -1,5 +1,7 @@
Factory.define(:tag_subscription) do |f|
f.name {Faker::Lorem.words.join(" ")}
f.is_public true
f.tag_query "aaa"
FactoryGirl.define do
factory(:tag_subscription) do
name {Faker::Lorem.words.join(" ")}
is_public true
tag_query "aaa"
end
end

View File

@@ -1,44 +1,47 @@
require 'fileutils'
Factory.define(:upload) do |f|
f.rating "s"
f.uploader {|x| x.association(:user, :level => 200)}
f.uploader_ip_addr "127.0.0.1"
f.tag_string "special"
f.status "pending"
end
FactoryGirl.define do
factory(:upload) do
rating "s"
uploader :factory => :user, :level => 20
uploader_ip_addr "127.0.0.1"
tag_string "special"
status "pending"
factory(:source_upload) do
source "http://www.google.com/intl/en_ALL/images/logo.gif"
end
Factory.define(:source_upload, :parent => :upload) do |f|
f.source "http://www.google.com/intl/en_ALL/images/logo.gif"
end
factory(:jpg_upload) do
content_type "image/jpeg"
file_path do
FileUtils.cp("#{Rails.root}/test/files/test.jpg", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test.jpg"
end
end
Factory.define(:jpg_upload, :parent => :upload) do |f|
f.content_type "image/jpeg"
f.file_path do
FileUtils.cp("#{Rails.root}/test/files/test.jpg", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test.jpg"
factory(:large_jpg_upload) do
file_ext "jpg"
content_type "image/jpeg"
file_path do
FileUtils.cp("#{Rails.root}/test/files/test-large.jpg", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test-large.jpg"
end
end
factory(:png_upload) do
file_path do
FileUtils.cp("#{Rails.root}/test/files/test.png", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test.png"
end
end
factory(:gif_upload) do
file_path do
FileUtils.cp("#{Rails.root}/test/files/test.gif", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test.gif"
end
end
end
end
Factory.define(:large_jpg_upload, :parent => :upload) do |f|
f.file_ext "jpg"
f.content_type "image/jpeg"
f.file_path do
FileUtils.cp("#{Rails.root}/test/files/test-large.jpg", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test-large.jpg"
end
end
Factory.define(:png_upload, :parent => :upload) do |f|
f.file_path do
FileUtils.cp("#{Rails.root}/test/files/test.png", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test.png"
end
end
Factory.define(:gif_upload, :parent => :upload) do |f|
f.file_path do
FileUtils.cp("#{Rails.root}/test/files/test.gif", "#{Rails.root}/tmp")
"#{Rails.root}/tmp/test.gif"
end
end

View File

@@ -1,35 +1,38 @@
Factory.define(:user) do |f|
f.name {rand(1_000_000).to_s}
f.password "password"
f.password_hash {User.sha1("password")}
f.email {Faker::Internet.email}
f.default_image_size "large"
f.base_upload_limit 10
f.level 20
f.last_logged_in_at {Time.now}
FactoryGirl.define do
factory(:user) do
name {rand(1_000_000).to_s}
password "password"
password_hash {User.sha1("password")}
email {Faker::Internet.email}
default_image_size "large"
base_upload_limit 10
level 20
last_logged_in_at {Time.now}
factory(:banned_user) do
is_banned true
ban {|x| x.association(:ban)}
end
factory(:privileged_user) do
level 30
end
factory(:contributor_user) do
level 33
end
factory(:janitor_user) do
level 35
end
factory(:moderator_user) do
level 40
end
factory(:admin_user) do
level 50
end
end
end
Factory.define(:banned_user, :parent => :user) do |f|
f.is_banned true
f.ban {|x| x.association(:ban)}
end
Factory.define(:privileged_user, :parent => :user) do |f|
f.level 30
end
Factory.define(:contributor_user, :parent => :user) do |f|
f.level 33
end
Factory.define(:janitor_user, :parent => :user) do |f|
f.level 35
end
Factory.define(:moderator_user, :parent => :user) do |f|
f.level 40
end
Factory.define(:admin_user, :parent => :user) do |f|
f.level 50
end

View File

@@ -1,5 +1,7 @@
Factory.define(:user_feedback) do |f|
f.user {|x| x.association(:user)}
f.category "positive"
f.body {Faker::Lorem.words.join(" ")}
FactoryGirl.define do
factory(:user_feedback) do
user
category "positive"
body {Faker::Lorem.words.join(" ")}
end
end

View File

@@ -1,2 +1,3 @@
Factory.define(:user_password_reset_nonce) do |f|
FactoryGirl.define do
factory(:user_password_reset_nonce)
end

View File

@@ -1,5 +1,7 @@
Factory.define(:wiki_page) do |f|
f.creator {|x| x.association(:user)}
f.title {|x| Faker::Lorem.words.join(" ")}
f.body {Faker::Lorem.sentences.join(" ")}
FactoryGirl.define do
factory(:wiki_page) do
creator :factory => :user
title {Faker::Lorem.words.join(" ")}
body {Faker::Lorem.sentences.join(" ")}
end
end