implemented moderator dashboard queue

This commit is contained in:
albert
2011-07-22 17:34:43 -04:00
parent 4828cef27d
commit d0e8084f0f
41 changed files with 710 additions and 330 deletions

View File

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

View File

@@ -1,11 +0,0 @@
# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

View File

@@ -0,0 +1,133 @@
require 'test_helper'
module Moderator
class DashboardsControllerTest < ActionController::TestCase
context "The moderator dashboards controller" do
setup do
@admin = Factory.create(:admin_user)
CurrentUser.user = @admin
CurrentUser.ip_addr = "127.0.0.1"
end
context "show action" do
context "for mod actions" do
setup do
@mod_action = Factory.create(:mod_action)
end
should "render" do
assert_equal(1, ModAction.count)
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
context "for user feedbacks" do
setup do
@feedback = Factory.create(:user_feedback)
end
should "render" do
assert_equal(1, UserFeedback.count)
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
context "for wiki pages" do
setup do
@wiki_page = Factory.create(:wiki_page)
end
should "render" do
assert_equal(1, WikiPageVersion.count)
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
context "for tags and uploads" do
setup do
@post = Factory.create(:post)
end
should "render" do
assert_equal(1, PostVersion.count)
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
context "for notes"do
setup do
@post = Factory.create(:post)
@note = Factory.create(:note, :post_id => @post.id)
end
should "render" do
assert_equal(1, NoteVersion.count)
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
context "for comments" do
setup do
@users = (0..5).map {Factory.create(:user)}
CurrentUser.scoped(@users[0], "1.2.3.4") do
@comment = Factory.create(:comment)
end
@users.each do |user|
CurrentUser.scoped(user, "1.2.3.4") do
@comment.vote!(-1)
end
end
end
should "render" do
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
context "for artists" do
setup do
@artist = Factory.create(:artist)
end
should "render" do
get :show, {}, {:user_id => @admin.id}
assert_equal(1, ArtistVersion.count)
assert_response :success
end
end
context "for flags" do
setup do
@post = Factory.create(:post)
@post.flag!("blah")
end
should "render" do
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
context "for appeals" do
setup do
@post = Factory.create(:post, :is_deleted => true)
@post.appeal!("blah")
end
should "render" do
get :show, {}, {:user_id => @admin.id}
assert_response :success
end
end
end
end
end
end

View File

@@ -0,0 +1,7 @@
require 'test_helper'
class ModActionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end