diff options
Diffstat (limited to 'spec/models/cycle_analytics')
-rw-r--r-- | spec/models/cycle_analytics/code_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/group_level_spec.rb | 44 | ||||
-rw-r--r-- | spec/models/cycle_analytics/issue_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/plan_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/production_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/project_level_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/review_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/staging_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/cycle_analytics/test_spec.rb | 2 |
9 files changed, 8 insertions, 52 deletions
diff --git a/spec/models/cycle_analytics/code_spec.rb b/spec/models/cycle_analytics/code_spec.rb index 441f8265629..f6ab8e0ece6 100644 --- a/spec/models/cycle_analytics/code_spec.rb +++ b/spec/models/cycle_analytics/code_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#code' do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } let_it_be(:project_level) { CycleAnalytics::ProjectLevel.new(project, options: { from: from_date }) } subject { project_level } diff --git a/spec/models/cycle_analytics/group_level_spec.rb b/spec/models/cycle_analytics/group_level_spec.rb deleted file mode 100644 index ac169ebc0cf..00000000000 --- a/spec/models/cycle_analytics/group_level_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe CycleAnalytics::GroupLevel do - let_it_be(:group) { create(:group)} - let_it_be(:project) { create(:project, :repository, namespace: group) } - let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } - let(:issue) { create(:issue, project: project, created_at: 2.days.ago) } - let_it_be(:milestone) { create(:milestone, project: project) } - let(:mr) { create_merge_request_closing_issue(user, project, issue, commit_message: "References #{issue.to_reference}") } - let(:pipeline) { create(:ci_empty_pipeline, status: 'created', project: project, ref: mr.source_branch, sha: mr.source_branch_sha, head_pipeline_of: mr) } - - subject { described_class.new(group: group, options: { from: from_date, current_user: user }) } - - describe '#permissions' do - it 'returns true for all stages' do - expect(subject.permissions.values.uniq).to eq([true]) - end - end - - describe '#stats' do - before do - create_cycle(user, project, issue, mr, milestone, pipeline) - deploy_master(user, project) - end - - it 'returns medians for each stage for a specific group' do - expect(subject.no_stats?).to eq(false) - end - end - - describe '#summary' do - before do - create_cycle(user, project, issue, mr, milestone, pipeline) - deploy_master(user, project) - end - - it 'returns medians for each stage for a specific group' do - expect(subject.summary.map { |summary| summary[:value] }).to contain_exactly('0.1', '1', '1') - end - end -end diff --git a/spec/models/cycle_analytics/issue_spec.rb b/spec/models/cycle_analytics/issue_spec.rb index 726f2f8b018..b4ab763e0e6 100644 --- a/spec/models/cycle_analytics/issue_spec.rb +++ b/spec/models/cycle_analytics/issue_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#issue' do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } let_it_be(:project_level) { CycleAnalytics::ProjectLevel.new(project, options: { from: from_date }) } subject { project_level } diff --git a/spec/models/cycle_analytics/plan_spec.rb b/spec/models/cycle_analytics/plan_spec.rb index 3bd9f317ca7..6765b2e2cbc 100644 --- a/spec/models/cycle_analytics/plan_spec.rb +++ b/spec/models/cycle_analytics/plan_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#plan' do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } let_it_be(:project_level) { CycleAnalytics::ProjectLevel.new(project, options: { from: from_date }) } subject { project_level } diff --git a/spec/models/cycle_analytics/production_spec.rb b/spec/models/cycle_analytics/production_spec.rb index 01d88bbeec9..2f2bcd63acd 100644 --- a/spec/models/cycle_analytics/production_spec.rb +++ b/spec/models/cycle_analytics/production_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#production' do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } let_it_be(:project_level) { CycleAnalytics::ProjectLevel.new(project, options: { from: from_date }) } subject { project_level } diff --git a/spec/models/cycle_analytics/project_level_spec.rb b/spec/models/cycle_analytics/project_level_spec.rb index 2fc81777746..bb296351a29 100644 --- a/spec/models/cycle_analytics/project_level_spec.rb +++ b/spec/models/cycle_analytics/project_level_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' describe CycleAnalytics::ProjectLevel do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } let_it_be(:issue) { create(:issue, project: project, created_at: 2.days.ago) } let_it_be(:milestone) { create(:milestone, project: project) } let(:mr) { create_merge_request_closing_issue(user, project, issue, commit_message: "References #{issue.to_reference}") } diff --git a/spec/models/cycle_analytics/review_spec.rb b/spec/models/cycle_analytics/review_spec.rb index 50670188e85..25e8f1441d3 100644 --- a/spec/models/cycle_analytics/review_spec.rb +++ b/spec/models/cycle_analytics/review_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#review' do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } subject { CycleAnalytics::ProjectLevel.new(project, options: { from: from_date }) } diff --git a/spec/models/cycle_analytics/staging_spec.rb b/spec/models/cycle_analytics/staging_spec.rb index cf0695f175a..effbc7056cc 100644 --- a/spec/models/cycle_analytics/staging_spec.rb +++ b/spec/models/cycle_analytics/staging_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#staging' do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } let_it_be(:project_level) { CycleAnalytics::ProjectLevel.new(project, options: { from: from_date }) } subject { project_level } diff --git a/spec/models/cycle_analytics/test_spec.rb b/spec/models/cycle_analytics/test_spec.rb index 24800aafca7..7e7ba4d9994 100644 --- a/spec/models/cycle_analytics/test_spec.rb +++ b/spec/models/cycle_analytics/test_spec.rb @@ -7,7 +7,7 @@ describe 'CycleAnalytics#test' do let_it_be(:project) { create(:project, :repository) } let_it_be(:from_date) { 10.days.ago } - let_it_be(:user) { create(:user, :admin) } + let_it_be(:user) { project.owner } let_it_be(:issue) { create(:issue, project: project) } let_it_be(:project_level) { CycleAnalytics::ProjectLevel.new(project, options: { from: from_date }) } let!(:merge_request) { create_merge_request_closing_issue(user, project, issue) } |