Skip to content

Commit

Permalink
update error message on /classifications/users when querying for all …
Browse files Browse the repository at this point in the history
…project contributions [ordered by desc count]. (no longer top projects) (#22)
  • Loading branch information
yuenmichelle1 authored Aug 1, 2023
1 parent 16807bb commit 45ec15b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/user_classification_count_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def query

def validate_params
super
raise ValidationError, 'Cannot query top projects and query by project/workflow' if params[:project_contributions] && (params[:workflow_id] || params[:project_id])
raise ValidationError, 'Cannot query for project contributions and query by project/workflow' if params[:project_contributions] && (params[:workflow_id] || params[:project_id])
end

def sanitize_params
Expand Down
4 changes: 2 additions & 2 deletions spec/controllers/user_classification_count_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@
it 'ensures you cannot query by workflow and project_contributions' do
get :query, params: { id: 1, project_contributions: true, workflow_id: 1 }
expect(response.status).to eq(400)
expect(response.body).to include('Cannot query top projects and query by project/workflow')
expect(response.body).to include('Cannot query for project contributions and query by project/workflow')
end

it 'ensures you cannot query by project and top project contributions' do
get :query, params: { id: 1, project_contributions: true, project_id: 1 }
expect(response.status).to eq(400)
expect(response.body).to include('Cannot query top projects and query by project/workflow')
expect(response.body).to include('Cannot query for project contributions and query by project/workflow')
end

it 'ensures project_contributions is an boolean' do
Expand Down

0 comments on commit 45ec15b

Please sign in to comment.