CCirbo / Little_Shop

1 stars 2 forks source link

Refactored merchant_items and merchant controller to give us 100% and added tests for them #99

Closed MDelarosa1993 closed 3 weeks ago

MDelarosa1993 commented 3 weeks ago
  1. MerchantItemsController:

    • Removed redundant merchant rendering in the show action.
  2. MerchantsController:

    • Added a find action that searches for a merchant by name, with proper error handling for missing parameters and case where no merchant is found.
    • Updated filter_by_name method to include case-insensitive search and return only the first matching merchant.
  3. Model Updates:

    • Enhanced the filter_by_name method to handle name filtering with case insensitivity.
  4. Tests:

    • Expanded test coverage for the find action, including scenarios for multiple matches, exact matches, and missing parameters.
    • Overall, these changes improve the handling of merchant searches and enhance error responses.
jimmacur commented 3 weeks ago

“Nice update to handle missing parameters and edge cases more gracefully. The added error handling with ArgumentError in find is a great improvement, and the tests ensure robustness.