From 0cfaed90f8fb5916bc87f6d263a1ac8c158ed7bb Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 22 Jan 2011 17:04:57 -0500 Subject: [PATCH] fixed some functional tests --- app/views/dmails/_form.html.erb | 2 - test/functional/post_controller_test.rb | 90 ------------------- .../post_moderation_controller_test.rb | 2 +- 3 files changed, 1 insertion(+), 93 deletions(-) delete mode 100644 test/functional/post_controller_test.rb diff --git a/app/views/dmails/_form.html.erb b/app/views/dmails/_form.html.erb index d1fcc50c2..87640fafc 100644 --- a/app/views/dmails/_form.html.erb +++ b/app/views/dmails/_form.html.erb @@ -2,8 +2,6 @@ <%= simple_form_for(dmail) do |f| %> - <%= hidden_field_tag "dmail[parent_id]", dmail.parent_id || dmail.id, :id => "dmail_parent_id" %> - <%= f.input :to_name, :label => "To" %> <%= f.input :title %> <%= f.input :body, :html_options => {:size => "50x25"} %> diff --git a/test/functional/post_controller_test.rb b/test/functional/post_controller_test.rb deleted file mode 100644 index c9c79625e..000000000 --- a/test/functional/post_controller_test.rb +++ /dev/null @@ -1,90 +0,0 @@ -require File.join(File.dirname(__FILE__), %w(.. test_helper)) - -class PostControllerTest < ActionController::TestCase - context "A post controller" do - setup do - @users = {} - @users[:anon] = AnonymousUser.new - @users[:member] = Factory.create(:user) - @users[:banned] = Factory.create(:banned_user) - @users[:priv] = Factory.create(:privileged_user) - @users[:contrib] = Factory.create(:contributor_user) - @users[:janitor] = Factory.create(:janitor_user) - @users[:mod] = Factory.create(:moderator_user) - @users[:admin] = Factory.create(:admin_user) - end - - teardown do - @users = nil - end - - should "display the new post page" do - assert_authentication_fails(:new, :get, :anon) - assert_authentication_passes(:new, :get, :member) - end - - should "create a post" do - post :create, {:post => {:source => "", :file => upload_jpeg("#{Rails.root}/test/files/test.jpg"), :tag_string => "hoge", :rating => "s"}}, {:user_id => @users[:member].id} - p = Post.last - assert_equal("hoge", p.tag_string) - assert_equal("jpg", p.file_ext) - assert_equal("s", p.rating) - assert_equal("uploader:#{@users[:member].name}", p.uploader_string) - assert_equal(true, File.exists?(p.file_path)) - assert_equal(true, File.exists?(p.preview_path)) - end - - should "update a post" do - p1 = create_post("hoge") - - put :update, {:post => {:tags => "moge", :rating => "Explicit"}, :id => p1.id}, {:user_id => 3} - p1.reload - assert_equal("moge", p1.cached_tags) - assert_equal("e", p1.rating) - - assert_equal(2, p1.tag_history.size) - post :update, {:post => {:rating => "Safe"}, :id => p1.id}, {:user_id => 3} - assert_equal(3, p1.tag_history.size) - - p1.update_attribute(:is_rating_locked, true) - post :update, {:post => {:rating => "Questionable"}, :id => p1.id}, {:user_id => 3} - p1.reload - assert_equal("s", p1.rating) - end - - should "list posts" do - get :index, {}, {:user_id => 3} - assert_response :success - - get :index, {:tags => "tag1"}, {:user_id => 3} - assert_response :success - - get :index, {:format => "json"}, {:user_id => 3} - assert_response :success - - get :index, {:format => "xml"}, {:user_id => 3} - assert_response :success - - get :index, {:tags => "-tag1"}, {:user_id => 3} - assert_response :success - end - - should "list posts through an atom feed" do - get :atom, {}, {:user_id => 3} - assert_response :success - - get :atom, {:tags => "tag1"}, {:user_id => 3} - assert_response :success - end - - should "display a post" do - get :show, {:id => 1}, {:user_id => 3} - assert_response :success - end - end - - def test_popular - get :popular_by_day, {}, {:user_id => 3} - assert_response :success - end -end diff --git a/test/functional/post_moderation_controller_test.rb b/test/functional/post_moderation_controller_test.rb index ee16c6bb3..1da883bbc 100644 --- a/test/functional/post_moderation_controller_test.rb +++ b/test/functional/post_moderation_controller_test.rb @@ -1,4 +1,4 @@ -require File.join(File.dirname(__FILE__), %w(.. test_helper)) +require "test_helper" class PostModerationControllerTest < ActionController::TestCase context "A post moderation controller" do