Fix License.feature_available? when license table does not exist

parent e1f31849
...@@ -204,6 +204,8 @@ class License < ActiveRecord::Base ...@@ -204,6 +204,8 @@ class License < ActiveRecord::Base
end end
def load_license def load_license
return unless ActiveRecord::Base.connection.table_exists?(:licenses)
license = self.last license = self.last
return unless license && license.valid? return unless license && license.valid?
......
...@@ -271,6 +271,17 @@ describe License do ...@@ -271,6 +271,17 @@ describe License do
end end
describe ".current" do describe ".current" do
context 'when licenses table does not exist' do
before do
allow(ActiveRecord::Base.connection).to receive(:table_exists?)
.with(:licenses).and_return(false)
end
it 'returns nil' do
expect(described_class.current).to be_nil
end
end
context "when there is no license" do context "when there is no license" do
let!(:license) { nil } let!(:license) { nil }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment