* 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

@@ -3,8 +3,8 @@ require 'test_helper'
class AdvertisementHitsControllerTest < ActionController::TestCase
context "An advertisement hits controller" do
setup do
@ad = Factory.create(:advertisement)
@advertiser = Factory.create(:admin_user)
@ad = FactoryGirl.create(:advertisement)
@advertiser = FactoryGirl.create(:admin_user)
end
should "create a new hit" do

View File

@@ -3,8 +3,8 @@ require 'test_helper'
class AdvertisementsControllerTest < ActionController::TestCase
context "An advertisement controller" do
setup do
@ad = Factory.create(:advertisement)
@advertiser = Factory.create(:admin_user)
@ad = FactoryGirl.create(:advertisement)
@advertiser = FactoryGirl.create(:admin_user)
end
should "get the new page" do
@@ -29,7 +29,7 @@ class AdvertisementsControllerTest < ActionController::TestCase
should "create an ad" do
assert_difference("Advertisement.count", 1) do
post :create, {:advertisement => Factory.attributes_for(:advertisement)}, {:user_id => @advertiser.id}
post :create, {:advertisement => FactoryGirl.attributes_for(:advertisement)}, {:user_id => @advertiser.id}
end
ad = Advertisement.last
assert_redirected_to(advertisement_path(ad))
@@ -50,7 +50,7 @@ class AdvertisementsControllerTest < ActionController::TestCase
end
should "block non-advertisers" do
regular_user = Factory.create(:user)
regular_user = FactoryGirl.create(:user)
get :index, {}, {:user_id => regular_user.id}
assert_redirected_to("/static/access_denied")
end

View File

@@ -3,9 +3,9 @@ require 'test_helper'
class ArtistVersionsControllerTest < ActionController::TestCase
context "An artist versions controller" do
setup do
CurrentUser.user = Factory.create(:user)
CurrentUser.user = FactoryGirl.create(:user)
CurrentUser.ip_addr = "127.0.0.1"
@artist = Factory.create(:artist)
@artist = FactoryGirl.create(:artist)
end
teardown do

View File

@@ -3,10 +3,10 @@ require 'test_helper'
class ArtistsControllerTest < ActionController::TestCase
context "An artists controller" do
setup do
CurrentUser.user = Factory.create(:user)
CurrentUser.user = FactoryGirl.create(:user)
CurrentUser.ip_addr = "127.0.0.1"
@artist = Factory.create(:artist)
@user = Factory.create(:user)
@artist = FactoryGirl.create(:artist)
@user = FactoryGirl.create(:user)
end
teardown do
@@ -42,7 +42,7 @@ class ArtistsControllerTest < ActionController::TestCase
should "create an artist" do
assert_difference("Artist.count", 1) do
post :create, {:artist => Factory.attributes_for(:artist)}, {:user_id => @user.id}
post :create, {:artist => FactoryGirl.attributes_for(:artist)}, {:user_id => @user.id}
end
artist = Artist.last
assert_redirected_to(artist_path(artist))

View File

@@ -3,11 +3,11 @@ require 'test_helper'
class BansControllerTest < ActionController::TestCase
context "A bans controller" do
setup do
@mod = Factory.create(:moderator_user)
@mod = FactoryGirl.create(:moderator_user)
CurrentUser.user = @mod
CurrentUser.ip_addr = "127.0.0.1"
@user = Factory.create(:user)
@ban = Factory.create(:ban, :user_id => @user.id)
@user = FactoryGirl.create(:user)
@ban = FactoryGirl.create(:ban, :user_id => @user.id)
end
teardown do

View File

@@ -3,10 +3,10 @@ require 'test_helper'
class CommentVotesControllerTest < ActionController::TestCase
context "A comment votes controller" do
setup do
CurrentUser.user = @user = Factory.create(:user)
CurrentUser.user = @user = FactoryGirl.create(:user)
CurrentUser.ip_addr = "127.0.0.1"
Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now)
@comment = Factory.create(:comment)
@comment = FactoryGirl.create(:comment)
end
teardown do
@@ -22,7 +22,7 @@ class CommentVotesControllerTest < ActionController::TestCase
end
should "fail silently on errors" do
Factory.create(:comment_vote, :comment => @comment)
FactoryGirl.create(:comment_vote, :comment => @comment)
assert_difference("CommentVote.count", 0) do
post :create, {:format => "js", :comment_id => @comment.id, :score => 1}, {:user_id => @user.id}
assert_response :success

View File

@@ -3,12 +3,12 @@ require 'test_helper'
class CommentsControllerTest < ActionController::TestCase
context "A comments controller" do
setup do
CurrentUser.user = Factory.create(:user)
CurrentUser.user = FactoryGirl.create(:user)
CurrentUser.ip_addr = "127.0.0.1"
Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now)
@post = Factory.create(:post)
@comment = Factory.create(:comment, :post => @post)
@user = Factory.create(:moderator_user)
@post = FactoryGirl.create(:post)
@comment = FactoryGirl.create(:comment, :post => @post)
@user = FactoryGirl.create(:moderator_user)
end
teardown do
@@ -38,7 +38,7 @@ class CommentsControllerTest < ActionController::TestCase
context "create action"do
should "create a comment" do
assert_difference("Comment.count", 1) do
post :create, {:comment => Factory.attributes_for(:comment, :post_id => @post.id)}, {:user_id => @user.id}
post :create, {:comment => FactoryGirl.attributes_for(:comment, :post_id => @post.id)}, {:user_id => @user.id}
end
comment = Comment.last
assert_redirected_to post_path(comment.post)

View File

@@ -3,11 +3,11 @@ require 'test_helper'
class DmailsControllerTest < ActionController::TestCase
context "The dmails controller" do
setup do
@user = Factory.create(:user)
@unrelated_user = Factory.create(:user)
@user = FactoryGirl.create(:user)
@unrelated_user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@dmail = Factory.create(:dmail, :owner => @user)
@dmail = FactoryGirl.create(:dmail, :owner => @user)
end
teardown do
@@ -73,7 +73,7 @@ class DmailsControllerTest < ActionController::TestCase
context "create action" do
setup do
@user_2 = Factory.create(:user)
@user_2 = FactoryGirl.create(:user)
end
should "create two messages, one for the sender and one for the recipient" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class FavoritesControllerTest < ActionController::TestCase
context "The favorites controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,7 +15,7 @@ class FavoritesControllerTest < ActionController::TestCase
context "index action" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
@post.add_favorite!(@user)
end
@@ -35,7 +35,7 @@ class FavoritesControllerTest < ActionController::TestCase
context "create action" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
should "create a favorite for the current user" do
@@ -47,7 +47,7 @@ class FavoritesControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
@post.add_favorite!(@user)
end

View File

@@ -3,13 +3,13 @@ require 'test_helper'
class ForumPostsControllerTest < ActionController::TestCase
context "The forum posts controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@other_user = Factory.create(:user)
@mod = Factory.create(:moderator_user)
@forum_topic = Factory.create(:forum_topic, :title => "my forum topic", :creator => @user)
@forum_post = Factory.create(:forum_post, :topic_id => @forum_topic.id, :body => "xxx")
@other_user = FactoryGirl.create(:user)
@mod = FactoryGirl.create(:moderator_user)
@forum_topic = FactoryGirl.create(:forum_topic, :title => "my forum topic", :creator => @user)
@forum_post = FactoryGirl.create(:forum_post, :topic_id => @forum_topic.id, :body => "xxx")
end
teardown do

View File

@@ -3,12 +3,12 @@ require 'test_helper'
class ForumTopicsControllerTest < ActionController::TestCase
context "The forum topics controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@other_user = Factory.create(:user)
@mod = Factory.create(:moderator_user)
@forum_topic = Factory.create(:forum_topic, :title => "my forum topic", :creator => @user)
@other_user = FactoryGirl.create(:user)
@mod = FactoryGirl.create(:moderator_user)
@forum_topic = FactoryGirl.create(:forum_topic, :title => "my forum topic", :creator => @user)
end
teardown do
@@ -75,7 +75,7 @@ class ForumTopicsControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@post = Factory.create(:forum_post, :topic_id => @forum_topic.id)
@post = FactoryGirl.create(:forum_post, :topic_id => @forum_topic.id)
end
should "destroy the topic and any associated posts" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class IpBansControllerTest < ActionController::TestCase
context "The ip bans controller" do
setup do
@admin = Factory.create(:admin_user)
@admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -25,7 +25,7 @@ class IpBansControllerTest < ActionController::TestCase
context "index action" do
setup do
Factory.create(:ip_ban)
FactoryGirl.create(:ip_ban)
end
should "render" do
@@ -43,7 +43,7 @@ class IpBansControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@ip_ban = Factory.create(:ip_ban)
@ip_ban = FactoryGirl.create(:ip_ban)
end
should "destroy an ip ban" do

