Commit ead1bb5e authored by Toon Claes's avatar Toon Claes Committed by Toon Claes

Fix for when add-on count is `nil`

parent 89432f1d
......@@ -220,7 +220,7 @@ class License < ActiveRecord::Base
end
def features_from_add_ons
add_ons.map { |name, count| FEATURES_FOR_ADD_ONS[name] if count > 0 }.compact
add_ons.map { |name, count| FEATURES_FOR_ADD_ONS[name] if count.to_i > 0 }.compact
end
def features
......
......@@ -436,6 +436,14 @@ describe License do
expect(license.features_from_add_ons).to match_array([:deploy_board, :file_locks])
end
end
context 'with nil add-ons' do
it 'returns an empty array' do
license = build_license_with_add_ons({ 'GitLab_DeployBoard' => nil, 'GitLab_FileLocks' => nil })
expect(license.features_from_add_ons).to eq([])
end
end
end
describe '#feature_available?' do
......
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