Files
sure/test/controllers/family_merchants_controller_test.rb
soky srm 12d2f4e36d Provider merchants enhancement (#1254)
* Add AI merchant enhancement and dedup

* Enhancements

Add error if job is already running
add note that we also merge merchants

* Allow updating provider website

* Review fixes

* Update provider_merchant.rb

* Linter and fixes

* FIX transaction quick menu modal
2026-03-23 12:34:43 +01:00

48 lines
1.2 KiB
Ruby

require "test_helper"
class FamilyMerchantsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in @user = users(:family_admin)
@merchant = merchants(:netflix)
end
test "index" do
get family_merchants_path
assert_response :success
end
test "new" do
get new_family_merchant_path
assert_response :success
end
test "should create merchant" do
assert_difference("FamilyMerchant.count") do
post family_merchants_url, params: { family_merchant: { name: "new merchant", color: "#000000" } }
end
assert_redirected_to family_merchants_path
end
test "should update merchant" do
patch family_merchant_url(@merchant), params: { family_merchant: { name: "new name", color: "#000000" } }
assert_redirected_to family_merchants_path
end
test "should destroy merchant" do
assert_difference("FamilyMerchant.count", -1) do
delete family_merchant_url(@merchant)
end
assert_redirected_to family_merchants_path
end
test "enhance enqueues job and redirects" do
assert_enqueued_with(job: EnhanceProviderMerchantsJob) do
post enhance_family_merchants_path
end
assert_redirected_to family_merchants_path
end
end