Nested routes and database changes that are required
Basic home screen Model and controller tests coming along
This commit is contained in:
@@ -8,7 +8,7 @@ class DomainsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
test "not should get index because we are not logged in" do
|
||||
get domains_url
|
||||
assert_response :success
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
test "should get index because we are logged in" do
|
||||
@@ -18,34 +18,71 @@ class DomainsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
|
||||
test "should not get new" do
|
||||
get new_domain_url
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
sign_in users(:bob)
|
||||
get new_domain_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should not create domain" do
|
||||
post domains_url, params: { domain: { domain: "brand-new-domain.com" } }
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
test "should create domain" do
|
||||
sign_in users(:bob)
|
||||
assert_difference("Domain.count") do
|
||||
post domains_url, params: { domain: { domain: @domain.domain } }
|
||||
post domains_url, params: { domain: { domain: "brand-new-domain.com" } }
|
||||
end
|
||||
|
||||
assert_redirected_to domain_url(Domain.last)
|
||||
end
|
||||
|
||||
test "should show domain" do
|
||||
sign_in users(:bob)
|
||||
get domain_url(@domain)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should not show domain" do
|
||||
get domain_url(@domain)
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
sign_in users(:bob)
|
||||
get edit_domain_url(@domain)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should not get edit" do
|
||||
get edit_domain_url(@domain)
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
|
||||
test "should not update domain" do
|
||||
patch domain_url(@domain), params: { domain: { domain: @domain.domain } }
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
test "should update domain" do
|
||||
sign_in users(:bob)
|
||||
patch domain_url(@domain), params: { domain: { domain: @domain.domain } }
|
||||
assert_redirected_to domain_url(@domain)
|
||||
end
|
||||
|
||||
test "should not destroy domain" do
|
||||
delete domain_url(@domain)
|
||||
assert_redirected_to new_user_session_path
|
||||
end
|
||||
|
||||
test "should destroy domain" do
|
||||
sign_in users(:bob)
|
||||
assert_difference("Domain.count", -1) do
|
||||
delete domain_url(@domain)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user