diff options
Diffstat (limited to 'spec/lib/service_ping')
-rw-r--r-- | spec/lib/service_ping/build_payload_spec.rb | 31 | ||||
-rw-r--r-- | spec/lib/service_ping/permit_data_categories_spec.rb | 20 |
2 files changed, 3 insertions, 48 deletions
diff --git a/spec/lib/service_ping/build_payload_spec.rb b/spec/lib/service_ping/build_payload_spec.rb index 6cce07262b2..b10c9fd5bc0 100644 --- a/spec/lib/service_ping/build_payload_spec.rb +++ b/spec/lib/service_ping/build_payload_spec.rb @@ -14,35 +14,6 @@ RSpec.describe ServicePing::BuildPayload do end end - context 'when usage_ping_enabled setting is false' do - before do - # Gitlab::CurrentSettings.usage_ping_enabled? == false - stub_config_setting(usage_ping_enabled: false) - end - - it 'returns empty service ping payload' do - expect(service_ping_payload).to eq({}) - end - end - - context 'when usage_ping_enabled setting is true' do - before do - # Gitlab::CurrentSettings.usage_ping_enabled? == true - stub_config_setting(usage_ping_enabled: true) - end - - it_behaves_like 'complete service ping payload' - - context 'with require stats consent enabled' do - before do - allow(User).to receive(:single_user) - .and_return(instance_double(User, :user, requires_usage_stats_consent?: true)) - end - - it 'returns empty service ping payload' do - expect(service_ping_payload).to eq({}) - end - end - end + it_behaves_like 'complete service ping payload' end end diff --git a/spec/lib/service_ping/permit_data_categories_spec.rb b/spec/lib/service_ping/permit_data_categories_spec.rb index d1027a6f1ab..a4b88531205 100644 --- a/spec/lib/service_ping/permit_data_categories_spec.rb +++ b/spec/lib/service_ping/permit_data_categories_spec.rb @@ -19,26 +19,10 @@ RSpec.describe ServicePing::PermitDataCategories do end context 'when usage ping setting is set to false' do - before do - allow(User).to receive(:single_user) - .and_return(instance_double(User, :user, requires_usage_stats_consent?: false)) + it 'returns all categories' do stub_config_setting(usage_ping_enabled: false) - end - - it 'returns no categories' do - expect(permitted_categories).to match_array([]) - end - end - context 'when User.single_user&.requires_usage_stats_consent? is required' do - before do - allow(User).to receive(:single_user) - .and_return(instance_double(User, :user, requires_usage_stats_consent?: true)) - stub_config_setting(usage_ping_enabled: true) - end - - it 'returns no categories' do - expect(permitted_categories).to match_array([]) + expect(permitted_categories).to match_array(%w[standard subscription operational optional]) end end end |