aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-12-15 20:21:28 +0000
committerMatthew Lemon <y@yulqen.org>2024-12-15 20:21:28 +0000
commit6f197cf2fda6ef1888deafb2acffa095cc0906c7 (patch)
tree4638edeec57d66ffe40f2accfe1cbc1c1d9f2d25
parent86a2efbefa8d093753ac1577d8378f126d83e363 (diff)
ResourceType tests now pass
-rw-r--r--test/controllers/resource_types_controller_test.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/controllers/resource_types_controller_test.rb b/test/controllers/resource_types_controller_test.rb
index c04a258..3d3ea8d 100644
--- a/test/controllers/resource_types_controller_test.rb
+++ b/test/controllers/resource_types_controller_test.rb
@@ -19,16 +19,21 @@ class ResourceTypesControllerTest < ActionDispatch::IntegrationTest
end
test "should create resource_type" do
- assert_difference("ResourceType.count") do
- post resource_types_url, params: { resource_type: { name: @resource_type.name } }
+ # Use a unique name to avoid validation conflicts.
+ unique_name = "UniqueResourceTypeName#{SecureRandom.hex(8)}"
+
+ # POST request to create a new resource type.
+ assert_difference("ResourceType.count", 1) do
+ post resource_types_url, params: { resource_type: { name: unique_name } }
end
+ # Assert redirection to the newly created resource.
assert_redirected_to resource_type_url(ResourceType.last)
end
test "should show resource_type" do
get resource_type_url(@resource_type)
- assert_response :redirect
+ assert_response :success
end
test "should get edit" do