From 75cdddc6cae264062317d3a784712b8bb4b7ae3b Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Thu, 2 May 2024 13:24:23 -0400 Subject: [PATCH] Fix Merchants controller (#704) * Add climate_control gem and test helper * Replace ENV mods in upgrades test * Replace ENV mods in registrations test * Remove ENV references in hostings controller * Update ENV refs in mailer test * ActiveStorage cleanup * Consolidate queue config so appropriate adapter runs in test environment * Make test environment more explicit * Centralize self hosting config * Remove flaky system test * Fix merchants controller actions --- .../transactions/merchants_controller.rb | 14 ++++---------- config/locales/views/transaction/en.yml | 2 -- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/controllers/transactions/merchants_controller.rb b/app/controllers/transactions/merchants_controller.rb index 2d0dd2ce..2025a6d0 100644 --- a/app/controllers/transactions/merchants_controller.rb +++ b/app/controllers/transactions/merchants_controller.rb @@ -10,22 +10,16 @@ class Transactions::MerchantsController < ApplicationController end def create - if Current.family.transaction_merchants.create(merchant_params) - redirect_to transaction_merchants_path, notice: t(".success") - else - render transaction_merchants_path, status: :unprocessable_entity, notice: t(".error") - end + Current.family.transaction_merchants.create!(merchant_params) + redirect_to transaction_merchants_path, notice: t(".success") end def edit end def update - if @merchant.update(merchant_params) - redirect_to transaction_merchants_path, notice: t(".success") - else - render transaction_merchants_path, status: :unprocessable_entity, notice: t(".error") - end + @merchant.update!(merchant_params) + redirect_to transaction_merchants_path, notice: t(".success") end def destroy diff --git a/config/locales/views/transaction/en.yml b/config/locales/views/transaction/en.yml index 2f4de9df..12e2e841 100644 --- a/config/locales/views/transaction/en.yml +++ b/config/locales/views/transaction/en.yml @@ -59,7 +59,6 @@ en: edit_categories: Edit categories merchants: create: - error: Error creating merchant success: New merchant created successfully destroy: success: Merchant deleted successfully @@ -84,7 +83,6 @@ en: new: title: New merchant update: - error: Error updating merchant success: Merchant updated successfully update: success: Transaction updated successfully