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
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-16 14:01:10 +0300
committerJames Lopez <james@jameslopez.es>2016-11-17 10:22:59 +0300
commitcf2dcf043c0054785bc0258ab6393104499b8d70 (patch)
tree1502646c438eb383a82f73d5a62f2b19b38d954c /spec/lib/gitlab/cycle_analytics
parentcbc9f0cd1aa9f379952b6e4d3ad6df9971f9092a (diff)
Refactor all query config stuff into separate classes and added specs
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics')
-rw-r--r--spec/lib/gitlab/cycle_analytics/code_config_spec.rb10
-rw-r--r--spec/lib/gitlab/cycle_analytics/events_spec.rb6
-rw-r--r--spec/lib/gitlab/cycle_analytics/issue_config_spec.rb10
-rw-r--r--spec/lib/gitlab/cycle_analytics/plan_config_spec.rb10
-rw-r--r--spec/lib/gitlab/cycle_analytics/production_config_spec.rb10
-rw-r--r--spec/lib/gitlab/cycle_analytics/review_config_spec.rb10
-rw-r--r--spec/lib/gitlab/cycle_analytics/shared_config_spec.rb15
-rw-r--r--spec/lib/gitlab/cycle_analytics/staging_config_spec.rb10
-rw-r--r--spec/lib/gitlab/cycle_analytics/test_config_spec.rb10
9 files changed, 90 insertions, 1 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/code_config_spec.rb b/spec/lib/gitlab/cycle_analytics/code_config_spec.rb
new file mode 100644
index 00000000000..7b89fdd76aa
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/code_config_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+require 'lib/gitlab/cycle_analytics/shared_config_spec'
+
+describe Gitlab::CycleAnalytics::CodeConfig do
+ it_behaves_like 'default query config'
+
+ it 'has the default order' do
+ expect(described_class.order).not_to eq(described_class.start_time_attrs)
+ end
+end
diff --git a/spec/lib/gitlab/cycle_analytics/events_spec.rb b/spec/lib/gitlab/cycle_analytics/events_spec.rb
index d46e70e9ba2..aa0e54582f1 100644
--- a/spec/lib/gitlab/cycle_analytics/events_spec.rb
+++ b/spec/lib/gitlab/cycle_analytics/events_spec.rb
@@ -9,6 +9,8 @@ describe Gitlab::CycleAnalytics::Events do
subject { described_class.new(project: project, options: { from: from_date }) }
before do
+ allow_any_instance_of(Gitlab::ReferenceExtractor).to receive(:issues).and_return([context])
+
setup(context)
end
@@ -317,6 +319,8 @@ describe Gitlab::CycleAnalytics::Events do
def setup(context)
milestone = create(:milestone, project: project)
context.update(milestone: milestone)
- create_merge_request_closing_issue(context)
+ mr = create_merge_request_closing_issue(context)
+
+ ProcessCommitWorker.new.perform(project.id, user.id, mr.commits.last.sha)
end
end
diff --git a/spec/lib/gitlab/cycle_analytics/issue_config_spec.rb b/spec/lib/gitlab/cycle_analytics/issue_config_spec.rb
new file mode 100644
index 00000000000..ff8cd1e8068
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/issue_config_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+require 'lib/gitlab/cycle_analytics/shared_config_spec'
+
+describe Gitlab::CycleAnalytics::IssueConfig do
+ it_behaves_like 'default query config'
+
+ it 'has the default order' do
+ expect(described_class.order).to eq(described_class.start_time_attrs)
+ end
+end
diff --git a/spec/lib/gitlab/cycle_analytics/plan_config_spec.rb b/spec/lib/gitlab/cycle_analytics/plan_config_spec.rb
new file mode 100644
index 00000000000..92698defa5d
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/plan_config_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+require 'lib/gitlab/cycle_analytics/shared_config_spec'
+
+describe Gitlab::CycleAnalytics::PlanConfig do
+ it_behaves_like 'default query config'
+
+ it 'has the default order' do
+ expect(described_class.order).to eq(described_class.start_time_attrs)
+ end
+end
diff --git a/spec/lib/gitlab/cycle_analytics/production_config_spec.rb b/spec/lib/gitlab/cycle_analytics/production_config_spec.rb
new file mode 100644
index 00000000000..92485777334
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/production_config_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+require 'lib/gitlab/cycle_analytics/shared_config_spec'
+
+describe Gitlab::CycleAnalytics::ProductionConfig do
+ it_behaves_like 'default query config'
+
+ it 'has the default order' do
+ expect(described_class.order).to eq(described_class.start_time_attrs)
+ end
+end
diff --git a/spec/lib/gitlab/cycle_analytics/review_config_spec.rb b/spec/lib/gitlab/cycle_analytics/review_config_spec.rb
new file mode 100644
index 00000000000..59cb18ac16d
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/review_config_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+require 'lib/gitlab/cycle_analytics/shared_config_spec'
+
+describe Gitlab::CycleAnalytics::ReviewConfig do
+ it_behaves_like 'default query config'
+
+ it 'has the default order' do
+ expect(described_class.order).to eq(described_class.start_time_attrs)
+ end
+end
diff --git a/spec/lib/gitlab/cycle_analytics/shared_config_spec.rb b/spec/lib/gitlab/cycle_analytics/shared_config_spec.rb
new file mode 100644
index 00000000000..060a59151d8
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/shared_config_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+shared_examples 'default query config' do
+ it 'has the start attributes' do
+ expect(described_class.start_time_attrs).not_to be_nil
+ end
+
+ it 'has the end attributes' do
+ expect(described_class.end_time_attrs ).not_to be_nil
+ end
+
+ it 'has the projection attributes' do
+ expect(described_class.projections).not_to be_nil
+ end
+end
diff --git a/spec/lib/gitlab/cycle_analytics/staging_config_spec.rb b/spec/lib/gitlab/cycle_analytics/staging_config_spec.rb
new file mode 100644
index 00000000000..f13885d7f48
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/staging_config_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+require 'lib/gitlab/cycle_analytics/shared_config_spec'
+
+describe Gitlab::CycleAnalytics::StagingConfig do
+ it_behaves_like 'default query config'
+
+ it 'has the default order' do
+ expect(described_class.order).not_to eq(described_class.start_time_attrs)
+ end
+end
diff --git a/spec/lib/gitlab/cycle_analytics/test_config_spec.rb b/spec/lib/gitlab/cycle_analytics/test_config_spec.rb
new file mode 100644
index 00000000000..59421b99513
--- /dev/null
+++ b/spec/lib/gitlab/cycle_analytics/test_config_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+require 'lib/gitlab/cycle_analytics/shared_config_spec'
+
+describe Gitlab::CycleAnalytics::TestConfig do
+ it_behaves_like 'default query config'
+
+ it 'has the default order' do
+ expect(described_class.order).not_to eq(described_class.start_time_attrs)
+ end
+end