Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-04-05 15:29:48 +0300
committerRémy Coutable <remy@rymai.me>2017-04-14 16:20:55 +0300
commit0483019e9800dc1b4ef4493890f815f047b7c04e (patch)
tree24430c787a2e69166ccd214cc1e15a489f32e9e9 /spec/lib
parentebd5e9b4549ebc80155a5a8f139efdb40b6f8b12 (diff)
Port 'Add more usage data to EE ping' to CE
CE port of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/735
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/usage_data_spec.rb65
1 files changed, 65 insertions, 0 deletions
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb
new file mode 100644
index 00000000000..8d2f086f0f5
--- /dev/null
+++ b/spec/lib/gitlab/usage_data_spec.rb
@@ -0,0 +1,65 @@
+require 'spec_helper'
+
+describe Gitlab::UsageData do
+ let!(:project) { create(:empty_project) }
+ let!(:project2) { create(:empty_project) }
+ let!(:board) { create(:board, project: project) }
+
+ describe '#data' do
+ subject { Gitlab::UsageData.data }
+
+ it "gathers usage data" do
+ expect(subject.keys).to match_array(%i(
+ active_user_count
+ counts
+ version
+ recorded_at
+ ))
+ end
+
+ it "gathers usage counts" do
+ count_data = subject[:counts]
+
+ expect(count_data[:boards]).to eq(1)
+ expect(count_data[:projects]).to eq(2)
+
+ expect(count_data.keys).to match_array(%i(
+ boards
+ ci_builds
+ ci_pipelines
+ ci_runners
+ ci_triggers
+ deploy_keys
+ deployments
+ environments
+ groups
+ issues
+ keys
+ labels
+ lfs_objects
+ merge_requests
+ milestones
+ notes
+ projects
+ pushes
+ pages_domains
+ protected_branches
+ releases
+ services
+ snippets
+ todos
+ web_hooks
+ ))
+ end
+ end
+
+ describe '#license_usage_data' do
+ subject { Gitlab::UsageData.license_usage_data }
+
+ it "gathers license data" do
+ expect(subject[:version]).to eq(Gitlab::VERSION)
+ expect(subject[:active_user_count]).to eq(User.active.count)
+ expect(subject[:recorded_at]).to be_a(Time)
+ end
+ end
+end