aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/controllers/categories_controller_test.rb6
-rw-r--r--test/fixtures/categories.yml6
2 files changed, 8 insertions, 4 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)
diff --git a/test/fixtures/categories.yml b/test/fixtures/categories.yml
index 9074eff..056aa82 100644
--- a/test/fixtures/categories.yml
+++ b/test/fixtures/categories.yml
@@ -6,6 +6,6 @@ one:
badge_foreground_colour: MyString
two:
- name: MyString
- colour: MyString
- badge_foreground_colour: MyString
+ name: MyString2
+ colour: MyString2
+ badge_foreground_colour: MyString2