Commit 3db127f3 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '3513-follow-up-from-simplify-specification-of-ee-license-plan-features' into 'master'

Fix NoMethodError: undefined method `>' for nil:NilClass in license.rb

Closes #3513

See merge request gitlab-org/gitlab-ee!2994
parents f699e474 ead1bb5e
...@@ -220,7 +220,7 @@ class License < ActiveRecord::Base ...@@ -220,7 +220,7 @@ class License < ActiveRecord::Base
end end
def features_from_add_ons 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 end
def features def features
......
...@@ -436,6 +436,14 @@ describe License do ...@@ -436,6 +436,14 @@ describe License do
expect(license.features_from_add_ons).to match_array([:deploy_board, :file_locks]) expect(license.features_from_add_ons).to match_array([:deploy_board, :file_locks])
end end
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 end
describe '#feature_available?' do 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