aboutsummaryrefslogtreecommitdiffstats
path: root/test/system/categories_test.rb
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-14 17:16:43 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-14 17:16:43 +0000
commit2022831d4960054aef904e27fd2934beb4e3c65e (patch)
tree77f11b9c629d66b9782d7dc6c77105bb178116d8 /test/system/categories_test.rb
parent9292aae8fe1876fe98c90ae0216fb4ea8917b38a (diff)
Adds category model but not wired up to resource yet
Diffstat (limited to '')
-rw-r--r--test/system/categories_test.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/system/categories_test.rb b/test/system/categories_test.rb
new file mode 100644
index 0000000..acff020
--- /dev/null
+++ b/test/system/categories_test.rb
@@ -0,0 +1,45 @@
+require "application_system_test_case"
+
+class CategoriesTest < ApplicationSystemTestCase
+ setup do
+ @category = categories(:one)
+ end
+
+ test "visiting the index" do
+ visit categories_url
+ assert_selector "h1", text: "Categories"
+ end
+
+ test "should create category" do
+ visit categories_url
+ click_on "New category"
+
+ fill_in "Badge foreground colour", with: @category.badge_foreground_colour
+ fill_in "Colour", with: @category.colour
+ fill_in "Name", with: @category.name
+ click_on "Create Category"
+
+ assert_text "Category was successfully created"
+ click_on "Back"
+ end
+
+ test "should update Category" do
+ visit category_url(@category)
+ click_on "Edit this category", match: :first
+
+ fill_in "Badge foreground colour", with: @category.badge_foreground_colour
+ fill_in "Colour", with: @category.colour
+ fill_in "Name", with: @category.name
+ click_on "Update Category"
+
+ assert_text "Category was successfully updated"
+ click_on "Back"
+ end
+
+ test "should destroy Category" do
+ visit category_url(@category)
+ click_on "Destroy this category", match: :first
+
+ assert_text "Category was successfully destroyed"
+ end
+end