From d5840ddb0ce3fa861d10e2e4f7be6ab42cb3763d Mon Sep 17 00:00:00 2001 From: "Benjamin Randolphgit config --global user.email neb417@gmail.comgit config --global init.defaultBranch maingit config --global core.editor atom" Date: Mon, 9 Oct 2023 09:18:26 -0600 Subject: [PATCH] Remove unused code and return index to update for tests that put/patch --- app/controllers/fixed_expenses_controller.rb | 1 - .../controllers/fixed_expense_controller.js | 26 +------------------ spec/requests/fixed_expenses_spec.rb | 2 +- spec/routing/fixed_expenses_routing_spec.rb | 4 +-- spec/routing/incomes_routing_spec.rb | 4 +-- 5 files changed, 6 insertions(+), 31 deletions(-) diff --git a/app/controllers/fixed_expenses_controller.rb b/app/controllers/fixed_expenses_controller.rb index 36d22df..df5ab48 100644 --- a/app/controllers/fixed_expenses_controller.rb +++ b/app/controllers/fixed_expenses_controller.rb @@ -57,7 +57,6 @@ def destroy @fixed_expenses = FixedExpense.get_ordered respond_to do |format| format.html { redirect_to fixed_expenses_path, notice: "Fixed expense was successfully destroyed." } - # format.turbo_stream { render turbo_stream: turbo_stream.remove(@fixed_expense) } format.turbo_stream end end diff --git a/app/javascript/controllers/fixed_expense_controller.js b/app/javascript/controllers/fixed_expense_controller.js index e35e972..a18a9f0 100644 --- a/app/javascript/controllers/fixed_expense_controller.js +++ b/app/javascript/controllers/fixed_expense_controller.js @@ -2,29 +2,5 @@ import { Controller } from "@hotwired/stimulus" // import { get } from "@rails/request.js" export default class extends Controller { - static targets = [ "fixedTotals" ] - updateTotals(event) { - const data = Object.fromEntries(new FormData(event.target).entries()) - console.log(data) - console.log(data["fixed_expense[amount]"]) - console.log(data["fixed_expense[frequency]"]) - console.log(this.fixedTotalsTarget) - let amount = data["fixed_expense[amount]"] - let frequency = data["fixed_expense[frequency]"] - // get(`/fixed_expenses/total_expenses?`) - } -} - - -// export default class extends Controller { -// static targets = ["monthlyPaymentDisplay"] -// -// homeDataUpdate(event){ -// let homeId = event.target.selectedOptions[0].value -// let target = this.monthlyPaymentDisplayTarget.id -// get(`/recurring_payments/monthly_payment?home=${homeId}&target=${target}`,{ -// responseKind: "turbo-stream" -// }) -// } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/spec/requests/fixed_expenses_spec.rb b/spec/requests/fixed_expenses_spec.rb index 4bf6298..60e1224 100644 --- a/spec/requests/fixed_expenses_spec.rb +++ b/spec/requests/fixed_expenses_spec.rb @@ -83,7 +83,7 @@ end end - describe "PATCH /index" do + describe "PATCH /update" do context "with valid parameters" do let(:new_attributes) { skip("Add a hash of attributes valid for your model") diff --git a/spec/routing/fixed_expenses_routing_spec.rb b/spec/routing/fixed_expenses_routing_spec.rb index 991d33a..83c5a26 100644 --- a/spec/routing/fixed_expenses_routing_spec.rb +++ b/spec/routing/fixed_expenses_routing_spec.rb @@ -22,11 +22,11 @@ expect(post: "/fixed_expenses").to route_to("fixed_expenses#create") end - it "routes to #index via PUT" do + it "routes to #update via PUT" do expect(put: "/fixed_expenses/1").to route_to("fixed_expenses#update", id: "1") end - it "routes to #index via PATCH" do + it "routes to #update via PATCH" do expect(patch: "/fixed_expenses/1").to route_to("fixed_expenses#update", id: "1") end diff --git a/spec/routing/incomes_routing_spec.rb b/spec/routing/incomes_routing_spec.rb index 870f01b..d03193f 100644 --- a/spec/routing/incomes_routing_spec.rb +++ b/spec/routing/incomes_routing_spec.rb @@ -22,11 +22,11 @@ expect(post: "/incomes").to route_to("incomes#create") end - it "routes to #index via PUT" do + it "routes to #update via PUT" do expect(put: "/incomes/1").to route_to("incomes#update", id: "1") end - it "routes to #index via PATCH" do + it "routes to #update via PATCH" do expect(patch: "/incomes/1").to route_to("incomes#update", id: "1") end