mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Hotfix: self-hosted tenant must always have active subscription (#358)
This commit is contained in:
committed by
GitHub
parent
5e885d77ff
commit
3ee686b640
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user