diff options
Diffstat (limited to 'spec/lib/gitlab/usage_data_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index c29a4dd9e00..37d9c5389dd 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -269,4 +269,18 @@ describe Gitlab::UsageData, :aggregate_failures do it_behaves_like 'usage data execution' end + + describe '#alt_usage_data' do + it 'returns the fallback when it gets an error' do + expect(described_class.alt_usage_data { raise StandardError } ).to eq(-1) + end + + it 'returns the evaluated block when give' do + expect(described_class.alt_usage_data { Gitlab::CurrentSettings.uuid } ).to eq(Gitlab::CurrentSettings.uuid) + end + + it 'returns the value when given' do + expect(described_class.alt_usage_data(1)).to eq 1 + end + end end |