socialforge/test/functional/forums_controller_test.rb

50 lines
1019 B
Ruby
Raw Normal View History

2014-10-21 15:13:18 +08:00
require 'test_helper'
class ForumsControllerTest < ActionController::TestCase
setup do
@forum = forums(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:forums)
end
test "should get new" do
get :new
assert_response :success
end
test "should create forum" do
assert_difference('Forum.count') do
post :create, forum: { }
end
assert_redirected_to forum_path(assigns(:forum))
end
test "should show forum" do
get :show, id: @forum
assert_response :success
end
test "should get edit" do
get :edit, id: @forum
assert_response :success
end
test "should update forum" do
put :update, id: @forum, forum: { }
assert_redirected_to forum_path(assigns(:forum))
end
test "should destroy forum" do
assert_difference('Forum.count', -1) do
delete :destroy, id: @forum
end
assert_redirected_to forums_path
end
end