aboutsummaryrefslogtreecommitdiffstats
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
parent97201e0bca203b6b303789374ffd7e4228e062a7 (diff)
Adds first pdfresource model
-rw-r--r--app/controllers/pdfresources_controller.rb70
-rw-r--r--app/helpers/pdfresources_helper.rb2
-rw-r--r--app/models/pdfresource.rb4
-rw-r--r--app/views/pdfresources/_form.html.erb67
-rw-r--r--app/views/pdfresources/_pdfresource.html.erb56
-rw-r--r--app/views/pdfresources/_pdfresource.json.jbuilder14
-rw-r--r--app/views/pdfresources/edit.html.erb8
-rw-r--r--app/views/pdfresources/index.html.erb21
-rw-r--r--app/views/pdfresources/index.json.jbuilder1
-rw-r--r--app/views/pdfresources/new.html.erb7
-rw-r--r--app/views/pdfresources/show.html.erb15
-rw-r--r--app/views/pdfresources/show.json.jbuilder1
-rw-r--r--config/routes.rb3
-rw-r--r--db/migrate/20241111162753_create_pdfresources.rb16
-rw-r--r--db/migrate/20241111162806_create_active_storage_tables.active_storage.rb57
-rw-r--r--db/schema.rb45
-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
20 files changed, 516 insertions, 2 deletions
diff --git a/app/controllers/pdfresources_controller.rb b/app/controllers/pdfresources_controller.rb
new file mode 100644
index 0000000..068b61a
--- /dev/null
+++ b/app/controllers/pdfresources_controller.rb
@@ -0,0 +1,70 @@
+class PdfresourcesController < ApplicationController
+ before_action :set_pdfresource, only: %i[ show edit update destroy ]
+
+ # GET /pdfresources or /pdfresources.json
+ def index
+ @pdfresources = Pdfresource.all
+ end
+
+ # GET /pdfresources/1 or /pdfresources/1.json
+ def show
+ end
+
+ # GET /pdfresources/new
+ def new
+ @pdfresource = Pdfresource.new
+ end
+
+ # GET /pdfresources/1/edit
+ def edit
+ end
+
+ # POST /pdfresources or /pdfresources.json
+ def create
+ @pdfresource = Pdfresource.new(pdfresource_params)
+
+ respond_to do |format|
+ if @pdfresource.save
+ format.html { redirect_to @pdfresource, notice: "Pdfresource was successfully created." }
+ format.json { render :show, status: :created, location: @pdfresource }
+ else
+ format.html { render :new, status: :unprocessable_entity }
+ format.json { render json: @pdfresource.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PATCH/PUT /pdfresources/1 or /pdfresources/1.json
+ def update
+ respond_to do |format|
+ if @pdfresource.update(pdfresource_params)
+ format.html { redirect_to @pdfresource, notice: "Pdfresource was successfully updated." }
+ format.json { render :show, status: :ok, location: @pdfresource }
+ else
+ format.html { render :edit, status: :unprocessable_entity }
+ format.json { render json: @pdfresource.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /pdfresources/1 or /pdfresources/1.json
+ def destroy
+ @pdfresource.destroy!
+
+ respond_to do |format|
+ format.html { redirect_to pdfresources_path, status: :see_other, notice: "Pdfresource was successfully destroyed." }
+ format.json { head :no_content }
+ end
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_pdfresource
+ @pdfresource = Pdfresource.find(params.expect(:id))
+ end
+
+ # Only allow a list of trusted parameters through.
+ def pdfresource_params
+ params.expect(pdfresource: [ :name, :stripe_product_id, :price, :age_range, :curriculum, :feature_slot, :description, :card_description, pdfs: [], thumbnails: [] ])
+ end
+end
diff --git a/app/helpers/pdfresources_helper.rb b/app/helpers/pdfresources_helper.rb
new file mode 100644
index 0000000..1f400cc
--- /dev/null
+++ b/app/helpers/pdfresources_helper.rb
@@ -0,0 +1,2 @@
+module PdfresourcesHelper
+end
diff --git a/app/models/pdfresource.rb b/app/models/pdfresource.rb
new file mode 100644
index 0000000..6131034
--- /dev/null
+++ b/app/models/pdfresource.rb
@@ -0,0 +1,4 @@
+class Pdfresource < ApplicationRecord
+ has_many_attached :pdfs
+ has_many_attached :thumbnails
+end
diff --git a/app/views/pdfresources/_form.html.erb b/app/views/pdfresources/_form.html.erb
new file mode 100644
index 0000000..a75121a
--- /dev/null
+++ b/app/views/pdfresources/_form.html.erb
@@ -0,0 +1,67 @@
+<%= form_with(model: pdfresource, class: "contents") do |form| %>
+ <% if pdfresource.errors.any? %>
+ <div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
+ <h2><%= pluralize(pdfresource.errors.count, "error") %> prohibited this pdfresource from being saved:</h2>
+
+ <ul>
+ <% pdfresource.errors.each do |error| %>
+ <li><%= error.full_message %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="my-5">
+ <%= form.label :name %>
+ <%= form.text_field :name, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :stripe_product_id %>
+ <%= form.text_field :stripe_product_id, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :pdfs %>
+ <%= form.file_field :pdfs, multiple: true, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :thumbnails %>
+ <%= form.file_field :thumbnails, multiple: true, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :price %>
+ <%= form.text_field :price, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :age_range %>
+ <%= form.text_field :age_range, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :curriculum %>
+ <%= form.text_field :curriculum, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :feature_slot %>
+ <%= form.number_field :feature_slot, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :description %>
+ <%= form.textarea :description, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="my-5">
+ <%= form.label :card_description %>
+ <%= form.textarea :card_description, rows: 4, class: "block shadow rounded-md border border-gray-400 outline-none px-3 py-2 mt-2 w-full" %>
+ </div>
+
+ <div class="inline">
+ <%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
+ </div>
+<% end %>
diff --git a/app/views/pdfresources/_pdfresource.html.erb b/app/views/pdfresources/_pdfresource.html.erb
new file mode 100644
index 0000000..d947dd1
--- /dev/null
+++ b/app/views/pdfresources/_pdfresource.html.erb
@@ -0,0 +1,56 @@
+<div id="<%= dom_id pdfresource %>">
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Name:</strong>
+ <%= pdfresource.name %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Stripe product:</strong>
+ <%= pdfresource.stripe_product_id %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Pdfs:</strong>
+ <% pdfresource.pdfs.each do |pdf| %>
+ <div><%= link_to pdf.filename, pdf %></div>
+ <% end %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Thumbnails:</strong>
+ <% pdfresource.thumbnails.each do |thumbnail| %>
+ <div><%= link_to thumbnail.filename, thumbnail %></div>
+ <% end %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Price:</strong>
+ <%= pdfresource.price %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Age range:</strong>
+ <%= pdfresource.age_range %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Curriculum:</strong>
+ <%= pdfresource.curriculum %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Feature slot:</strong>
+ <%= pdfresource.feature_slot %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Description:</strong>
+ <%= pdfresource.description %>
+ </p>
+
+ <p class="my-5">
+ <strong class="block font-medium mb-1">Card description:</strong>
+ <%= pdfresource.card_description %>
+ </p>
+
+</div>
diff --git a/app/views/pdfresources/_pdfresource.json.jbuilder b/app/views/pdfresources/_pdfresource.json.jbuilder
new file mode 100644
index 0000000..6bb63a6
--- /dev/null
+++ b/app/views/pdfresources/_pdfresource.json.jbuilder
@@ -0,0 +1,14 @@
+json.extract! pdfresource, :id, :name, :stripe_product_id, :pdfs, :thumbnails, :price, :age_range, :curriculum, :feature_slot, :description, :card_description, :created_at, :updated_at
+json.url pdfresource_url(pdfresource, format: :json)
+json.pdfs do
+ json.array!(pdfresource.pdfs) do |pdf|
+ json.id pdf.id
+ json.url url_for(pdf)
+ end
+end
+json.thumbnails do
+ json.array!(pdfresource.thumbnails) do |thumbnail|
+ json.id thumbnail.id
+ json.url url_for(thumbnail)
+ end
+end
diff --git a/app/views/pdfresources/edit.html.erb b/app/views/pdfresources/edit.html.erb
new file mode 100644
index 0000000..6738cf1
--- /dev/null
+++ b/app/views/pdfresources/edit.html.erb
@@ -0,0 +1,8 @@
+<div class="mx-auto md:w-2/3 w-full">
+ <h1 class="font-bold text-4xl">Editing pdfresource</h1>
+
+ <%= render "form", pdfresource: @pdfresource %>
+
+ <%= link_to "Show this pdfresource", @pdfresource, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to "Back to pdfresources", pdfresources_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+</div>
diff --git a/app/views/pdfresources/index.html.erb b/app/views/pdfresources/index.html.erb
new file mode 100644
index 0000000..ff29982
--- /dev/null
+++ b/app/views/pdfresources/index.html.erb
@@ -0,0 +1,21 @@
+<div class="w-full">
+ <% if notice.present? %>
+ <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
+ <% end %>
+
+ <% content_for :title, "Pdfresources" %>
+
+ <div class="flex justify-between items-center">
+ <h1 class="font-bold text-4xl">Pdfresources</h1>
+ <%= link_to "New pdfresource", new_pdfresource_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
+ </div>
+
+ <div id="pdfresources" class="min-w-full">
+ <% @pdfresources.each do |pdfresource| %>
+ <%= render pdfresource %>
+ <p>
+ <%= link_to "Show this pdfresource", pdfresource, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ </p>
+ <% end %>
+ </div>
+</div>
diff --git a/app/views/pdfresources/index.json.jbuilder b/app/views/pdfresources/index.json.jbuilder
new file mode 100644
index 0000000..945d359
--- /dev/null
+++ b/app/views/pdfresources/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @pdfresources, partial: "pdfresources/pdfresource", as: :pdfresource
diff --git a/app/views/pdfresources/new.html.erb b/app/views/pdfresources/new.html.erb
new file mode 100644
index 0000000..5bd072b
--- /dev/null
+++ b/app/views/pdfresources/new.html.erb
@@ -0,0 +1,7 @@
+<div class="mx-auto md:w-2/3 w-full">
+ <h1 class="font-bold text-4xl">New pdfresource</h1>
+
+ <%= render "form", pdfresource: @pdfresource %>
+
+ <%= link_to "Back to pdfresources", pdfresources_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+</div>
diff --git a/app/views/pdfresources/show.html.erb b/app/views/pdfresources/show.html.erb
new file mode 100644
index 0000000..3c4fe66
--- /dev/null
+++ b/app/views/pdfresources/show.html.erb
@@ -0,0 +1,15 @@
+<div class="mx-auto md:w-2/3 w-full flex">
+ <div class="mx-auto">
+ <% if notice.present? %>
+ <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
+ <% end %>
+
+ <%= render @pdfresource %>
+
+ <%= link_to "Edit this pdfresource", edit_pdfresource_path(@pdfresource), class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <%= link_to "Back to pdfresources", pdfresources_path, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
+ <div class="inline-block ml-2">
+ <%= button_to "Destroy this pdfresource", @pdfresource, method: :delete, class: "mt-2 rounded-lg py-3 px-5 bg-gray-100 font-medium" %>
+ </div>
+ </div>
+</div>
diff --git a/app/views/pdfresources/show.json.jbuilder b/app/views/pdfresources/show.json.jbuilder
new file mode 100644
index 0000000..492dde3
--- /dev/null
+++ b/app/views/pdfresources/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "pdfresources/pdfresource", pdfresource: @pdfresource
diff --git a/config/routes.rb b/config/routes.rb
index 29b007b..af58cd0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,5 @@
Rails.application.routes.draw do
+ resources :pdfresources
resource :session
resources :passwords, param: :token
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
@@ -12,5 +13,5 @@ Rails.application.routes.draw do
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
# Defines the root path route ("/")
- # root "posts#index"
+ root "pdfresources#index"
end
diff --git a/db/migrate/20241111162753_create_pdfresources.rb b/db/migrate/20241111162753_create_pdfresources.rb
new file mode 100644
index 0000000..5baf790
--- /dev/null
+++ b/db/migrate/20241111162753_create_pdfresources.rb
@@ -0,0 +1,16 @@
+class CreatePdfresources < ActiveRecord::Migration[8.0]
+ def change
+ create_table :pdfresources do |t|
+ t.string :name
+ t.string :stripe_product_id
+ t.decimal :price
+ t.string :age_range
+ t.string :curriculum
+ t.integer :feature_slot
+ t.text :description
+ t.text :card_description
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20241111162806_create_active_storage_tables.active_storage.rb b/db/migrate/20241111162806_create_active_storage_tables.active_storage.rb
new file mode 100644
index 0000000..6bd8bd0
--- /dev/null
+++ b/db/migrate/20241111162806_create_active_storage_tables.active_storage.rb
@@ -0,0 +1,57 @@
+# This migration comes from active_storage (originally 20170806125915)
+class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
+ def change
+ # Use Active Record's configured type for primary and foreign keys
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
+
+ create_table :active_storage_blobs, id: primary_key_type do |t|
+ t.string :key, null: false
+ t.string :filename, null: false
+ t.string :content_type
+ t.text :metadata
+ t.string :service_name, null: false
+ t.bigint :byte_size, null: false
+ t.string :checksum
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :key ], unique: true
+ end
+
+ create_table :active_storage_attachments, id: primary_key_type do |t|
+ t.string :name, null: false
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
+ t.references :blob, null: false, type: foreign_key_type
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+
+ create_table :active_storage_variant_records, id: primary_key_type do |t|
+ t.belongs_to :blob, null: false, index: false, type: foreign_key_type
+ t.string :variation_digest, null: false
+
+ t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+ end
+
+ private
+ def primary_and_foreign_key_types
+ config = Rails.configuration.generators
+ setting = config.options[config.orm][:primary_key_type]
+ primary_key_type = setting || :primary_key
+ foreign_key_type = setting || :bigint
+ [ primary_key_type, foreign_key_type ]
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 88be2e6..96d2113 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,48 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[8.0].define(version: 2024_11_11_160538) do
+ActiveRecord::Schema[8.0].define(version: 2024_11_11_162806) do
+ create_table "active_storage_attachments", force: :cascade do |t|
+ t.string "name", null: false
+ t.string "record_type", null: false
+ t.bigint "record_id", null: false
+ t.bigint "blob_id", null: false
+ t.datetime "created_at", null: false
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
+ end
+
+ create_table "active_storage_blobs", force: :cascade do |t|
+ t.string "key", null: false
+ t.string "filename", null: false
+ t.string "content_type"
+ t.text "metadata"
+ t.string "service_name", null: false
+ t.bigint "byte_size", null: false
+ t.string "checksum"
+ t.datetime "created_at", null: false
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
+ end
+
+ create_table "active_storage_variant_records", force: :cascade do |t|
+ t.bigint "blob_id", null: false
+ t.string "variation_digest", null: false
+ t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
+ end
+
+ create_table "pdfresources", force: :cascade do |t|
+ t.string "name"
+ t.string "stripe_product_id"
+ t.decimal "price"
+ t.string "age_range"
+ t.string "curriculum"
+ t.integer "feature_slot"
+ t.text "description"
+ t.text "card_description"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "sessions", force: :cascade do |t|
t.integer "user_id", null: false
t.string "ip_address"
@@ -30,5 +71,7 @@ ActiveRecord::Schema[8.0].define(version: 2024_11_11_160538) do
t.index ["email_address"], name: "index_users_on_email_address", unique: true
end
+ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
+ add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "sessions", "users"
end
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