diff --git a/app/models/tenant_billing.rb b/app/models/tenant_billing.rb index a51b5048..b3bf59e0 100644 --- a/app/models/tenant_billing.rb +++ b/app/models/tenant_billing.rb @@ -17,7 +17,7 @@ class TenantBilling < ApplicationRecord ] def has_active_subscription? - perpetual? || (active? && subscription_ends_at+1.day > Time.current) || (canceled? && subscription_ends_at > Time.current) || (trial? && trial_ends_at > Time.current) + perpetual? || (active? && subscription_ends_at+1.day > Time.current) || (canceled? && subscription_ends_at > Time.current) || (trial? && trial_ends_at > Time.current) || Rails.application.multi_tenancy? == false end def generate_auth_token diff --git a/spec/models/tenant_billing_spec.rb b/spec/models/tenant_billing_spec.rb index fc614785..37867f0d 100644 --- a/spec/models/tenant_billing_spec.rb +++ b/spec/models/tenant_billing_spec.rb @@ -3,6 +3,11 @@ require 'rails_helper' RSpec.describe TenantBilling, type: :model do let(:tenant_billing) { FactoryBot.build(:tenant_billing) } + # Tenant Billing subscription works only in multi_tenancy mode + before do + allow(Rails.application).to receive(:multi_tenancy?).and_return(true) + end + it 'should be valid' do expect(tenant_billing).to be_valid end