aboutsummaryrefslogtreecommitdiffstats
path: root/test/controllers/categories_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/controllers/categories_controller_test.rb')
-rw-r--r--test/controllers/categories_controller_test.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/controllers/categories_controller_test.rb b/test/controllers/categories_controller_test.rb
index a21af3b..2185603 100644
--- a/test/controllers/categories_controller_test.rb
+++ b/test/controllers/categories_controller_test.rb
@@ -3,6 +3,9 @@ require "test_helper"
class CategoriesControllerTest < ActionDispatch::IntegrationTest
setup do
@category = categories(:one)
+ @user = users(:one)
+ post session_url, params: { email_address: @user.email_address, password: "password", is_admin: true }
+ follow_redirect! # After login
end
test "should get index" do
@@ -16,8 +19,9 @@ class CategoriesControllerTest < ActionDispatch::IntegrationTest
end
test "should create category" do
+ unique_name = "UniqueCategoryName#{SecureRandom.hex(8)}"
assert_difference("Category.count") do
- post categories_url, params: { category: { badge_foreground_colour: @category.badge_foreground_colour, colour: @category.colour, name: @category.name } }
+ post categories_url, params: { category: { badge_foreground_colour: @category.badge_foreground_colour, colour: @category.colour, name: unique_name } }
end
assert_redirected_to category_url(Category.last)