View File

@@ -3,8 +3,8 @@ require 'test_helper'
class JanitorTrialsControllerTest < ActionController::TestCase
context "The janitor trials controller" do
setup do
@admin = Factory.create(:admin_user)
@user = Factory.create(:user)
@admin = FactoryGirl.create(:admin_user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -30,7 +30,7 @@ class JanitorTrialsControllerTest < ActionController::TestCase
context "promote action" do
setup do
@janitor_trial = Factory.create(:janitor_trial, :user_id => @user.id)
@janitor_trial = FactoryGirl.create(:janitor_trial, :user_id => @user.id)
end
should "promote the janitor trial" do
@@ -44,7 +44,7 @@ class JanitorTrialsControllerTest < ActionController::TestCase
context "demote action" do
setup do
@janitor_trial = Factory.create(:janitor_trial, :user_id => @user.id)
@janitor_trial = FactoryGirl.create(:janitor_trial, :user_id => @user.id)
end
should "demote the janitor trial" do
@@ -58,7 +58,7 @@ class JanitorTrialsControllerTest < ActionController::TestCase
context "index action" do
setup do
Factory.create(:janitor_trial)
FactoryGirl.create(:janitor_trial)
end
should "render" do

View File

@@ -5,8 +5,8 @@ module Maintenance
class LoginRemindersControllerTest < ActionController::TestCase
context "A login reminder controller" do
setup do
@user = Factory.create(:user)
@blank_email_user = Factory.create(:user, :email => "")
@user = FactoryGirl.create(:user)
@blank_email_user = FactoryGirl.create(:user, :email => "")
CurrentUser.user = nil
CurrentUser.ip_addr = "127.0.0.1"
ActionMailer::Base.delivery_method = :test

View File

@@ -5,7 +5,7 @@ module Maintenance
class PasswordResetsControllerTest < ActionController::TestCase
context "A password resets controller" do
setup do
@user = Factory.create(:user, :email => "abc@com.net")
@user = FactoryGirl.create(:user, :email => "abc@com.net")
CurrentUser.user = nil
CurrentUser.ip_addr = "127.0.0.1"
ActionMailer::Base.delivery_method = :test
@@ -73,8 +73,8 @@ module Maintenance
context "with valid parameters" do
setup do
@user = Factory.create(:user)
@nonce = Factory.create(:user_password_reset_nonce, :email => @user.email)
@user = FactoryGirl.create(:user)
@nonce = FactoryGirl.create(:user_password_reset_nonce, :email => @user.email)
ActionMailer::Base.deliveries.clear
get :edit, :email => @nonce.email, :key => @nonce.key
end
@@ -98,8 +98,8 @@ module Maintenance
context "with valid parameters" do
setup do
@user = Factory.create(:user)
@nonce = Factory.create(:user_password_reset_nonce, :email => @user.email)
@user = FactoryGirl.create(:user)
@nonce = FactoryGirl.create(:user_password_reset_nonce, :email => @user.email)
ActionMailer::Base.deliveries.clear
@old_password = @user.password_hash
post :update, :email => @nonce.email, :key => @nonce.key

View File

@@ -4,7 +4,7 @@ module Moderator
class DashboardsControllerTest < ActionController::TestCase
context "The moderator dashboards controller" do
setup do
@admin = Factory.create(:admin_user)
@admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
Danbooru.config.stubs(:member_comment_time_threshold).returns(1.week.from_now)
@@ -13,7 +13,7 @@ module Moderator
context "show action" do
context "for mod actions" do
setup do
@mod_action = Factory.create(:mod_action)
@mod_action = FactoryGirl.create(:mod_action)
end
should "render" do
@@ -25,7 +25,7 @@ module Moderator
context "for user feedbacks" do
setup do
@feedback = Factory.create(:user_feedback)
@feedback = FactoryGirl.create(:user_feedback)
end
should "render" do
@@ -37,7 +37,7 @@ module Moderator
context "for wiki pages" do
setup do
@wiki_page = Factory.create(:wiki_page)
@wiki_page = FactoryGirl.create(:wiki_page)
end
should "render" do
@@ -49,7 +49,7 @@ module Moderator
context "for tags and uploads" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
should "render" do
@@ -61,8 +61,8 @@ module Moderator
context "for notes"do
setup do
@post = Factory.create(:post)
@note = Factory.create(:note, :post_id => @post.id)
@post = FactoryGirl.create(:post)
@note = FactoryGirl.create(:note, :post_id => @post.id)
end
should "render" do
@@ -74,10 +74,10 @@ module Moderator
context "for comments" do
setup do
@users = (0..5).map {Factory.create(:user)}
@users = (0..5).map {FactoryGirl.create(:user)}
CurrentUser.scoped(@users[0], "1.2.3.4") do
@comment = Factory.create(:comment)
@comment = FactoryGirl.create(:comment)
end
@users.each do |user|
@@ -95,7 +95,7 @@ module Moderator
context "for artists" do
setup do
@artist = Factory.create(:artist)
@artist = FactoryGirl.create(:artist)
end
should "render" do
@@ -107,7 +107,7 @@ module Moderator
context "for flags" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
@post.flag!("blah")
end
@@ -119,7 +119,7 @@ module Moderator
context "for appeals" do
setup do
@post = Factory.create(:post, :is_deleted => true)
@post = FactoryGirl.create(:post, :is_deleted => true)
@post.appeal!("blah")
end

View File

@@ -4,13 +4,13 @@ module Moderator
class InvitationsControllerTest < ActionController::TestCase
context "The invitations controller" do
setup do
@mod = Factory.create(:moderator_user)
@mod = FactoryGirl.create(:moderator_user)
CurrentUser.user = @mod
CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all
@user_1 = Factory.create(:user)
@user_2 = Factory.create(:user, :inviter_id => @mod.id)
@user_1 = FactoryGirl.create(:user)
@user_2 = FactoryGirl.create(:user, :inviter_id => @mod.id)
end
should "render the new page" do

View File

@@ -4,10 +4,10 @@ module Moderator
class IpAddrsControllerTest < ActionController::TestCase
context "The ip addrs controller" do
setup do
@user = Factory.create(:moderator_user)
@user = FactoryGirl.create(:moderator_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
Factory.create(:comment)
FactoryGirl.create(:comment)
MEMCACHE.flush_all
end

View File

@@ -5,11 +5,11 @@ module Moderator
class ApprovalsControllerTest < ActionController::TestCase
context "The moderator post approvals controller" do
setup do
@admin = Factory.create(:admin_user)
@admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post, :is_pending => true)
@post = FactoryGirl.create(:post, :is_pending => true)
end
context "create action" do

View File

@@ -5,11 +5,11 @@ module Moderator
class DisapprovalsControllerTest < ActionController::TestCase
context "The moderator post disapprovals controller" do
setup do
@admin = Factory.create(:admin_user)
@admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post, :is_pending => true)
@post = FactoryGirl.create(:post, :is_pending => true)
end
context "create action" do

