summaryrefslogtreecommitdiff
path: root/spec/requests/projects
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-04 17:14:35 +0100
committerJames Lopez <james@jameslopez.es>2016-11-17 08:22:57 +0100
commit449a9fb1f16ff8b0d4328c4ebd26018dcd6fce36 (patch)
tree5fc9e361f1f72ca34d6d7c29580ca89237e37a64 /spec/requests/projects
parentf59b8afc8212ba1da34913b15e25769dc4cc37db (diff)
downloadgitlab-ce-449a9fb1f16ff8b0d4328c4ebd26018dcd6fce36.tar.gz
fixed integration spec after big refactoring of fields per stage
Diffstat (limited to 'spec/requests/projects')
-rw-r--r--spec/requests/projects/cycle_analytics_events_spec.rb56
1 files changed, 33 insertions, 23 deletions
diff --git a/spec/requests/projects/cycle_analytics_events_spec.rb b/spec/requests/projects/cycle_analytics_events_spec.rb
index 9884df3f110..c0b6a97c202 100644
--- a/spec/requests/projects/cycle_analytics_events_spec.rb
+++ b/spec/requests/projects/cycle_analytics_events_spec.rb
@@ -14,71 +14,78 @@ describe 'cycle analytics events' do
login_as(user)
end
- it 'lists the issue events in the right order' do
+ it 'lists the issue events' do
get namespace_project_cycle_analytics_issue_path(project.namespace, project, format: :json)
- expect(json_response['events']).not_to be_empty
+ expect(json_response['issues']).not_to be_empty
first_issue_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s
- expect(json_response['events'].first['iid']).to eq(first_issue_iid)
+ expect(json_response['issues'].first['iid']).to eq(first_issue_iid)
end
- it 'lists the plan events in the right order' do
+ it 'lists the plan events' do
get namespace_project_cycle_analytics_plan_path(project.namespace, project, format: :json)
- expect(json_response['events']).not_to be_empty
+ expect(json_response['commits']).not_to be_empty
- first_date = DateTime.parse(json_response['events'].first['commit']['authored_date'])
- last_date = DateTime.parse(json_response['events'].last['commit']['authored_date'])
+ commits = []
- expect(first_date).to be > last_date
+ MergeRequest.all.each do |mr|
+ mr.merge_request_diff.st_commits.each do |commit|
+ commits << { date: commit[:authored_date], sha: commit[:id] }
+ end
+ end
+
+ newest_sha = commits.sort_by { |k| k['date'] }.first[:sha][0...8]
+
+ expect(json_response['commits'].first['sha']).to eq(newest_sha)
end
- it 'lists the code events in the right order' do
+ it 'lists the code events' do
get namespace_project_cycle_analytics_code_path(project.namespace, project, format: :json)
- expect(json_response['events']).not_to be_empty
+ expect(json_response['merge_requests']).not_to be_empty
first_mr_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s
- expect(json_response['events'].first['iid']).to eq(first_mr_iid)
+ expect(json_response['merge_requests'].first['iid']).to eq(first_mr_iid)
end
- it 'lists the test events in the right order' do
+ it 'lists the test events' do
get namespace_project_cycle_analytics_test_path(project.namespace, project, format: :json)
- expect(json_response['events']).not_to be_empty
+ expect(json_response['builds']).not_to be_empty
- expect(json_response['events'].first['pipeline']).not_to be_empty
+ expect(json_response['builds'].first['date']).not_to be_empty
end
- it 'lists the review events in the right order' do
+ it 'lists the review events' do
get namespace_project_cycle_analytics_review_path(project.namespace, project, format: :json)
- expect(json_response['events']).not_to be_empty
+ expect(json_response['merge_requests']).not_to be_empty
first_mr_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s
- expect(json_response['events'].first['iid']).to eq(first_mr_iid)
+ expect(json_response['merge_requests'].first['iid']).to eq(first_mr_iid)
end
- it 'lists the staging events in the right order' do
+ it 'lists the staging events' do
get namespace_project_cycle_analytics_staging_path(project.namespace, project, format: :json)
- expect(json_response['events']).not_to be_empty
+ expect(json_response['builds']).not_to be_empty
- expect(json_response['events'].first['pipeline']).not_to be_empty
+ expect(json_response['builds'].first['date']).not_to be_empty
end
- it 'lists the production events in the right order' do
+ it 'lists the production events' do
get namespace_project_cycle_analytics_production_path(project.namespace, project, format: :json)
- expect(json_response['events']).not_to be_empty
+ expect(json_response['issues']).not_to be_empty
first_issue_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s
- expect(json_response['events'].first['iid']).to eq(first_issue_iid)
+ expect(json_response['issues'].first['iid']).to eq(first_issue_iid)
end
end
@@ -95,6 +102,9 @@ describe 'cycle analytics events' do
pipeline = create(:ci_empty_pipeline, status: 'created', project: project, ref: mr.source_branch, sha: mr.source_branch_sha)
pipeline.run
+ create(:ci_build, pipeline: pipeline, status: :success, author: user)
+ create(:ci_build, pipeline: pipeline, status: :success, author: user)
+
merge_merge_requests_closing_issue(issue)
end
end