aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-11-11 16:33:24 +0000
committerMatthew Lemon <y@yulqen.org>2024-11-11 16:33:24 +0000
commitb8d7a7cf7e78fe384c6c6e8e6812a252084ce1f0 (patch)
tree5ef297ac23775afb1bcffb68265749d08f282297 /test
parent97201e0bca203b6b303789374ffd7e4228e062a7 (diff)
Adds first pdfresource model
Diffstat (limited to 'test')
-rw-r--r--test/controllers/pdfresources_controller_test.rb48
-rw-r--r--test/fixtures/pdfresources.yml21
-rw-r--r--test/models/pdfresource_test.rb7
-rw-r--r--test/system/pdfresources_test.rb55
4 files changed, 131 insertions, 0 deletions
diff --git a/test/controllers/pdfresources_controller_test.rb b/test/controllers/pdfresources_controller_test.rb
new file mode 100644
index 0000000..bacd96e
--- /dev/null
+++ b/test/controllers/pdfresources_controller_test.rb
@@ -0,0 +1,48 @@
+require "test_helper"
+
+class PdfresourcesControllerTest < ActionDispatch::IntegrationTest
+ setup do
+ @pdfresource = pdfresources(:one)
+ end
+
+ test "should get index" do
+ get pdfresources_url
+ assert_response :success
+ end
+
+ test "should get new" do
+ get new_pdfresource_url
+ assert_response :success
+ end
+
+ test "should create pdfresource" do
+ assert_difference("Pdfresource.count") do
+ post pdfresources_url, params: { pdfresource: { age_range: @pdfresource.age_range, card_description: @pdfresource.card_description, curriculum: @pdfresource.curriculum, description: @pdfresource.description, feature_slot: @pdfresource.feature_slot, name: @pdfresource.name, price: @pdfresource.price, stripe_product_id: @pdfresource.stripe_product_id } }
+ end
+
+ assert_redirected_to pdfresource_url(Pdfresource.last)
+ end
+
+ test "should show pdfresource" do
+ get pdfresource_url(@pdfresource)
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get edit_pdfresource_url(@pdfresource)
+ assert_response :success
+ end
+
+ test "should update pdfresource" do
+ patch pdfresource_url(@pdfresource), params: { pdfresource: { age_range: @pdfresource.age_range, card_description: @pdfresource.card_description, curriculum: @pdfresource.curriculum, description: @pdfresource.description, feature_slot: @pdfresource.feature_slot, name: @pdfresource.name, price: @pdfresource.price, stripe_product_id: @pdfresource.stripe_product_id } }
+ assert_redirected_to pdfresource_url(@pdfresource)
+ end
+
+ test "should destroy pdfresource" do
+ assert_difference("Pdfresource.count", -1) do
+ delete pdfresource_url(@pdfresource)
+ end
+
+ assert_redirected_to pdfresources_url
+ end
+end
diff --git a/test/fixtures/pdfresources.yml b/test/fixtures/pdfresources.yml
new file mode 100644
index 0000000..becdd35
--- /dev/null
+++ b/test/fixtures/pdfresources.yml
@@ -0,0 +1,21 @@
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ name: MyString
+ stripe_product_id: MyString
+ price: 9.99
+ age_range: MyString
+ curriculum: MyString
+ feature_slot: 1
+ description: MyText
+ card_description: MyText
+
+two:
+ name: MyString
+ stripe_product_id: MyString
+ price: 9.99
+ age_range: MyString
+ curriculum: MyString
+ feature_slot: 1
+ description: MyText
+ card_description: MyText
diff --git a/test/models/pdfresource_test.rb b/test/models/pdfresource_test.rb
new file mode 100644
index 0000000..1a045ca
--- /dev/null
+++ b/test/models/pdfresource_test.rb
@@ -0,0 +1,7 @@
+require "test_helper"
+
+class PdfresourceTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
diff --git a/test/system/pdfresources_test.rb b/test/system/pdfresources_test.rb
new file mode 100644
index 0000000..4f7cbf9
--- /dev/null
+++ b/test/system/pdfresources_test.rb
@@ -0,0 +1,55 @@
+require "application_system_test_case"
+
+class PdfresourcesTest < ApplicationSystemTestCase
+ setup do
+ @pdfresource = pdfresources(:one)
+ end
+
+ test "visiting the index" do
+ visit pdfresources_url
+ assert_selector "h1", text: "Pdfresources"
+ end
+
+ test "should create pdfresource" do
+ visit pdfresources_url
+ click_on "New pdfresource"
+
+ fill_in "Age range", with: @pdfresource.age_range
+ fill_in "Card description", with: @pdfresource.card_description
+ fill_in "Curriculum", with: @pdfresource.curriculum
+ fill_in "Description", with: @pdfresource.description
+ fill_in "Feature slot", with: @pdfresource.feature_slot
+ fill_in "Name", with: @pdfresource.name
+ fill_in "Price", with: @pdfresource.price
+ fill_in "Stripe product", with: @pdfresource.stripe_product_id
+ click_on "Create Pdfresource"
+
+ assert_text "Pdfresource was successfully created"
+ click_on "Back"
+ end
+
+ test "should update Pdfresource" do
+ visit pdfresource_url(@pdfresource)
+ click_on "Edit this pdfresource", match: :first
+
+ fill_in "Age range", with: @pdfresource.age_range
+ fill_in "Card description", with: @pdfresource.card_description
+ fill_in "Curriculum", with: @pdfresource.curriculum
+ fill_in "Description", with: @pdfresource.description
+ fill_in "Feature slot", with: @pdfresource.feature_slot
+ fill_in "Name", with: @pdfresource.name
+ fill_in "Price", with: @pdfresource.price
+ fill_in "Stripe product", with: @pdfresource.stripe_product_id
+ click_on "Update Pdfresource"
+
+ assert_text "Pdfresource was successfully updated"
+ click_on "Back"
+ end
+
+ test "should destroy Pdfresource" do
+ visit pdfresource_url(@pdfresource)
+ click_on "Destroy this pdfresource", match: :first
+
+ assert_text "Pdfresource was successfully destroyed"
+ end
+end