View File

@@ -5,14 +5,14 @@ module Moderator
class PostsControllerTest < ActionController::TestCase
context "The moderator post disapprovals controller" do
setup do
@admin = Factory.create(:admin_user)
@admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
end
context "delete action" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
should "render" do
@@ -25,7 +25,7 @@ module Moderator
context "undelete action" do
setup do
@post = Factory.create(:post, :is_deleted => true)
@post = FactoryGirl.create(:post, :is_deleted => true)
end
should "render" do

View File

@@ -5,11 +5,11 @@ module Moderator
class QueuesControllerTest < ActionController::TestCase
context "The moderator post queues controller" do
setup do
@admin = Factory.create(:admin_user)
@admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post, :is_pending => true)
@post = FactoryGirl.create(:post, :is_pending => true)
end
context "show action" do

View File

@@ -4,10 +4,10 @@ module Moderator
class TagsControllerTest < ActionController::TestCase
context "The tags controller" do
setup do
@user = Factory.create(:moderator_user)
@user = FactoryGirl.create(:moderator_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
should "render the edit action" do

View File

@@ -3,10 +3,10 @@ require 'test_helper'
class NewsUpdatesControllerTest < ActionController::TestCase
context "the news updates controller" do
setup do
@admin = Factory.create(:admin_user)
@admin = FactoryGirl.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
@news_update = Factory.create(:news_update)
@news_update = FactoryGirl.create(:news_update)
end
teardown do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class NoteVersionsControllerTest < ActionController::TestCase
context "The note versions controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,8 +15,8 @@ class NoteVersionsControllerTest < ActionController::TestCase
context "index action" do
setup do
@note = Factory.create(:note)
@user_2 = Factory.create(:user)
@note = FactoryGirl.create(:note)
@user_2 = FactoryGirl.create(:user)
CurrentUser.scoped(@user_2, "1.2.3.4") do
@note.update_attributes(:body => "1 2")

View File

@@ -3,10 +3,10 @@ require 'test_helper'
class NotesControllerTest < ActionController::TestCase
context "The notes controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
teardown do
@@ -15,7 +15,7 @@ class NotesControllerTest < ActionController::TestCase
context "index action" do
setup do
Factory.create(:note)
FactoryGirl.create(:note)
end
should "list all notes" do
@@ -39,7 +39,7 @@ class NotesControllerTest < ActionController::TestCase
context "update action" do
setup do
@note = Factory.create(:note)
@note = FactoryGirl.create(:note)
end
should "update a note" do
@@ -51,7 +51,7 @@ class NotesControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@note = Factory.create(:note)
@note = FactoryGirl.create(:note)
end
should "destroy a note" do
@@ -63,7 +63,7 @@ class NotesControllerTest < ActionController::TestCase
context "revert action" do
setup do
@note = Factory.create(:note, :body => "000")
@note = FactoryGirl.create(:note, :body => "000")
@note.update_attributes(:body => "111")
@note.update_attributes(:body => "222")
end

View File

@@ -3,12 +3,12 @@ require 'test_helper'
class PoolElementsControllerTest < ActionController::TestCase
context "The pools posts controller" do
setup do
@user = Factory.create(:user)
@mod = Factory.create(:moderator_user)
@user = FactoryGirl.create(:user)
@mod = FactoryGirl.create(:moderator_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post)
@pool = Factory.create(:pool, :name => "abc")
@post = FactoryGirl.create(:post)
@pool = FactoryGirl.create(:pool, :name => "abc")
end
teardown do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class PoolVersionsControllerTest < ActionController::TestCase
context "The pool versions controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,9 +15,9 @@ class PoolVersionsControllerTest < ActionController::TestCase
context "index action" do
setup do
@pool = Factory.create(:pool)
@user_2 = Factory.create(:user)
@user_3 = Factory.create(:user)
@pool = FactoryGirl.create(:pool)
@user_2 = FactoryGirl.create(:user)
@user_3 = FactoryGirl.create(:user)
CurrentUser.scoped(@user_2, "1.2.3.4") do
@pool.update_attributes(:post_ids => "1 2")

View File

@@ -3,11 +3,11 @@ require 'test_helper'
class PoolsControllerTest < ActionController::TestCase
context "The pools controller" do
setup do
@user = Factory.create(:user)
@mod = Factory.create(:moderator_user)
@user = FactoryGirl.create(:user)
@mod = FactoryGirl.create(:moderator_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
teardown do
@@ -16,7 +16,7 @@ class PoolsControllerTest < ActionController::TestCase
context "index action" do
setup do
Factory.create(:pool, :name => "abc")
FactoryGirl.create(:pool, :name => "abc")
end
should "list all pools" do
@@ -32,7 +32,7 @@ class PoolsControllerTest < ActionController::TestCase
context "show action" do
setup do
@pool = Factory.create(:pool)
@pool = FactoryGirl.create(:pool)
end
should "render" do
@@ -51,7 +51,7 @@ class PoolsControllerTest < ActionController::TestCase
context "update action" do
setup do
@pool = Factory.create(:pool)
@pool = FactoryGirl.create(:pool)
end
should "update a pool" do
@@ -63,7 +63,7 @@ class PoolsControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@pool = Factory.create(:pool)
@pool = FactoryGirl.create(:pool)
end
should "destroy a pool" do
@@ -75,7 +75,7 @@ class PoolsControllerTest < ActionController::TestCase
context "undelete action" do
setup do
@pool = Factory.create(:pool)
@pool = FactoryGirl.create(:pool)
@pool.is_deleted = true
@pool.save
end
@@ -89,8 +89,8 @@ class PoolsControllerTest < ActionController::TestCase
context "revert action" do
setup do
@post_2 = Factory.create(:post)
@pool = Factory.create(:pool, :post_ids => "#{@post.id}")
@post_2 = FactoryGirl.create(:post)
@pool = FactoryGirl.create(:pool, :post_ids => "#{@post.id}")
CurrentUser.ip_addr = "1.2.3.4" # this is to get around the version collation
@pool.update_attributes(:post_ids => "#{@post.id} #{@post_2.id}")
CurrentUser.ip_addr = "127.0.0.1"

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class PostAppealsControllerTest < ActionController::TestCase
context "The post appeals controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -22,8 +22,8 @@ class PostAppealsControllerTest < ActionController::TestCase
context "index action" do
setup do
@post = Factory.create(:post, :is_deleted => true)
@post_appeal = Factory.create(:post_appeal, :post => @post)
@post = FactoryGirl.create(:post, :is_deleted => true)
@post_appeal = FactoryGirl.create(:post_appeal, :post => @post)
end
should "render" do
@@ -41,7 +41,7 @@ class PostAppealsControllerTest < ActionController::TestCase
context "create action" do
setup do
@post = Factory.create(:post, :is_deleted => true)
@post = FactoryGirl.create(:post, :is_deleted => true)
end
should "create a new appeal" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class PostFlagsControllerTest < ActionController::TestCase
context "The post flags controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -22,8 +22,8 @@ class PostFlagsControllerTest < ActionController::TestCase
context "index action" do
setup do
@post = Factory.create(:post)
@post_flag = Factory.create(:post_flag, :post => @post)
@post = FactoryGirl.create(:post)
@post_flag = FactoryGirl.create(:post_flag, :post => @post)
end
should "render" do
@@ -41,7 +41,7 @@ class PostFlagsControllerTest < ActionController::TestCase
context "create action" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
should "create a new flag" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class PostVersionsControllerTest < ActionController::TestCase
context "The post versions controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,7 +15,7 @@ class PostVersionsControllerTest < ActionController::TestCase
context "index action" do
setup do
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
@post.update_attributes(:tag_string => "1 2", :source => "xxx")
@post.update_attributes(:tag_string => "2 3", :rating => "e")
end

View File

@@ -3,10 +3,10 @@ require 'test_helper'
class PostVotesControllerTest < ActionController::TestCase
context "The post vote controller" do
setup do
@user = Factory.create(:privileged_user)
@user = FactoryGirl.create(:privileged_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post)
@post = FactoryGirl.create(:post)
end
teardown do

View File

@@ -3,10 +3,10 @@ require "test_helper"
class PostsControllerTest < ActionController::TestCase
context "The posts controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
@post = Factory.create(:post, :uploader_id => @user.id, :tag_string => "aaaa")
@post = FactoryGirl.create(:post, :uploader_id => @user.id, :tag_string => "aaaa")
MEMCACHE.flush_all
end

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class SessionsControllerTest < ActionController::TestCase
context "the sessions controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
end
context "new action" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class TagAliasesControllerTest < ActionController::TestCase
context "The tag aliases controller" do
setup do
@user = Factory.create(:admin_user)
@user = FactoryGirl.create(:admin_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all
@@ -17,7 +17,7 @@ class TagAliasesControllerTest < ActionController::TestCase
context "index action" do
setup do
@tag_alias = Factory.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
@tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
end
should "list all tag aliass" do
@@ -41,7 +41,7 @@ class TagAliasesControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@tag_alias = Factory.create(:tag_alias)
@tag_alias = FactoryGirl.create(:tag_alias)
end
should "destroy a tag_alias" do
@@ -53,7 +53,7 @@ class TagAliasesControllerTest < ActionController::TestCase
context "destroy_cache action" do
setup do
@tag_alias = Factory.create(:tag_alias, :antecedent_name => "aaa")
@tag_alias = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa")
end
should "reset the cache" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class TagImplicationsControllerTest < ActionController::TestCase
context "The tag implicationes controller" do
setup do
@user = Factory.create(:admin_user)
@user = FactoryGirl.create(:admin_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all
@@ -17,7 +17,7 @@ class TagImplicationsControllerTest < ActionController::TestCase
context "index action" do
setup do
@tag_implication = Factory.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb", :creator => @user)
@tag_implication = FactoryGirl.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb", :creator => @user)
end
should "list all tag implications" do
@@ -41,7 +41,7 @@ class TagImplicationsControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@tag_implication = Factory.create(:tag_implication, :creator => @user)
@tag_implication = FactoryGirl.create(:tag_implication, :creator => @user)
end
should "destroy a tag_implication" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class TagSubscriptionsControllerTest < ActionController::TestCase
context "The tag subscriptions controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,7 +15,7 @@ class TagSubscriptionsControllerTest < ActionController::TestCase
context "index action" do
setup do
@tag_subscription = Factory.create(:tag_subscription, :name => "aaa")
@tag_subscription = FactoryGirl.create(:tag_subscription, :name => "aaa")
end
should "list all visible tag subscriptions" do
@@ -26,7 +26,7 @@ class TagSubscriptionsControllerTest < ActionController::TestCase
context "posts action" do
setup do
@tag_subscription = Factory.create(:tag_subscription, :name => "aaa")
@tag_subscription = FactoryGirl.create(:tag_subscription, :name => "aaa")
end
should "list all visible tag subscriptions" do
@@ -37,7 +37,7 @@ class TagSubscriptionsControllerTest < ActionController::TestCase
context "edit action" do
setup do
@tag_subscription = Factory.create(:tag_subscription)
@tag_subscription = FactoryGirl.create(:tag_subscription)
end
should "render" do
@@ -63,7 +63,7 @@ class TagSubscriptionsControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@tag_subscription = Factory.create(:tag_subscription)
@tag_subscription = FactoryGirl.create(:tag_subscription)
end
should "destroy the posts" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class TagsControllerTest < ActionController::TestCase
context "The tags controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,7 +15,7 @@ class TagsControllerTest < ActionController::TestCase
context "edit action" do
setup do
@tag = Factory.create(:tag, :name => "aaa")
@tag = FactoryGirl.create(:tag, :name => "aaa")
end
should "render" do
@@ -26,7 +26,7 @@ class TagsControllerTest < ActionController::TestCase
context "index action" do
setup do
@tag = Factory.create(:tag, :name => "aaa")
@tag = FactoryGirl.create(:tag, :name => "aaa")
end
should "render" do
@@ -44,7 +44,7 @@ class TagsControllerTest < ActionController::TestCase
context "show action" do
setup do
@tag = Factory.create(:tag)
@tag = FactoryGirl.create(:tag)
end
should "render" do
@@ -55,7 +55,7 @@ class TagsControllerTest < ActionController::TestCase
context "update action" do
setup do
@tag = Factory.create(:tag)
@tag = FactoryGirl.create(:tag)
end
should "update the tag" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class UploadsControllerTest < ActionController::TestCase
context "The uploads controller" do
setup do
@user = Factory.create(:contributor_user)
@user = FactoryGirl.create(:contributor_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -21,7 +21,7 @@ class UploadsControllerTest < ActionController::TestCase
context "for a post that has already been uploaded" do
setup do
@post = Factory.create(:post, :source => "aaa")
@post = FactoryGirl.create(:post, :source => "aaa")
end
should "initialize the post" do
@@ -34,7 +34,7 @@ class UploadsControllerTest < ActionController::TestCase
context "index action" do
setup do
@upload = Factory.create(:source_upload)
@upload = FactoryGirl.create(:source_upload)
end
should "render" do
@@ -52,7 +52,7 @@ class UploadsControllerTest < ActionController::TestCase
context "show action" do
setup do
@upload = Factory.create(:jpg_upload)
@upload = FactoryGirl.create(:jpg_upload)
end
should "render" do
@@ -73,7 +73,7 @@ class UploadsControllerTest < ActionController::TestCase
context "update action" do
setup do
@upload = Factory.create(:jpg_upload)
@upload = FactoryGirl.create(:jpg_upload)
end
should "process an unapproval" do

View File

@@ -3,8 +3,8 @@ require 'test_helper'
class UserFeedbacksControllerTest < ActionController::TestCase
context "The user feedbacks controller" do
setup do
@user = Factory.create(:user)
@critic = Factory.create(:privileged_user)
@user = FactoryGirl.create(:user)
@critic = FactoryGirl.create(:privileged_user)
CurrentUser.user = @critic
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -23,7 +23,7 @@ class UserFeedbacksControllerTest < ActionController::TestCase
context "edit action" do
setup do
@user_feedback = Factory.create(:user_feedback)
@user_feedback = FactoryGirl.create(:user_feedback)
end
should "render" do
@@ -34,7 +34,7 @@ class UserFeedbacksControllerTest < ActionController::TestCase
context "index action" do
setup do
@user_feedback = Factory.create(:user_feedback)
@user_feedback = FactoryGirl.create(:user_feedback)
end
should "render" do
@@ -62,7 +62,7 @@ class UserFeedbacksControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@user_feedback = Factory.create(:user_feedback)
@user_feedback = FactoryGirl.create(:user_feedback)
end
should "delete a feedback" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class UsersControllerTest < ActionController::TestCase
context "The users controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -14,7 +14,7 @@ class UsersControllerTest < ActionController::TestCase
context "index action" do
setup do
Factory.create(:user, :name => "abc")
FactoryGirl.create(:user, :name => "abc")
end
should "list all users" do
@@ -30,7 +30,7 @@ class UsersControllerTest < ActionController::TestCase
context "show action" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
end
should "render" do
@@ -51,7 +51,7 @@ class UsersControllerTest < ActionController::TestCase
context "edit action" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
end
should "render" do
@@ -62,7 +62,7 @@ class UsersControllerTest < ActionController::TestCase
context "update action" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
end
should "update a user" do

View File

@@ -3,7 +3,7 @@ require 'test_helper'
class WikiPageVersionsControllerTest < ActionController::TestCase
context "The wiki page versions controller" do
setup do
@user = Factory.create(:user)
@user = FactoryGirl.create(:user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,7 +15,7 @@ class WikiPageVersionsControllerTest < ActionController::TestCase
context "index action" do
setup do
@wiki_page = Factory.create(:wiki_page)
@wiki_page = FactoryGirl.create(:wiki_page)
@wiki_page.update_attributes(:body => "1 2")
@wiki_page.update_attributes(:body => "2 3")
end

View File

@@ -3,8 +3,8 @@ require 'test_helper'
class WikiPagesControllerTest < ActionController::TestCase
context "The wiki pages controller" do
setup do
@user = Factory.create(:user)
@mod = Factory.create(:moderator_user)
@user = FactoryGirl.create(:user)
@mod = FactoryGirl.create(:moderator_user)
CurrentUser.user = @user
CurrentUser.ip_addr = "127.0.0.1"
end
@@ -15,8 +15,8 @@ class WikiPagesControllerTest < ActionController::TestCase
context "index action" do
setup do
@wiki_page_abc = Factory.create(:wiki_page, :title => "abc")
@wiki_page_def = Factory.create(:wiki_page, :title => "def")
@wiki_page_abc = FactoryGirl.create(:wiki_page, :title => "abc")
@wiki_page_def = FactoryGirl.create(:wiki_page, :title => "def")
end
should "list all wiki_pages" do
@@ -32,7 +32,7 @@ class WikiPagesControllerTest < ActionController::TestCase
context "show action" do
setup do
@wiki_page = Factory.create(:wiki_page)
@wiki_page = FactoryGirl.create(:wiki_page)
end
should "render" do
@@ -57,7 +57,7 @@ class WikiPagesControllerTest < ActionController::TestCase
context "update action" do
setup do
@wiki_page = Factory.create(:wiki_page)
@wiki_page = FactoryGirl.create(:wiki_page)
end
should "update a wiki_page" do
@@ -69,7 +69,7 @@ class WikiPagesControllerTest < ActionController::TestCase
context "destroy action" do
setup do
@wiki_page = Factory.create(:wiki_page)
@wiki_page = FactoryGirl.create(:wiki_page)
end
should "destroy a wiki_page" do
@@ -81,7 +81,7 @@ class WikiPagesControllerTest < ActionController::TestCase
context "revert action" do
setup do
@wiki_page = Factory.create(:wiki_page, :body => "1")
@wiki_page = FactoryGirl.create(:wiki_page, :body => "1")
@wiki_page.update_attributes(:body => "1 2")
@wiki_page.update_attributes(:body => "1 2 3")
end