module BillingErrorRescuer extend ActiveSupport::Concern included do rescue_from Billing::LimitExceeded, with: :rescue_billing_limits def rescue_billing_limits render status: 402, json: Billing::PlanPresenter.new(@account).to_json end end end require 'spec_helper' describe BillingErrorRescuer, type: :controller do controller do include BillingErrorRescuer def action @account = FactoryBot.create :a
![Concerns testing with anonymous controller - DEV Community 👩💻👨💻](https://cdn-ak-scissors.b.st-hatena.com/image/square/26f2cba4c0ee95c4da4ad7fe1f49833127b358cf/height=288;version=1;width=512/https%3A%2F%2Fdev.to%2Fsocial_previews%2Farticle%2F54316.png)