diff --git a/app/logical/moderator/ip_addr_search.rb b/app/logical/moderator/ip_addr_search.rb index b6f1b4fc8..6e3281152 100644 --- a/app/logical/moderator/ip_addr_search.rb +++ b/app/logical/moderator/ip_addr_search.rb @@ -13,6 +13,8 @@ module Moderator search_by_user_name(params[:user_name_eq].split(/,/)) elsif params[:ip_addr_eq] search_by_ip_addr(params[:ip_addr_eq].split(/,/)) + else + [] end end diff --git a/test/functional/dmails_controller_test.rb b/test/functional/dmails_controller_test.rb index f485e9c5c..59ce3c2eb 100644 --- a/test/functional/dmails_controller_test.rb +++ b/test/functional/dmails_controller_test.rb @@ -44,15 +44,17 @@ class DmailsControllerTest < ActionController::TestCase should "show dmails owned by the current user" do get :index, {:owner_id_equals => @dmail.owner_id, :folder => "sent"}, {:user_id => @dmail.owner_id} assert_response :success + assert_equal(1, assigns[:dmails].size) get :index, {:owner_id_equals => @dmail.owner_id, :folder => "received"}, {:user_id => @dmail.owner_id} assert_response :success + assert_equal(1, assigns[:dmails].size) end should "not show dmails not owned by the current user" do - assert_raises(User::PrivilegeError) do - get :index, {:owner_id_equals => @dmail.owner_id}, {:user_id => @unrelated_user.id} - end + get :index, {:owner_id_equals => @dmail.owner_id}, {:user_id => @unrelated_user.id} + assert_response :success + assert_equal(0, assigns[:dmails].size) end end @@ -63,7 +65,7 @@ class DmailsControllerTest < ActionController::TestCase end should "not show dmails not owned by the current user" do - assert_raises(User::PrivilegeError) do + assert_raise(User::PrivilegeError) do get :show, {:id => @dmail.id}, {:user_id => @unrelated_user.id} end end diff --git a/test/functional/favorites_controller_test.rb b/test/functional/favorites_controller_test.rb index 6037db775..987db1f4d 100644 --- a/test/functional/favorites_controller_test.rb +++ b/test/functional/favorites_controller_test.rb @@ -21,7 +21,7 @@ class FavoritesControllerTest < ActionController::TestCase context "with a specified tags parameter" do should "redirect to the posts controller" do - get :index, {:tags => "abc"}, {:user_id => @user} + get :index, {:tags => "fav:#{@user.name} abc"}, {:user_id => @user} assert_redirected_to(posts_path(:tags => "fav:#{@user.name} abc")) end end diff --git a/test/functional/moderator/invitations_controller_test.rb b/test/functional/moderator/invitations_controller_test.rb index 08dce7ec2..901e9f02f 100644 --- a/test/functional/moderator/invitations_controller_test.rb +++ b/test/functional/moderator/invitations_controller_test.rb @@ -14,7 +14,7 @@ module Moderator end should "render the new page" do - get :new, {}, {:user_id => @mod.id} + get :new, {:invitation => {:name => @user_1.name}}, {:user_id => @mod.id} assert_response :success end diff --git a/test/functional/moderator/ip_addrs_controller_test.rb b/test/functional/moderator/ip_addrs_controller_test.rb index e9ea911af..c390e896f 100644 --- a/test/functional/moderator/ip_addrs_controller_test.rb +++ b/test/functional/moderator/ip_addrs_controller_test.rb @@ -12,17 +12,17 @@ module Moderator end should "find by ip addr" do - get :index, {:search => {:ip_addr => "127.0.0.1"}}, {:user_id => @user.id} + get :index, {:search => {:ip_addr_eq => "127.0.0.1"}}, {:user_id => @user.id} assert_response :success end should "find by user id" do - get :index, {:search => {:user_id => @user.id.to_s}}, {:user_id => @user.id} + get :index, {:search => {:user_id_eq => @user.id.to_s}}, {:user_id => @user.id} assert_response :success end should "find by user name" do - get :index, {:search => {:user_name => @user.name}}, {:user_id => @user.id} + get :index, {:search => {:user_name_eq => @user.name}}, {:user_id => @user.id} assert_response :success end diff --git a/test/functional/post_votes_controller_test.rb b/test/functional/post_votes_controller_test.rb index 20c542751..8bd9e60be 100644 --- a/test/functional/post_votes_controller_test.rb +++ b/test/functional/post_votes_controller_test.rb @@ -3,7 +3,7 @@ require 'test_helper' class PostVotesControllerTest < ActionController::TestCase context "The post vote controller" do setup do - @user = Factory.create(:user) + @user = Factory.create(:privileged_user) CurrentUser.user = @user CurrentUser.ip_addr = "127.0.0.1" @post = Factory.create(:post) @@ -17,6 +17,7 @@ class PostVotesControllerTest < ActionController::TestCase context "create action" do should "increment a post's score if the score is positive" do post :create, {:post_id => @post.id, :score => "up", :format => "js"}, {:user_id => @user.id} + assert_response :success @post.reload assert_equal(1, @post.score) end