diff --git a/app/controllers/admin/raw_hooks_controller.rb b/app/controllers/admin/raw_hooks_controller.rb deleted file mode 100644 index a8397af..0000000 --- a/app/controllers/admin/raw_hooks_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Admin::RawHooksController < ApplicationController - expose(:raw_hook) -end diff --git a/app/controllers/admin/books_controller.rb b/app/controllers/crud/books_controller.rb similarity index 73% rename from app/controllers/admin/books_controller.rb rename to app/controllers/crud/books_controller.rb index 4a5195a..aefb41f 100644 --- a/app/controllers/admin/books_controller.rb +++ b/app/controllers/crud/books_controller.rb @@ -1,10 +1,10 @@ -class Admin::BooksController < ApplicationController +class Crud::BooksController < ApplicationController expose(:book) def create if book.save EnhanceBookJob.perform_later(book.id) - redirect_to edit_admin_book_path(book) + redirect_to edit_crud_book_path(book) else flash.alert = book.errors.full_messages render :new @@ -13,7 +13,7 @@ def create def update if book.update(book_params) - redirect_to edit_admin_book_path(book) + redirect_to edit_crud_book_path(book) else flash.alert = book.errors.full_messages render :edit diff --git a/app/controllers/admin/csv_uploads_controller.rb b/app/controllers/crud/csv_uploads_controller.rb similarity index 75% rename from app/controllers/admin/csv_uploads_controller.rb rename to app/controllers/crud/csv_uploads_controller.rb index 8da880e..1e46319 100644 --- a/app/controllers/admin/csv_uploads_controller.rb +++ b/app/controllers/crud/csv_uploads_controller.rb @@ -1,4 +1,4 @@ -class Admin::CsvUploadsController < ApplicationController +class Crud::CsvUploadsController < ApplicationController expose(:csv_upload) expose(:csv_uploads) do CsvUpload.order(created_at: :desc).page(params[:page]) @@ -8,27 +8,27 @@ def create if csv_upload.save ParseCsvUploadJob.perform_later(csv_upload.id) flash.notice = "CSV Upload created" - redirect_to admin_csv_upload_path(csv_upload) + redirect_to crud_csv_upload_path(csv_upload) else flash.alert = csv_upload.errors.full_messages.to_sentence - redirect_to new_admin_csv_upload_path + redirect_to new_crud_csv_upload_path end end def update if csv_upload.update(csv_upload_params) flash.notice = "CSV Upload updated" - redirect_to admin_csv_upload_path(csv_upload) + redirect_to crud_csv_upload_path(csv_upload) else flash.alert = csv_upload.errors.full_messages.to_sentence - redirect_to edit_admin_csv_upload_path(csv_upload) + redirect_to edit_crud_csv_upload_path(csv_upload) end end def destroy csv_upload.destroy flash.notice = "CSV Upload deleted" - redirect_to admin_csv_uploads_path + redirect_to crud_csv_uploads_path end private diff --git a/app/controllers/admin/financial_accounts_controller.rb b/app/controllers/crud/financial_accounts_controller.rb similarity index 67% rename from app/controllers/admin/financial_accounts_controller.rb rename to app/controllers/crud/financial_accounts_controller.rb index b82df90..8783ace 100644 --- a/app/controllers/admin/financial_accounts_controller.rb +++ b/app/controllers/crud/financial_accounts_controller.rb @@ -1,4 +1,4 @@ -class Admin::FinancialAccountsController < ApplicationController +class Crud::FinancialAccountsController < ApplicationController expose(:financial_account) expose(:financial_accounts) do FinancialAccount.order(created_at: :desc).page(params[:page]) @@ -7,27 +7,27 @@ class Admin::FinancialAccountsController < ApplicationController def create if financial_account.save flash.notice = "Financial Account created" - redirect_to admin_financial_account_path(financial_account) + redirect_to crud_financial_account_path(financial_account) else flash.alert = financial_account.errors.full_messages.to_sentence - redirect_to new_admin_financial_account_path + redirect_to new_crud_financial_account_path end end def update if financial_account.update(financial_account_params) flash.notice = "Financial Account updated" - redirect_to admin_financial_account_path(financial_account) + redirect_to crud_financial_account_path(financial_account) else flash.alert = financial_account.errors.full_messages.to_sentence - redirect_to edit_admin_financial_account_path(financial_account) + redirect_to edit_crud_financial_account_path(financial_account) end end def destroy financial_account.destroy flash.notice = "Financial Account deleted" - redirect_to admin_financial_accounts_path + redirect_to crud_financial_accounts_path end private diff --git a/app/controllers/admin/gift_ideas_controller.rb b/app/controllers/crud/gift_ideas_controller.rb similarity index 68% rename from app/controllers/admin/gift_ideas_controller.rb rename to app/controllers/crud/gift_ideas_controller.rb index 310205c..b12527c 100644 --- a/app/controllers/admin/gift_ideas_controller.rb +++ b/app/controllers/crud/gift_ideas_controller.rb @@ -1,4 +1,4 @@ -class Admin::GiftIdeasController < ApplicationController +class Crud::GiftIdeasController < ApplicationController expose(:gift_idea) expose(:gift_ideas) do GiftIdea.order(created_at: :desc).page(params[:page]) @@ -7,27 +7,27 @@ class Admin::GiftIdeasController < ApplicationController def create if gift_idea.save flash.notice = "Gift Idea created" - redirect_to admin_gift_idea_path(gift_idea) + redirect_to crud_gift_idea_path(gift_idea) else flash.alert = gift_idea.errors.full_messages.to_sentence - redirect_to new_admin_gift_idea_path + redirect_to new_crud_gift_idea_path end end def update if gift_idea.update(gift_idea_params) flash.notice = "Gift Idea updated" - redirect_to admin_gift_idea_path(gift_idea) + redirect_to crud_gift_idea_path(gift_idea) else flash.alert = gift_idea.errors.full_messages.to_sentence - redirect_to edit_admin_gift_idea_path(gift_idea) + redirect_to edit_crud_gift_idea_path(gift_idea) end end def destroy gift_idea.destroy flash.notice = "Gift Idea deleted" - redirect_to admin_gift_ideas_path + redirect_to crud_gift_ideas_path end private diff --git a/app/controllers/admin/post_bin_requests_controller.rb b/app/controllers/crud/post_bin_requests_controller.rb similarity index 65% rename from app/controllers/admin/post_bin_requests_controller.rb rename to app/controllers/crud/post_bin_requests_controller.rb index 130fada..7b5ad4f 100644 --- a/app/controllers/admin/post_bin_requests_controller.rb +++ b/app/controllers/crud/post_bin_requests_controller.rb @@ -1,4 +1,4 @@ -class Admin::PostBinRequestsController < ApplicationController +class Crud::PostBinRequestsController < ApplicationController expose(:post_bin_request) expose(:post_bin_requests) { PostBinRequest.all.order(created_at: :desc).limit(10) } end diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/crud/projects_controller.rb similarity index 82% rename from app/controllers/admin/projects_controller.rb rename to app/controllers/crud/projects_controller.rb index ee085d7..bcbfe82 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/crud/projects_controller.rb @@ -1,10 +1,10 @@ -class Admin::ProjectsController < ApplicationController +class Crud::ProjectsController < ApplicationController expose(:projects) { Project.order(:touched_at) } expose(:project) def create if project.save - redirect_to admin_projects_path + redirect_to crud_projects_path else flash[:alert] = t("projects.create_error") render :index, status: :unprocessable_entity diff --git a/app/controllers/crud/raw_hooks_controller.rb b/app/controllers/crud/raw_hooks_controller.rb new file mode 100644 index 0000000..d79000e --- /dev/null +++ b/app/controllers/crud/raw_hooks_controller.rb @@ -0,0 +1,3 @@ +class Crud::RawHooksController < ApplicationController + expose(:raw_hook) +end diff --git a/app/javascript/controllers/projects_controller.js b/app/javascript/controllers/projects_controller.js index 4c0e9d6..c29701e 100644 --- a/app/javascript/controllers/projects_controller.js +++ b/app/javascript/controllers/projects_controller.js @@ -21,7 +21,7 @@ export default class extends Controller { event.preventDefault() projectItem.classList.add("touched") const id = projectItem.dataset.projectId - const url = `/admin/projects/${id}.json` + const url = `/crud/projects/${id}.json` fetch(url, options) }) }) diff --git a/app/views/admin/csv_uploads/show.html.haml b/app/views/admin/csv_uploads/show.html.haml deleted file mode 100644 index 067cada..0000000 --- a/app/views/admin/csv_uploads/show.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -%h1 CSV Upload #{csv_upload.id} - -%p= link_to "CSV Upload List", admin_csv_uploads_path - -%p= link_to "Edit CSV Upload", edit_admin_csv_upload_path(csv_upload) - -%p= link_to "Delete CSV Upload", admin_csv_upload_path(csv_upload), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } - -= render partial: "attrs_table", locals: { attrs: csv_upload.table_attrs } - -%h2 Data - -%pre.text-off-black.h-72 - %code= csv_upload.data diff --git a/app/views/admin/financial_accounts/edit.html.haml b/app/views/admin/financial_accounts/edit.html.haml deleted file mode 100644 index c7e3892..0000000 --- a/app/views/admin/financial_accounts/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 Edit Financial Account #{financial_account.id} - -%p= link_to "Show Financial Account", admin_financial_account_path(financial_account) - -= form_with model: [:admin, financial_account] do |form| - = form.text_field :name, placeholder: "name" - = form.button "update" diff --git a/app/views/admin/financial_accounts/new.html.haml b/app/views/admin/financial_accounts/new.html.haml deleted file mode 100644 index 83f93e0..0000000 --- a/app/views/admin/financial_accounts/new.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 New Financial Account - -%p= link_to "Financial Account List", admin_financial_accounts_path - -= form_with model: [:admin, financial_account] do |form| - = form.text_field :name, placeholder: "name" - = form.button "create" diff --git a/app/views/admin/financial_accounts/show.html.haml b/app/views/admin/financial_accounts/show.html.haml deleted file mode 100644 index b8c3604..0000000 --- a/app/views/admin/financial_accounts/show.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h1 Financial Account #{financial_account.id} - -%p= link_to "Financial Account List", admin_financial_accounts_path - -%p= link_to "Edit Financial Account", edit_admin_financial_account_path(financial_account) - -%p= link_to "Delete Financial Account", admin_financial_account_path(financial_account), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } - -= render partial: "attrs_table", locals: { attrs: financial_account.table_attrs } diff --git a/app/views/admin/gift_ideas/show.html.haml b/app/views/admin/gift_ideas/show.html.haml deleted file mode 100644 index 2716708..0000000 --- a/app/views/admin/gift_ideas/show.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h1 Gift Idea #{gift_idea.id} - -%p= link_to "Gift Idea List", admin_gift_ideas_path - -%p= link_to "Edit Gift Idea", edit_admin_gift_idea_path(gift_idea) - -%p= link_to "Delete Gift Idea", admin_gift_idea_path(gift_idea), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } - -= render partial: "attrs_table", locals: { attrs: gift_idea.table_attrs } diff --git a/app/views/admin/books/_form.html.haml b/app/views/crud/books/_form.html.haml similarity index 66% rename from app/views/admin/books/_form.html.haml rename to app/views/crud/books/_form.html.haml index d193846..b34b08f 100644 --- a/app/views/admin/books/_form.html.haml +++ b/app/views/crud/books/_form.html.haml @@ -1,4 +1,4 @@ -= form_with model: [:admin, book] do |form| += form_with model: [:crud, book] do |form| = form.text_field :isbn = form.date_field :finished_on = form.button button_label diff --git a/app/views/admin/books/edit.html.haml b/app/views/crud/books/edit.html.haml similarity index 100% rename from app/views/admin/books/edit.html.haml rename to app/views/crud/books/edit.html.haml diff --git a/app/views/admin/books/new.html.haml b/app/views/crud/books/new.html.haml similarity index 100% rename from app/views/admin/books/new.html.haml rename to app/views/crud/books/new.html.haml diff --git a/app/views/admin/csv_uploads/edit.html.haml b/app/views/crud/csv_uploads/edit.html.haml similarity index 54% rename from app/views/admin/csv_uploads/edit.html.haml rename to app/views/crud/csv_uploads/edit.html.haml index 42c58da..4da2546 100644 --- a/app/views/admin/csv_uploads/edit.html.haml +++ b/app/views/crud/csv_uploads/edit.html.haml @@ -1,7 +1,7 @@ %h1 Edit CSV Upload #{csv_upload.id} -%p= link_to "Show CSV Upload", admin_csv_upload_path(csv_upload) +%p= link_to "Show CSV Upload", crud_csv_upload_path(csv_upload) -= form_with model: [:admin, csv_upload] do |form| += form_with model: [:crud, csv_upload] do |form| = form.text_field :original_filename, placeholder: "original filename" = form.button "update" diff --git a/app/views/admin/csv_uploads/index.html.haml b/app/views/crud/csv_uploads/index.html.haml similarity index 74% rename from app/views/admin/csv_uploads/index.html.haml rename to app/views/crud/csv_uploads/index.html.haml index 570efce..bac6711 100644 --- a/app/views/admin/csv_uploads/index.html.haml +++ b/app/views/crud/csv_uploads/index.html.haml @@ -1,6 +1,6 @@ %h1 CSV Uploads -%p= link_to "New CSV Upload", new_admin_csv_upload_path +%p= link_to "New CSV Upload", new_crud_csv_upload_path %table %thead @@ -12,7 +12,7 @@ %tbody - csv_uploads.each do |csv_upload| %tr - %td= link_to csv_upload.id, admin_csv_upload_path(csv_upload.id) + %td= link_to csv_upload.id, crud_csv_upload_path(csv_upload.id) %td= csv_upload.parser_class_name %td= csv_upload.original_filename %td.text-right= csv_upload.created_at.to_formatted_s(:long) diff --git a/app/views/admin/csv_uploads/new.html.haml b/app/views/crud/csv_uploads/new.html.haml similarity index 72% rename from app/views/admin/csv_uploads/new.html.haml rename to app/views/crud/csv_uploads/new.html.haml index c2bef4a..f0a1a46 100644 --- a/app/views/admin/csv_uploads/new.html.haml +++ b/app/views/crud/csv_uploads/new.html.haml @@ -1,8 +1,8 @@ %h1 New CSV Upload -%p= link_to "CSV Upload List", admin_csv_uploads_path +%p= link_to "CSV Upload List", crud_csv_uploads_path -= form_with model: [:admin, csv_upload], multipart: true do |form| += form_with model: [:crud, csv_upload], multipart: true do |form| %select#csv_upload_parser_class_name(name="csv_upload[parser_class_name]" required="true") %option(value="" disabled="true" selected hidden) pick parser %option(value="WellsFargoParser") WellsFargoParser diff --git a/app/views/crud/csv_uploads/show.html.haml b/app/views/crud/csv_uploads/show.html.haml new file mode 100644 index 0000000..8c2104c --- /dev/null +++ b/app/views/crud/csv_uploads/show.html.haml @@ -0,0 +1,14 @@ +%h1 CSV Upload #{csv_upload.id} + +%p= link_to "CSV Upload List", crud_csv_uploads_path + +%p= link_to "Edit CSV Upload", edit_crud_csv_upload_path(csv_upload) + +%p= link_to "Delete CSV Upload", crud_csv_upload_path(csv_upload), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } + += render partial: "attrs_table", locals: { attrs: csv_upload.table_attrs } + +%h2 Data + +%pre.text-off-black.h-72 + %code= csv_upload.data diff --git a/app/views/crud/financial_accounts/edit.html.haml b/app/views/crud/financial_accounts/edit.html.haml new file mode 100644 index 0000000..78a0344 --- /dev/null +++ b/app/views/crud/financial_accounts/edit.html.haml @@ -0,0 +1,7 @@ +%h1 Edit Financial Account #{financial_account.id} + +%p= link_to "Show Financial Account", crud_financial_account_path(financial_account) + += form_with model: [:crud, financial_account] do |form| + = form.text_field :name, placeholder: "name" + = form.button "update" diff --git a/app/views/admin/financial_accounts/index.html.haml b/app/views/crud/financial_accounts/index.html.haml similarity index 66% rename from app/views/admin/financial_accounts/index.html.haml rename to app/views/crud/financial_accounts/index.html.haml index fdfb9b1..126bdb3 100644 --- a/app/views/admin/financial_accounts/index.html.haml +++ b/app/views/crud/financial_accounts/index.html.haml @@ -1,6 +1,6 @@ %h1 Financial Accounts -%p= link_to "New Financial Account", new_admin_financial_account_path +%p= link_to "New Financial Account", new_crud_financial_account_path %table %thead @@ -11,7 +11,7 @@ %tbody - financial_accounts.each do |financial_account| %tr - %td= link_to financial_account.id, admin_financial_account_path(financial_account) + %td= link_to financial_account.id, crud_financial_account_path(financial_account) %td= financial_account.name %td.text-right= financial_account.created_at.to_formatted_s(:long) diff --git a/app/views/crud/financial_accounts/new.html.haml b/app/views/crud/financial_accounts/new.html.haml new file mode 100644 index 0000000..5268c61 --- /dev/null +++ b/app/views/crud/financial_accounts/new.html.haml @@ -0,0 +1,7 @@ +%h1 New Financial Account + +%p= link_to "Financial Account List", crud_financial_accounts_path + += form_with model: [:crud, financial_account] do |form| + = form.text_field :name, placeholder: "name" + = form.button "create" diff --git a/app/views/crud/financial_accounts/show.html.haml b/app/views/crud/financial_accounts/show.html.haml new file mode 100644 index 0000000..af05f46 --- /dev/null +++ b/app/views/crud/financial_accounts/show.html.haml @@ -0,0 +1,9 @@ +%h1 Financial Account #{financial_account.id} + +%p= link_to "Financial Account List", crud_financial_accounts_path + +%p= link_to "Edit Financial Account", edit_crud_financial_account_path(financial_account) + +%p= link_to "Delete Financial Account", crud_financial_account_path(financial_account), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } + += render partial: "attrs_table", locals: { attrs: financial_account.table_attrs } diff --git a/app/views/admin/gift_ideas/_form.html.haml b/app/views/crud/gift_ideas/_form.html.haml similarity index 78% rename from app/views/admin/gift_ideas/_form.html.haml rename to app/views/crud/gift_ideas/_form.html.haml index be42b54..67fd2da 100644 --- a/app/views/admin/gift_ideas/_form.html.haml +++ b/app/views/crud/gift_ideas/_form.html.haml @@ -1,4 +1,4 @@ -= form_with model: [:admin, gift_idea] do |form| += form_with model: [:crud, gift_idea] do |form| = form.text_field :title, placeholder: "title" = form.text_field :website_url, placeholder: "website" = form.text_area :note, placeholder: "note" diff --git a/app/views/admin/gift_ideas/edit.html.haml b/app/views/crud/gift_ideas/edit.html.haml similarity index 61% rename from app/views/admin/gift_ideas/edit.html.haml rename to app/views/crud/gift_ideas/edit.html.haml index 4a1cd73..6891b6e 100644 --- a/app/views/admin/gift_ideas/edit.html.haml +++ b/app/views/crud/gift_ideas/edit.html.haml @@ -1,5 +1,5 @@ %h1 Edit Gift Idea #{gift_idea.id} -%p= link_to "Show Gift Idea", admin_gift_idea_path(gift_idea) +%p= link_to "Show Gift Idea", crud_gift_idea_path(gift_idea) = render "form", gift_idea: gift_idea, button_label: "update" diff --git a/app/views/admin/gift_ideas/index.html.haml b/app/views/crud/gift_ideas/index.html.haml similarity index 69% rename from app/views/admin/gift_ideas/index.html.haml rename to app/views/crud/gift_ideas/index.html.haml index f673fed..be1ff7f 100644 --- a/app/views/admin/gift_ideas/index.html.haml +++ b/app/views/crud/gift_ideas/index.html.haml @@ -1,6 +1,6 @@ %h1 Gift Ideas -%p= link_to "New Gift Idea", new_admin_gift_idea_path +%p= link_to "New Gift Idea", new_crud_gift_idea_path %table %thead @@ -11,7 +11,7 @@ %tbody - gift_ideas.each do |gift_idea| %tr - %td= link_to gift_idea.id, admin_gift_idea_path(gift_idea) + %td= link_to gift_idea.id, crud_gift_idea_path(gift_idea) %td= gift_idea.title %td.text-right= gift_idea.created_at.to_formatted_s(:long) diff --git a/app/views/admin/gift_ideas/new.html.haml b/app/views/crud/gift_ideas/new.html.haml similarity index 61% rename from app/views/admin/gift_ideas/new.html.haml rename to app/views/crud/gift_ideas/new.html.haml index 42048fa..ca39dcb 100644 --- a/app/views/admin/gift_ideas/new.html.haml +++ b/app/views/crud/gift_ideas/new.html.haml @@ -1,5 +1,5 @@ %h1 New Gift Idea -%p= link_to "Gift Idea List", admin_gift_ideas_path +%p= link_to "Gift Idea List", crud_gift_ideas_path = render "form", gift_idea: gift_idea, button_label: "create" diff --git a/app/views/crud/gift_ideas/show.html.haml b/app/views/crud/gift_ideas/show.html.haml new file mode 100644 index 0000000..63bc00f --- /dev/null +++ b/app/views/crud/gift_ideas/show.html.haml @@ -0,0 +1,9 @@ +%h1 Gift Idea #{gift_idea.id} + +%p= link_to "Gift Idea List", crud_gift_ideas_path + +%p= link_to "Edit Gift Idea", edit_crud_gift_idea_path(gift_idea) + +%p= link_to "Delete Gift Idea", crud_gift_idea_path(gift_idea), data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } + += render partial: "attrs_table", locals: { attrs: gift_idea.table_attrs } diff --git a/app/views/admin/post_bin_requests/index.html.haml b/app/views/crud/post_bin_requests/index.html.haml similarity index 100% rename from app/views/admin/post_bin_requests/index.html.haml rename to app/views/crud/post_bin_requests/index.html.haml diff --git a/app/views/admin/post_bin_requests/show.html.haml b/app/views/crud/post_bin_requests/show.html.haml similarity index 100% rename from app/views/admin/post_bin_requests/show.html.haml rename to app/views/crud/post_bin_requests/show.html.haml diff --git a/app/views/admin/projects/index.html.haml b/app/views/crud/projects/index.html.haml similarity index 90% rename from app/views/admin/projects/index.html.haml rename to app/views/crud/projects/index.html.haml index 6e0c93a..21b8698 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/crud/projects/index.html.haml @@ -5,7 +5,7 @@ %menu %a(href="#") Create Project %section - = form_with model: [:admin, project] do |f| + = form_with model: [:crud, project] do |f| = f.text_field :name = f.button "Create" - if projects.any? diff --git a/app/views/admin/raw_hooks/show.html.haml b/app/views/crud/raw_hooks/show.html.haml similarity index 100% rename from app/views/admin/raw_hooks/show.html.haml rename to app/views/crud/raw_hooks/show.html.haml diff --git a/app/views/dashboard/show.html.haml b/app/views/dashboard/show.html.haml index 2bd1622..db4e003 100644 --- a/app/views/dashboard/show.html.haml +++ b/app/views/dashboard/show.html.haml @@ -14,13 +14,13 @@ %p= link_to "Model Counts", model_counts_path %p= link_to "Today", today_path -%h2 Admin Pages -%p= link_to "Books", new_admin_book_path -%p= link_to "CSV Uploads", admin_csv_uploads_path -%p= link_to "Financial Accounts", admin_financial_accounts_path -%p= link_to "Gift Ideas", admin_gift_ideas_path -%p= link_to "Post Bin", admin_post_bin_requests_path -%p= link_to "Project List", admin_projects_path +%h2 CRUD Pages +%p= link_to "Books", new_crud_book_path +%p= link_to "CSV Uploads", crud_csv_uploads_path +%p= link_to "Financial Accounts", crud_financial_accounts_path +%p= link_to "Gift Ideas", crud_gift_ideas_path +%p= link_to "Post Bin", crud_post_bin_requests_path +%p= link_to "Project List", crud_projects_path %h2 Api Routes %p= link_to "Ping", api_v1_ping_path diff --git a/app/views/reading_list/index.html.haml b/app/views/reading_list/index.html.haml index 05f83df..44b8b58 100644 --- a/app/views/reading_list/index.html.haml +++ b/app/views/reading_list/index.html.haml @@ -15,6 +15,6 @@ %tbody - reading_list.books.each do |book| %tr - %td= link_to book.title, edit_admin_book_path(book) + %td= link_to book.title, edit_crud_book_path(book) %td.text-right= book.finished_on&.strftime("%m/%d") %td.text-right= number_with_delimiter book.pages diff --git a/config/routes.rb b/config/routes.rb index 49a64f4..396352c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -24,7 +24,7 @@ resources :gift_ideas, only: %i[update] - namespace :admin do + namespace :crud do resources :books, only: %i[create edit new update] resources :csv_uploads resources :financial_accounts diff --git a/spec/system/auth/admin_auth_spec.rb b/spec/system/auth/admin_auth_spec.rb index c1a62e1..e7dd1c0 100644 --- a/spec/system/auth/admin_auth_spec.rb +++ b/spec/system/auth/admin_auth_spec.rb @@ -10,11 +10,11 @@ end scenario "signing in with redirect_to works" do - visit "/admin/projects" + visit "/crud/projects" fill_in "admin_password", with: "shhh" click_on "sign in" expect(page).to have_content "Password saved to session" - expect(current_path).to eq "/admin/projects" + expect(current_path).to eq "/crud/projects" end scenario "signing out clears session" do diff --git a/spec/system/books/admin_creates_book_spec.rb b/spec/system/crud/books/admin_creates_book_spec.rb similarity index 94% rename from spec/system/books/admin_creates_book_spec.rb rename to spec/system/crud/books/admin_creates_book_spec.rb index 748a50e..19798a4 100644 --- a/spec/system/books/admin_creates_book_spec.rb +++ b/spec/system/crud/books/admin_creates_book_spec.rb @@ -4,7 +4,7 @@ include_context "admin password matches" scenario "creating first book" do - visit "/admin/books/new" + visit "/crud/books/new" fill_in "book[isbn]", with: "123" fill_in "book[finished_on]", with: "01/01/2000" click_on "create" diff --git a/spec/system/csv_uploads/admin_creates_csv_upload_spec.rb b/spec/system/crud/csv_uploads/admin_creates_csv_upload_spec.rb similarity index 84% rename from spec/system/csv_uploads/admin_creates_csv_upload_spec.rb rename to spec/system/crud/csv_uploads/admin_creates_csv_upload_spec.rb index b0fb6bf..d2328d8 100644 --- a/spec/system/csv_uploads/admin_creates_csv_upload_spec.rb +++ b/spec/system/crud/csv_uploads/admin_creates_csv_upload_spec.rb @@ -4,15 +4,15 @@ include_context "admin password matches" scenario "from list page" do - visit "/admin/csv_uploads" + visit "/crud/csv_uploads" click_on "New CSV Upload" expect(page).to have_css "h1", text: "New CSV Upload" expect(page).to have_css "a", text: "CSV Upload List" - expect(current_path).to eq new_admin_csv_upload_path + expect(current_path).to eq new_crud_csv_upload_path end scenario "create with parser error" do - visit "/admin/csv_uploads/new" + visit "/crud/csv_uploads/new" click_on "create" select = page.find("#csv_upload_parser_class_name") error_message = select.native.attribute("validationMessage") @@ -20,7 +20,7 @@ end scenario "create with file error" do - visit "/admin/csv_uploads/new" + visit "/crud/csv_uploads/new" select "WellsFargoParser", from: "csv_upload_parser_class_name" click_on "create" file_input = page.find("#file_picker") @@ -29,17 +29,17 @@ end scenario "create with empty file error" do - visit "/admin/csv_uploads/new" + visit "/crud/csv_uploads/new" select "WellsFargoParser", from: "csv_upload_parser_class_name" attach_file "file", "spec/csv_files/empty.csv" click_on "create" expect(page).to have_content "Data can't be blank" expect(page).to have_css ".alert", text: "Data can't be blank" - expect(current_path).to eq new_admin_csv_upload_path + expect(current_path).to eq new_crud_csv_upload_path end scenario "create successfully" do - visit "/admin/csv_uploads/new" + visit "/crud/csv_uploads/new" select "WellsFargoParser", from: "csv_upload_parser_class_name" attach_file "file", "spec/csv_files/one_wf_transaction.csv" click_on "create" @@ -48,7 +48,7 @@ expect(ParseCsvUploadJob).to have_been_enqueued csv_upload = CsvUpload.last - expect(current_path).to eq admin_csv_upload_path(csv_upload) + expect(current_path).to eq crud_csv_upload_path(csv_upload) actual_values = page.all("tr").map do |table_row| table_row.all("td").map(&:text) diff --git a/spec/system/csv_uploads/admin_deletes_csv_upload_spec.rb b/spec/system/crud/csv_uploads/admin_deletes_csv_upload_spec.rb similarity index 69% rename from spec/system/csv_uploads/admin_deletes_csv_upload_spec.rb rename to spec/system/crud/csv_uploads/admin_deletes_csv_upload_spec.rb index d5be03f..f917597 100644 --- a/spec/system/csv_uploads/admin_deletes_csv_upload_spec.rb +++ b/spec/system/crud/csv_uploads/admin_deletes_csv_upload_spec.rb @@ -6,22 +6,22 @@ let(:csv_upload) { FactoryBot.create(:csv_upload) } scenario "cancels delete" do - visit "/admin/csv_uploads/#{csv_upload.id}" + visit "/crud/csv_uploads/#{csv_upload.id}" dismiss_confirm { click_on "Delete CSV Upload" } expect(CsvUpload.count).to eq 1 - expect(current_path).to eq admin_csv_upload_path(csv_upload) + expect(current_path).to eq crud_csv_upload_path(csv_upload) end scenario "confirms delete" do - visit "/admin/csv_uploads/#{csv_upload.id}" + visit "/crud/csv_uploads/#{csv_upload.id}" accept_confirm { click_on "Delete CSV Upload" } expect(page).to have_css ".notice", text: "CSV Upload deleted" expect(CsvUpload.count).to eq 0 - expect(current_path).to eq admin_csv_uploads_path + expect(current_path).to eq crud_csv_uploads_path end end diff --git a/spec/system/csv_uploads/admin_edits_financial_account_spec.rb b/spec/system/crud/csv_uploads/admin_edits_financial_account_spec.rb similarity index 76% rename from spec/system/csv_uploads/admin_edits_financial_account_spec.rb rename to spec/system/crud/csv_uploads/admin_edits_financial_account_spec.rb index 326c8ff..e05b626 100644 --- a/spec/system/csv_uploads/admin_edits_financial_account_spec.rb +++ b/spec/system/crud/csv_uploads/admin_edits_financial_account_spec.rb @@ -5,16 +5,16 @@ scenario "from show page" do csv_upload = FactoryBot.create(:csv_upload) - visit "/admin/csv_uploads/#{csv_upload.id}" + visit "/crud/csv_uploads/#{csv_upload.id}" click_on "Edit CSV Upload" expect(page).to have_css "h1", text: "Edit CSV Upload #{csv_upload.id}" expect(page).to have_css "a", text: "Show CSV Upload" - expect(current_path).to eq edit_admin_csv_upload_path(csv_upload) + expect(current_path).to eq edit_crud_csv_upload_path(csv_upload) end scenario "edit with errors" do csv_upload = FactoryBot.create(:csv_upload) - visit "/admin/csv_uploads/#{csv_upload.id}/edit" + visit "/crud/csv_uploads/#{csv_upload.id}/edit" fill_in "original filename", with: "" click_on "update" expect(page).to have_css ".alert", text: "Original filename can't be blank" @@ -25,12 +25,12 @@ :csv_upload, original_filename: "some-gret-data.csl" ) - visit "/admin/csv_uploads/#{csv_upload.id}/edit" + visit "/crud/csv_uploads/#{csv_upload.id}/edit" fill_in "original filename", with: "some-great-data.csv" click_on "update" expect(page).to have_css ".notice", text: "CSV Upload updated" - expect(current_path).to eq admin_csv_upload_path(csv_upload) + expect(current_path).to eq crud_csv_upload_path(csv_upload) expect(page).to have_css "td", text: "some-great-data.csv" end end diff --git a/spec/system/csv_uploads/admin_views_csv_upload_spec.rb b/spec/system/crud/csv_uploads/admin_views_csv_upload_spec.rb similarity index 87% rename from spec/system/csv_uploads/admin_views_csv_upload_spec.rb rename to spec/system/crud/csv_uploads/admin_views_csv_upload_spec.rb index bc817ee..c954760 100644 --- a/spec/system/csv_uploads/admin_views_csv_upload_spec.rb +++ b/spec/system/crud/csv_uploads/admin_views_csv_upload_spec.rb @@ -5,11 +5,11 @@ scenario "from list page" do csv_upload = FactoryBot.create(:csv_upload) - visit "/admin/csv_uploads" + visit "/crud/csv_uploads" click_on csv_upload.id.to_s expect(page).to have_css "h1", text: "CSV Upload #{csv_upload.id}" expect(page).to have_css "a", text: "CSV Upload List" - expect(current_path).to eq admin_csv_upload_path(csv_upload) + expect(current_path).to eq crud_csv_upload_path(csv_upload) end scenario "views CsvUpload" do @@ -20,7 +20,7 @@ parser_class_name: "DummyParser" ) - visit "/admin/csv_uploads/#{csv_upload.id}" + visit "/crud/csv_uploads/#{csv_upload.id}" actual_values = page.all("tr").map do |table_row| table_row.all("td").map(&:text) diff --git a/spec/system/csv_uploads/admin_views_csv_uploads_spec.rb b/spec/system/crud/csv_uploads/admin_views_csv_uploads_spec.rb similarity index 82% rename from spec/system/csv_uploads/admin_views_csv_uploads_spec.rb rename to spec/system/crud/csv_uploads/admin_views_csv_uploads_spec.rb index 55b8b74..7ee10c2 100644 --- a/spec/system/csv_uploads/admin_views_csv_uploads_spec.rb +++ b/spec/system/crud/csv_uploads/admin_views_csv_uploads_spec.rb @@ -7,24 +7,24 @@ visit "/dashboard" click_on "CSV Uploads" expect(page).to have_css "h1", text: "CSV Uploads" - expect(current_path).to eq admin_csv_uploads_path + expect(current_path).to eq crud_csv_uploads_path end scenario "with no records" do - visit "/admin/csv_uploads" + visit "/crud/csv_uploads" expect(page.all("tbody tr").count).to eq 0 end scenario "with a page of records" do FactoryBot.create_list(:csv_upload, 3) - visit "/admin/csv_uploads" + visit "/crud/csv_uploads" expect(page.all("tbody tr").count).to eq 3 expect(page).to_not have_css "nav.pagination" end scenario "with two pages of records" do FactoryBot.create_list(:csv_upload, 4) - visit "/admin/csv_uploads" + visit "/crud/csv_uploads" expect(page.all("tbody tr").count).to eq 3 expect(page).to have_css "nav.pagination" end diff --git a/spec/system/financial_accounts/admin_creates_financial_account_spec.rb b/spec/system/crud/financial_accounts/admin_creates_financial_account_spec.rb similarity index 75% rename from spec/system/financial_accounts/admin_creates_financial_account_spec.rb rename to spec/system/crud/financial_accounts/admin_creates_financial_account_spec.rb index a0cdbe3..9cf230a 100644 --- a/spec/system/financial_accounts/admin_creates_financial_account_spec.rb +++ b/spec/system/crud/financial_accounts/admin_creates_financial_account_spec.rb @@ -4,29 +4,29 @@ include_context "admin password matches" scenario "from list page" do - visit "/admin/financial_accounts" + visit "/crud/financial_accounts" click_on "New Financial Account" expect(page).to have_css "h1", text: "New Financial Account" expect(page).to have_css "a", text: "Financial Account List" - expect(current_path).to eq new_admin_financial_account_path + expect(current_path).to eq new_crud_financial_account_path end scenario "create with errors" do - visit "/admin/financial_accounts/new" + visit "/crud/financial_accounts/new" click_on "create" expect(page).to have_css ".alert", text: "Name can't be blank" - expect(current_path).to eq new_admin_financial_account_path + expect(current_path).to eq new_crud_financial_account_path end scenario "create successfully" do - visit "/admin/financial_accounts/new" + visit "/crud/financial_accounts/new" fill_in "name", with: "Brand new account" click_on "create" expect(page).to have_css ".notice", text: "Financial Account created" financial_account = FinancialAccount.last - expect(current_path).to eq admin_financial_account_path(financial_account) + expect(current_path).to eq crud_financial_account_path(financial_account) actual_values = page.all("tr").map do |table_row| table_row.all("td").map(&:text) diff --git a/spec/system/financial_accounts/admin_deletes_financial_account_spec.rb b/spec/system/crud/financial_accounts/admin_deletes_financial_account_spec.rb similarity index 67% rename from spec/system/financial_accounts/admin_deletes_financial_account_spec.rb rename to spec/system/crud/financial_accounts/admin_deletes_financial_account_spec.rb index 75a4c57..e27d444 100644 --- a/spec/system/financial_accounts/admin_deletes_financial_account_spec.rb +++ b/spec/system/crud/financial_accounts/admin_deletes_financial_account_spec.rb @@ -6,22 +6,22 @@ let(:financial_account) { FactoryBot.create(:financial_account) } scenario "cancels delete" do - visit "/admin/financial_accounts/#{financial_account.id}" + visit "/crud/financial_accounts/#{financial_account.id}" dismiss_confirm { click_on "Delete Financial Account" } expect(FinancialAccount.count).to eq 1 - expect(current_path).to eq admin_financial_account_path(financial_account) + expect(current_path).to eq crud_financial_account_path(financial_account) end scenario "confirms delete" do - visit "/admin/financial_accounts/#{financial_account.id}" + visit "/crud/financial_accounts/#{financial_account.id}" accept_confirm { click_on "Delete Financial Account" } expect(page).to have_css ".notice", text: "Financial Account deleted" expect(FinancialAccount.count).to eq 0 - expect(current_path).to eq admin_financial_accounts_path + expect(current_path).to eq crud_financial_accounts_path end end diff --git a/spec/system/financial_accounts/admin_edits_financial_account_spec.rb b/spec/system/crud/financial_accounts/admin_edits_financial_account_spec.rb similarity index 73% rename from spec/system/financial_accounts/admin_edits_financial_account_spec.rb rename to spec/system/crud/financial_accounts/admin_edits_financial_account_spec.rb index a6ca869..90dc36c 100644 --- a/spec/system/financial_accounts/admin_edits_financial_account_spec.rb +++ b/spec/system/crud/financial_accounts/admin_edits_financial_account_spec.rb @@ -5,16 +5,16 @@ scenario "from show page" do financial_account = FactoryBot.create(:financial_account) - visit "/admin/financial_accounts/#{financial_account.id}" + visit "/crud/financial_accounts/#{financial_account.id}" click_on "Edit Financial Account" expect(page).to have_css "h1", text: "Edit Financial Account #{financial_account.id}" expect(page).to have_css "a", text: "Show Financial Account" - expect(current_path).to eq edit_admin_financial_account_path(financial_account) + expect(current_path).to eq edit_crud_financial_account_path(financial_account) end scenario "edit with errors" do financial_account = FactoryBot.create(:financial_account) - visit "/admin/financial_accounts/#{financial_account.id}/edit" + visit "/crud/financial_accounts/#{financial_account.id}/edit" fill_in "name", with: "" click_on "update" expect(page).to have_css ".alert", text: "Name can't be blank" @@ -25,12 +25,12 @@ :financial_account, name: "Band new account" ) - visit "/admin/financial_accounts/#{financial_account.id}/edit" + visit "/crud/financial_accounts/#{financial_account.id}/edit" fill_in "name", with: "Brand new account" click_on "update" expect(page).to have_css ".notice", text: "Financial Account updated" - expect(current_path).to eq admin_financial_account_path(financial_account) + expect(current_path).to eq crud_financial_account_path(financial_account) expect(page).to have_css "td", text: "Brand new account" end end diff --git a/spec/system/financial_accounts/admin_views_financial_account_spec.rb b/spec/system/crud/financial_accounts/admin_views_financial_account_spec.rb similarity index 83% rename from spec/system/financial_accounts/admin_views_financial_account_spec.rb rename to spec/system/crud/financial_accounts/admin_views_financial_account_spec.rb index 409c616..a62908f 100644 --- a/spec/system/financial_accounts/admin_views_financial_account_spec.rb +++ b/spec/system/crud/financial_accounts/admin_views_financial_account_spec.rb @@ -5,11 +5,11 @@ scenario "from list page" do financial_account = FactoryBot.create(:financial_account) - visit "/admin/financial_accounts" + visit "/crud/financial_accounts" click_on financial_account.id.to_s expect(page).to have_css "h1", text: "Financial Account #{financial_account.id}" expect(page).to have_css "a", text: "Financial Account List" - expect(current_path).to eq admin_financial_account_path(financial_account) + expect(current_path).to eq crud_financial_account_path(financial_account) end scenario "viewing a record" do @@ -18,7 +18,7 @@ name: "Slush fund" ) - visit "/admin/financial_accounts/#{financial_account.id}" + visit "/crud/financial_accounts/#{financial_account.id}" actual_values = page.all("tr").map do |table_row| table_row.all("td").map(&:text) diff --git a/spec/system/financial_accounts/admin_views_financial_accounts_spec.rb b/spec/system/crud/financial_accounts/admin_views_financial_accounts_spec.rb similarity index 80% rename from spec/system/financial_accounts/admin_views_financial_accounts_spec.rb rename to spec/system/crud/financial_accounts/admin_views_financial_accounts_spec.rb index 498b903..97ca559 100644 --- a/spec/system/financial_accounts/admin_views_financial_accounts_spec.rb +++ b/spec/system/crud/financial_accounts/admin_views_financial_accounts_spec.rb @@ -7,24 +7,24 @@ visit "/dashboard" click_on "Financial Accounts" expect(page).to have_css "h1", text: "Financial Accounts" - expect(current_path).to eq admin_financial_accounts_path + expect(current_path).to eq crud_financial_accounts_path end scenario "with no records" do - visit "/admin/financial_accounts" + visit "/crud/financial_accounts" expect(page.all("tbody tr").count).to eq 0 end scenario "with a page of records" do FactoryBot.create_list(:financial_account, 3) - visit "/admin/financial_accounts" + visit "/crud/financial_accounts" expect(page.all("tbody tr").count).to eq 3 expect(page).to_not have_css "nav.pagination" end scenario "with two pages of records" do FactoryBot.create_list(:financial_account, 4) - visit "/admin/financial_accounts" + visit "/crud/financial_accounts" expect(page.all("tbody tr").count).to eq 3 expect(page).to have_css "nav.pagination" end diff --git a/spec/system/gift_ideas/admin_creates_gift_idea_spec.rb b/spec/system/crud/gift_ideas/admin_creates_gift_idea_spec.rb similarity index 82% rename from spec/system/gift_ideas/admin_creates_gift_idea_spec.rb rename to spec/system/crud/gift_ideas/admin_creates_gift_idea_spec.rb index a9099e9..82df5cb 100644 --- a/spec/system/gift_ideas/admin_creates_gift_idea_spec.rb +++ b/spec/system/crud/gift_ideas/admin_creates_gift_idea_spec.rb @@ -4,22 +4,22 @@ include_context "admin password matches" scenario "from list page" do - visit "/admin/gift_ideas" + visit "/crud/gift_ideas" click_on "New Gift Idea" expect(page).to have_css "h1", text: "New Gift Idea" expect(page).to have_css "a", text: "Gift Idea List" - expect(current_path).to eq new_admin_gift_idea_path + expect(current_path).to eq new_crud_gift_idea_path end scenario "create with errors" do - visit "/admin/gift_ideas/new" + visit "/crud/gift_ideas/new" click_on "create" expect(page).to have_css ".alert", text: "Title can't be blank and Website url can't be blank" - expect(current_path).to eq new_admin_gift_idea_path + expect(current_path).to eq new_crud_gift_idea_path end scenario "create successfully" do - visit "/admin/gift_ideas/new" + visit "/crud/gift_ideas/new" fill_in "title", with: "New Mario Game" fill_in "website", with: "https://www.nintendo.com/new-mario-game" fill_in "note", with: "Please get me the actual physical game, thanks!" @@ -28,7 +28,7 @@ expect(page).to have_css ".notice", text: "Gift Idea created" gift_idea = GiftIdea.last - expect(current_path).to eq admin_gift_idea_path(gift_idea) + expect(current_path).to eq crud_gift_idea_path(gift_idea) actual_values = page.all("tr").map do |table_row| table_row.all("td").map(&:text) diff --git a/spec/system/gift_ideas/admin_deletes_gift_idea_spec.rb b/spec/system/crud/gift_ideas/admin_deletes_gift_idea_spec.rb similarity index 69% rename from spec/system/gift_ideas/admin_deletes_gift_idea_spec.rb rename to spec/system/crud/gift_ideas/admin_deletes_gift_idea_spec.rb index 2bd770c..4c7f551 100644 --- a/spec/system/gift_ideas/admin_deletes_gift_idea_spec.rb +++ b/spec/system/crud/gift_ideas/admin_deletes_gift_idea_spec.rb @@ -6,22 +6,22 @@ let(:gift_idea) { FactoryBot.create(:gift_idea) } scenario "cancels delete" do - visit "/admin/gift_ideas/#{gift_idea.id}" + visit "/crud/gift_ideas/#{gift_idea.id}" dismiss_confirm { click_on "Delete Gift Idea" } expect(GiftIdea.count).to eq 1 - expect(current_path).to eq admin_gift_idea_path(gift_idea) + expect(current_path).to eq crud_gift_idea_path(gift_idea) end scenario "confirms delete" do - visit "/admin/gift_ideas/#{gift_idea.id}" + visit "/crud/gift_ideas/#{gift_idea.id}" accept_confirm { click_on "Delete Gift Idea" } expect(page).to have_css ".notice", text: "Gift Idea deleted" expect(GiftIdea.count).to eq 0 - expect(current_path).to eq admin_gift_ideas_path + expect(current_path).to eq crud_gift_ideas_path end end diff --git a/spec/system/gift_ideas/admin_edits_gift_idea_spec.rb b/spec/system/crud/gift_ideas/admin_edits_gift_idea_spec.rb similarity index 75% rename from spec/system/gift_ideas/admin_edits_gift_idea_spec.rb rename to spec/system/crud/gift_ideas/admin_edits_gift_idea_spec.rb index 4fc09ba..897ebc6 100644 --- a/spec/system/gift_ideas/admin_edits_gift_idea_spec.rb +++ b/spec/system/crud/gift_ideas/admin_edits_gift_idea_spec.rb @@ -5,16 +5,16 @@ scenario "from show page" do gift_idea = FactoryBot.create(:gift_idea) - visit "/admin/gift_ideas/#{gift_idea.id}" + visit "/crud/gift_ideas/#{gift_idea.id}" click_on "Edit Gift Idea" expect(page).to have_css "h1", text: "Edit Gift Idea #{gift_idea.id}" expect(page).to have_css "a", text: "Show Gift Idea" - expect(current_path).to eq edit_admin_gift_idea_path(gift_idea) + expect(current_path).to eq edit_crud_gift_idea_path(gift_idea) end scenario "edit with errors" do gift_idea = FactoryBot.create(:gift_idea) - visit "/admin/gift_ideas/#{gift_idea.id}/edit" + visit "/crud/gift_ideas/#{gift_idea.id}/edit" fill_in "title", with: "" click_on "update" expect(page).to have_css ".alert", text: "Title can't be blank" @@ -25,12 +25,12 @@ :gift_idea, title: "Mew Nario Game" ) - visit "/admin/gift_ideas/#{gift_idea.id}/edit" + visit "/crud/gift_ideas/#{gift_idea.id}/edit" fill_in "title", with: "New Mario Game" click_on "update" expect(page).to have_css ".notice", text: "Gift Idea updated" - expect(current_path).to eq admin_gift_idea_path(gift_idea) + expect(current_path).to eq crud_gift_idea_path(gift_idea) expect(page).to have_css "td", text: "New Mario Game" end end diff --git a/spec/system/gift_ideas/admin_views_gift_idea_spec.rb b/spec/system/crud/gift_ideas/admin_views_gift_idea_spec.rb similarity index 88% rename from spec/system/gift_ideas/admin_views_gift_idea_spec.rb rename to spec/system/crud/gift_ideas/admin_views_gift_idea_spec.rb index 5883f95..50e3d7e 100644 --- a/spec/system/gift_ideas/admin_views_gift_idea_spec.rb +++ b/spec/system/crud/gift_ideas/admin_views_gift_idea_spec.rb @@ -5,11 +5,11 @@ scenario "from list page" do gift_idea = FactoryBot.create(:gift_idea) - visit "/admin/gift_ideas" + visit "/crud/gift_ideas" click_on gift_idea.id.to_s expect(page).to have_css "h1", text: "Gift Idea #{gift_idea.id}" expect(page).to have_css "a", text: "Gift Idea List" - expect(current_path).to eq admin_gift_idea_path(gift_idea) + expect(current_path).to eq crud_gift_idea_path(gift_idea) end scenario "viewing a record" do @@ -20,7 +20,7 @@ note: "Please get me the actual physical game, thanks!" ) - visit "/admin/gift_ideas/#{gift_idea.id}" + visit "/crud/gift_ideas/#{gift_idea.id}" actual_values = page.all("tr").map do |table_row| table_row.all("td").map(&:text) diff --git a/spec/system/gift_ideas/admin_views_gift_ideas_spec.rb b/spec/system/crud/gift_ideas/admin_views_gift_ideas_spec.rb similarity index 83% rename from spec/system/gift_ideas/admin_views_gift_ideas_spec.rb rename to spec/system/crud/gift_ideas/admin_views_gift_ideas_spec.rb index 9ad47f1..5803344 100644 --- a/spec/system/gift_ideas/admin_views_gift_ideas_spec.rb +++ b/spec/system/crud/gift_ideas/admin_views_gift_ideas_spec.rb @@ -7,24 +7,24 @@ visit "/dashboard" click_on "Gift Ideas" expect(page).to have_css "h1", text: "Gift Ideas" - expect(current_path).to eq admin_gift_ideas_path + expect(current_path).to eq crud_gift_ideas_path end scenario "with no records" do - visit "/admin/gift_ideas" + visit "/crud/gift_ideas" expect(page.all("tbody tr").count).to eq 0 end scenario "with a page of records" do FactoryBot.create_list(:gift_idea, 3) - visit "/admin/gift_ideas" + visit "/crud/gift_ideas" expect(page.all("tbody tr").count).to eq 3 expect(page).to_not have_css "nav.pagination" end scenario "with two pages of records" do FactoryBot.create_list(:gift_idea, 4) - visit "/admin/gift_ideas" + visit "/crud/gift_ideas" expect(page.all("tbody tr").count).to eq 3 expect(page).to have_css "nav.pagination" end diff --git a/spec/system/projects/admin_creates_project_spec.rb b/spec/system/crud/projects/admin_creates_project_spec.rb similarity index 93% rename from spec/system/projects/admin_creates_project_spec.rb rename to spec/system/crud/projects/admin_creates_project_spec.rb index 97fe04c..41f440f 100644 --- a/spec/system/projects/admin_creates_project_spec.rb +++ b/spec/system/crud/projects/admin_creates_project_spec.rb @@ -4,7 +4,7 @@ include_context "admin password matches" scenario "creating first project" do - visit "/admin/projects" + visit "/crud/projects" click_on "Create Project" fill_in "project[name]", with: "First Project" click_on "Create" @@ -17,7 +17,7 @@ scenario "error on duplicate projects" do project = FactoryBot.create :project - visit "/admin/projects" + visit "/crud/projects" click_on "Create Project" fill_in "project[name]", with: project.name click_on "Create" diff --git a/spec/system/projects/admin_updates_project_spec.rb b/spec/system/crud/projects/admin_updates_project_spec.rb similarity index 94% rename from spec/system/projects/admin_updates_project_spec.rb rename to spec/system/crud/projects/admin_updates_project_spec.rb index b6b539c..873a83a 100644 --- a/spec/system/projects/admin_updates_project_spec.rb +++ b/spec/system/crud/projects/admin_updates_project_spec.rb @@ -8,7 +8,7 @@ project = FactoryBot.create :project FactoryBot.create :project, name: "Newer" - visit "/admin/projects" + visit "/crud/projects" project_item = page.find("li", text: project.name) project_item.click diff --git a/spec/system/projects/admin_views_projects_spec.rb b/spec/system/crud/projects/admin_views_projects_spec.rb similarity index 91% rename from spec/system/projects/admin_views_projects_spec.rb rename to spec/system/crud/projects/admin_views_projects_spec.rb index e98f874..d84fc0b 100644 --- a/spec/system/projects/admin_views_projects_spec.rb +++ b/spec/system/crud/projects/admin_views_projects_spec.rb @@ -4,7 +4,7 @@ include_context "admin password matches" scenario "with no projects" do - visit "/admin/projects" + visit "/crud/projects" expect(page).to have_content "No projects - create one!" end @@ -13,7 +13,7 @@ FactoryBot.create :project, name: "2nd", touched_at: 1.day.ago FactoryBot.create :project, name: "3rd", touched_at: Time.zone.now - visit "/admin/projects" + visit "/crud/projects" project_names = page.all("li .name").map(&:text) expect(project_names).to eq %w[2nd 3rd 1st] diff --git a/spec/system/raw_hooks/admin_views_raw_hook_spec.rb b/spec/system/crud/raw_hooks/admin_views_raw_hook_spec.rb similarity index 93% rename from spec/system/raw_hooks/admin_views_raw_hook_spec.rb rename to spec/system/crud/raw_hooks/admin_views_raw_hook_spec.rb index 140f005..1090948 100644 --- a/spec/system/raw_hooks/admin_views_raw_hook_spec.rb +++ b/spec/system/crud/raw_hooks/admin_views_raw_hook_spec.rb @@ -11,7 +11,7 @@ params: {key: "value"} ) - visit "/admin/raw_hooks/#{raw_hook.id}" + visit "/crud/raw_hooks/#{raw_hook.id}" expect(page).to have_content "Raw Hook #{raw_hook.id}"