first release
This commit is contained in:
49
test/functional/blogposts_controller_test.rb
Normal file
49
test/functional/blogposts_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class BlogpostsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@blogpost = blogposts(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:blogposts)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create blogpost" do
|
||||
assert_difference('Blogpost.count') do
|
||||
post :create, blogpost: { }
|
||||
end
|
||||
|
||||
assert_redirected_to blogpost_path(assigns(:blogpost))
|
||||
end
|
||||
|
||||
test "should show blogpost" do
|
||||
get :show, id: @blogpost
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @blogpost
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update blogpost" do
|
||||
put :update, id: @blogpost, blogpost: { }
|
||||
assert_redirected_to blogpost_path(assigns(:blogpost))
|
||||
end
|
||||
|
||||
test "should destroy blogpost" do
|
||||
assert_difference('Blogpost.count', -1) do
|
||||
delete :destroy, id: @blogpost
|
||||
end
|
||||
|
||||
assert_redirected_to blogposts_path
|
||||
end
|
||||
end
|
||||
49
test/functional/comments_controller_test.rb
Normal file
49
test/functional/comments_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class CommentsControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@comment = comments(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:comments)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create comment" do
|
||||
assert_difference('Comment.count') do
|
||||
post :create, comment: { }
|
||||
end
|
||||
|
||||
assert_redirected_to comment_path(assigns(:comment))
|
||||
end
|
||||
|
||||
test "should show comment" do
|
||||
get :show, id: @comment
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @comment
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update comment" do
|
||||
put :update, id: @comment, comment: { }
|
||||
assert_redirected_to comment_path(assigns(:comment))
|
||||
end
|
||||
|
||||
test "should destroy comment" do
|
||||
assert_difference('Comment.count', -1) do
|
||||
delete :destroy, id: @comment
|
||||
end
|
||||
|
||||
assert_redirected_to comments_path
|
||||
end
|
||||
end
|
||||
49
test/functional/users_controller_test.rb
Normal file
49
test/functional/users_controller_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require 'test_helper'
|
||||
|
||||
class UsersControllerTest < ActionController::TestCase
|
||||
setup do
|
||||
@user = users(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_not_nil assigns(:users)
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get :new
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create user" do
|
||||
assert_difference('User.count') do
|
||||
post :create, user: { }
|
||||
end
|
||||
|
||||
assert_redirected_to user_path(assigns(:user))
|
||||
end
|
||||
|
||||
test "should show user" do
|
||||
get :show, id: @user
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit, id: @user
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update user" do
|
||||
put :update, id: @user, user: { }
|
||||
assert_redirected_to user_path(assigns(:user))
|
||||
end
|
||||
|
||||
test "should destroy user" do
|
||||
assert_difference('User.count', -1) do
|
||||
delete :destroy, id: @user
|
||||
end
|
||||
|
||||
assert_redirected_to users_path
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user