added moderator/tag
This commit is contained in:
29
test/functional/moderator/tags_controller_test.rb
Normal file
29
test/functional/moderator/tags_controller_test.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
require 'test_helper'
|
||||
|
||||
module Moderator
|
||||
class TagsControllerTest < ActionController::TestCase
|
||||
context "The tags controller" do
|
||||
setup do
|
||||
@user = Factory.create(:moderator_user)
|
||||
CurrentUser.user = @user
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
@post = Factory.create(:post)
|
||||
end
|
||||
|
||||
should "render the edit action" do
|
||||
get :edit, {}, {:user_id => @user.id}
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "execute the update action" do
|
||||
post :update, {:tag => {:predicate => "aaa", :consequent => "bbb"}}, {:user_id => @user.id}
|
||||
assert_redirected_to edit_moderator_tag_path
|
||||
end
|
||||
|
||||
should "fail gracefully if the update action fails" do
|
||||
post :update, {:tag => {:predicate => "", :consequent => "bbb"}}, {:user_id => @user.id}
|
||||
assert_redirected_to edit_moderator_tag_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user