diff options
author | James Lopez <james@jameslopez.es> | 2016-11-02 16:21:49 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 08:22:56 +0100 |
commit | 9ead268cfaee7cb23fa00c7cf8bcf536cafab91a (patch) | |
tree | 752fcc1bba376437565e70ab822a176bb795e46b /spec/requests/projects | |
parent | 85c448d76f382538898344b07b2c635c7215ca7b (diff) | |
download | gitlab-ce-9ead268cfaee7cb23fa00c7cf8bcf536cafab91a.tar.gz |
some more integration scenarios testing order. Also, fixed bug in the staging and test stages.
Diffstat (limited to 'spec/requests/projects')
-rw-r--r-- | spec/requests/projects/cycle_analytics_events_spec.rb | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/spec/requests/projects/cycle_analytics_events_spec.rb b/spec/requests/projects/cycle_analytics_events_spec.rb index 51db9bb07fa..e2733be4c3a 100644 --- a/spec/requests/projects/cycle_analytics_events_spec.rb +++ b/spec/requests/projects/cycle_analytics_events_spec.rb @@ -3,66 +3,95 @@ require 'spec_helper' describe 'cycle analytics events' do let(:user) { create(:user) } let(:project) { create(:project) } - let!(:issue) { create(:issue, project: project, created_at: 2.days.ago) } describe 'GET /:namespace/:project/cycle_analytics/events/issues' do before do project.team << [user, :developer] - milestone = create(:milestone, project: project) - issue.update(milestone: milestone) - create_merge_request_closing_issue(issue) - - merge_merge_requests_closing_issue(issue) + 3.times { create_cycle } deploy_master login_as(user) end - it 'lists the issue events' do + it 'lists the issue events in the right order' do get namespace_project_cycle_analytics_issue_path(project.namespace, project, format: :json) expect(json_response['events']).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) end - it 'lists the plan events' do + it 'lists the plan events in the right order' do get namespace_project_cycle_analytics_plan_path(project.namespace, project, format: :json) expect(json_response['events']).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']) + + expect(first_date).to be > last_date end - it 'lists the code events' do + it 'lists the code events in the right order' do get namespace_project_cycle_analytics_code_path(project.namespace, project, format: :json) expect(json_response['events']).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) end - it 'lists the test events' do + it 'lists the test events in the right order' do get namespace_project_cycle_analytics_test_path(project.namespace, project, format: :json) expect(json_response['events']).not_to be_empty + + # TODO create builds end - it 'lists the review events' do + it 'lists the review events in the right order' do get namespace_project_cycle_analytics_review_path(project.namespace, project, format: :json) expect(json_response['events']).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) end - it 'lists the staging events' do + it 'lists the staging events in the right order' do get namespace_project_cycle_analytics_staging_path(project.namespace, project, format: :json) expect(json_response['events']).not_to be_empty + + # TODO create builds end - it 'lists the production events' do + it 'lists the production events in the right order' do get namespace_project_cycle_analytics_production_path(project.namespace, project, format: :json) expect(json_response['events']).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) end end def json_response JSON.parse(response.body) end + + def create_cycle + issue = create(:issue, project: project, created_at: 2.days.ago) + milestone = create(:milestone, project: project) + issue.update(milestone: milestone) + + create_merge_request_closing_issue(issue) + merge_merge_requests_closing_issue(issue) + end end |