diff options
Diffstat (limited to 'spec/lib')
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 |