diff options
author | James Lopez <james@jameslopez.es> | 2016-11-07 12:08:18 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 10:22:57 +0300 |
commit | 192918cde949c8399d7d526a638f6e09f9fb7a5a (patch) | |
tree | 678d29be77beb72e782e713b8dcfddf9c93023d1 /spec/requests | |
parent | b4bb33c5b7f30dedbb56f4b9f7dbc9fd58d4bdb9 (diff) |
refactored duplicated code in controller, updated JSON array naming and fixed specs
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/projects/cycle_analytics_events_spec.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/requests/projects/cycle_analytics_events_spec.rb b/spec/requests/projects/cycle_analytics_events_spec.rb index c0b6a97c202..d57e0342544 100644 --- a/spec/requests/projects/cycle_analytics_events_spec.rb +++ b/spec/requests/projects/cycle_analytics_events_spec.rb @@ -17,17 +17,17 @@ describe 'cycle analytics events' do it 'lists the issue events' do get namespace_project_cycle_analytics_issue_path(project.namespace, project, format: :json) - expect(json_response['issues']).not_to be_empty + expect(json_response['items']).not_to be_empty first_issue_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s - expect(json_response['issues'].first['iid']).to eq(first_issue_iid) + expect(json_response['items'].first['iid']).to eq(first_issue_iid) end it 'lists the plan events' do get namespace_project_cycle_analytics_plan_path(project.namespace, project, format: :json) - expect(json_response['commits']).not_to be_empty + expect(json_response['items']).not_to be_empty commits = [] @@ -39,53 +39,53 @@ describe 'cycle analytics events' do newest_sha = commits.sort_by { |k| k['date'] }.first[:sha][0...8] - expect(json_response['commits'].first['sha']).to eq(newest_sha) + expect(json_response['items'].first['sha']).to eq(newest_sha) end it 'lists the code events' do get namespace_project_cycle_analytics_code_path(project.namespace, project, format: :json) - expect(json_response['merge_requests']).not_to be_empty + expect(json_response['items']).not_to be_empty first_mr_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s - expect(json_response['merge_requests'].first['iid']).to eq(first_mr_iid) + expect(json_response['items'].first['iid']).to eq(first_mr_iid) end it 'lists the test events' do get namespace_project_cycle_analytics_test_path(project.namespace, project, format: :json) - expect(json_response['builds']).not_to be_empty + expect(json_response['items']).not_to be_empty - expect(json_response['builds'].first['date']).not_to be_empty + expect(json_response['items'].first['date']).not_to be_empty end it 'lists the review events' do get namespace_project_cycle_analytics_review_path(project.namespace, project, format: :json) - expect(json_response['merge_requests']).not_to be_empty + expect(json_response['items']).not_to be_empty first_mr_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s - expect(json_response['merge_requests'].first['iid']).to eq(first_mr_iid) + expect(json_response['items'].first['iid']).to eq(first_mr_iid) end it 'lists the staging events' do get namespace_project_cycle_analytics_staging_path(project.namespace, project, format: :json) - expect(json_response['builds']).not_to be_empty + expect(json_response['items']).not_to be_empty - expect(json_response['builds'].first['date']).not_to be_empty + expect(json_response['items'].first['date']).not_to be_empty end it 'lists the production events' do get namespace_project_cycle_analytics_production_path(project.namespace, project, format: :json) - expect(json_response['issues']).not_to be_empty + expect(json_response['items']).not_to be_empty first_issue_iid = Issue.order(created_at: :desc).pluck(:iid).first.to_s - expect(json_response['issues'].first['iid']).to eq(first_issue_iid) + expect(json_response['items'].first['iid']).to eq(first_issue_iid) end end |