From 0a32aba4ae56964db896a036a95c9686db5116a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:43:56 -0500 Subject: [PATCH] Bump rubocop-rails from 2.28.0 to 2.29.0 (#1190) * Bump rubocop-rails from 2.28.0 to 2.29.0 Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.28.0 to 2.29.0. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.28.0...v2.29.0) --- updated-dependencies: - dependency-name: rubocop-rails dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Migrate over to :expect instead of :require. This has uncovered some errors in tests. We have also this "parent_id" / "parent_try_number" that may be something we can remove. * Finished migration to expects, tries_controller fusses so ignoring that one place. --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eric Pugh --- Gemfile.lock | 16 +++----- .../javascripts/services/settingsSvc.js | 2 +- .../admin/announcements_controller.rb | 2 +- .../admin/communal_scorers_controller.rb | 18 ++++---- app/controllers/admin/users_controller.rb | 14 +++---- .../ai_judges/prompts_controller.rb | 4 +- .../api/v1/annotations_controller.rb | 16 ++++---- app/controllers/api/v1/books_controller.rb | 4 +- .../api/v1/case_metadata_controller.rb | 2 +- .../api/v1/case_scores_controller.rb | 3 ++ app/controllers/api/v1/cases_controller.rb | 2 +- .../api/v1/clone/tries_controller.rb | 12 +++--- .../api/v1/judgements_controller.rb | 2 +- .../api/v1/queries/notes_controller.rb | 2 +- .../api/v1/queries/options_controller.rb | 2 +- .../api/v1/queries/ratings_controller.rb | 2 +- app/controllers/api/v1/queries_controller.rb | 2 +- .../api/v1/query_doc_pairs_controller.rb | 4 +- app/controllers/api/v1/scorers_controller.rb | 14 +++---- .../api/v1/search_endpoints_controller.rb | 6 +-- app/controllers/api/v1/signups_controller.rb | 12 +++--- app/controllers/api/v1/teams_controller.rb | 2 +- app/controllers/api/v1/tries_controller.rb | 41 ++++++++++--------- app/controllers/api/v1/users_controller.rb | 8 ++-- app/controllers/books_controller.rb | 8 ++-- app/controllers/judgements_controller.rb | 2 +- app/controllers/profiles_controller.rb | 2 +- app/controllers/query_doc_pairs_controller.rb | 2 +- .../search_endpoints_controller.rb | 10 ++--- app/controllers/sessions_controller.rb | 2 +- .../users/invitations_controller.rb | 16 ++++---- app/controllers/users/signups_controller.rb | 14 +++---- .../api/v1/cases_controller_test.rb | 2 +- .../api/v1/queries/options_controller_test.rb | 2 +- .../api/v1/tries_controller_test.rb | 2 +- 35 files changed, 127 insertions(+), 127 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 132f95a1a..b9011d9bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -136,8 +136,8 @@ GEM cmdstan (0.4.0) csv colorize (1.1.0) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) crack (1.0.0) bigdecimal rexml @@ -195,7 +195,6 @@ GEM faraday (>= 1, < 3) faraday-net_http (3.4.0) net-http (>= 0.5.0) - ffi (1.17.1-aarch64-linux-gnu) ffi (1.17.1-x86_64-darwin) ffi (1.17.1-x86_64-linux-gnu) foreman (0.88.1) @@ -211,7 +210,7 @@ GEM hashie (5.0.0) heapy (0.2.0) thor - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) importmap-rails (2.1.0) actionpack (>= 6.0.0) @@ -255,7 +254,7 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) local_time (3.0.2) - logger (1.6.4) + logger (1.6.5) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -306,8 +305,6 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.4) - nokogiri (1.18.1-aarch64-linux-gnu) - racc (~> 1.4) nokogiri (1.18.1-x86_64-darwin) racc (~> 1.4) nokogiri (1.18.1-x86_64-linux-gnu) @@ -343,7 +340,7 @@ GEM orm_adapter (0.5.0) ostruct (0.6.1) parallel (1.26.3) - parser (3.3.6.0) + parser (3.3.7.0) ast (~> 2.4.1) racc postmark (1.25.1) @@ -445,7 +442,7 @@ GEM parser (>= 3.3.1.0) rubocop-capybara (2.21.0) rubocop (~> 1.41) - rubocop-rails (2.28.0) + rubocop-rails (2.29.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) @@ -539,7 +536,6 @@ GEM zeitwerk (2.7.1) PLATFORMS - aarch64-linux x86_64-darwin-22 x86_64-linux diff --git a/app/assets/javascripts/services/settingsSvc.js b/app/assets/javascripts/services/settingsSvc.js index a415f4cf3..23641fd27 100644 --- a/app/assets/javascripts/services/settingsSvc.js +++ b/app/assets/javascripts/services/settingsSvc.js @@ -503,7 +503,7 @@ angular.module('QuepidApp') var payloadSearchEndpoint = {}; payload.try = payloadTry; payload.search_endpoint = payloadSearchEndpoint; - payload.parent_try_number = settingsToSave.selectedTry.tryNo; + payload.parent_try_number = settingsToSave.selectedTry.tryNo; // track the parent try for ancestry payload.curator_vars = settingsToSave.selectedTry.curatorVarsDict(); // We create the default name on the server side diff --git a/app/controllers/admin/announcements_controller.rb b/app/controllers/admin/announcements_controller.rb index 405c5d5ec..7c6a8c0f5 100644 --- a/app/controllers/admin/announcements_controller.rb +++ b/app/controllers/admin/announcements_controller.rb @@ -55,7 +55,7 @@ def publish private def announcement_params - params.require(:announcement).permit(:text, :author_id) + params.expect(announcement: [ :text, :author_id ]) end end end diff --git a/app/controllers/admin/communal_scorers_controller.rb b/app/controllers/admin/communal_scorers_controller.rb index 9d0a1e39d..93ffc8352 100644 --- a/app/controllers/admin/communal_scorers_controller.rb +++ b/app/controllers/admin/communal_scorers_controller.rb @@ -82,15 +82,15 @@ def destroy def scorer_params return unless params[:scorer] - params.require(:scorer).permit( - :code, - :name, - :communal, - :show_scale_labels, - :scale_list, # alternate approach to the scale:[] array used in admin only - :state, - scale: [], - scale_with_labels: {} + params.expect( + scorer: [ :code, + :name, + :communal, + :show_scale_labels, + :scale_list, # alternate approach to the scale:[] array used in admin only + :state, + { scale: [], + scale_with_labels: {} } ] ) end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index ffa617cb5..5fb580191 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -132,13 +132,13 @@ def set_user # Never trust parameters from the scary internet, only allow the permitted list through. def user_params - params.require(:user).permit( - :administrator, - :email, - :name, - :company, - :password, - :password_confirmation + params.expect( + user: [ :administrator, + :email, + :name, + :company, + :password, + :password_confirmation ] ) end end diff --git a/app/controllers/ai_judges/prompts_controller.rb b/app/controllers/ai_judges/prompts_controller.rb index caafde7af..f16cc39f6 100644 --- a/app/controllers/ai_judges/prompts_controller.rb +++ b/app/controllers/ai_judges/prompts_controller.rb @@ -41,8 +41,8 @@ def ai_judge_params end def query_doc_pair_params - params.require(:query_doc_pair).permit(:document_fields, :position, :query_text, :doc_id, :notes, - :information_need, options: {}) + params.expect(query_doc_pair: [ :document_fields, :position, :query_text, :doc_id, :notes, + :information_need, { options: {} } ]) end end end diff --git a/app/controllers/api/v1/annotations_controller.rb b/app/controllers/api/v1/annotations_controller.rb index 99caea9e2..1ce598846 100644 --- a/app/controllers/api/v1/annotations_controller.rb +++ b/app/controllers/api/v1/annotations_controller.rb @@ -60,18 +60,18 @@ def set_annotation end def annotation_params - params.require(:annotation).permit( - :message, - :source + params.expect( + annotation: [ :message, + :source ] ) end def score_params - params.require(:score).permit( - :all_rated, - :score, - :try_id, - queries: [] + params.expect( + score: [ :all_rated, + :score, + :try_id, + { queries: [] } ] ) end end diff --git a/app/controllers/api/v1/books_controller.rb b/app/controllers/api/v1/books_controller.rb index 5ccc8c719..a48b54b18 100644 --- a/app/controllers/api/v1/books_controller.rb +++ b/app/controllers/api/v1/books_controller.rb @@ -127,8 +127,8 @@ def destroy private def book_params - params.require(:book).permit(:scorer_id, :selection_strategy_id, :name, :support_implicit_judgements, - :show_rank) + params.expect(book: [ :scorer_id, :selection_strategy_id, :name, :support_implicit_judgements, + :show_rank ]) end def set_book diff --git a/app/controllers/api/v1/case_metadata_controller.rb b/app/controllers/api/v1/case_metadata_controller.rb index c25582455..db853fef8 100644 --- a/app/controllers/api/v1/case_metadata_controller.rb +++ b/app/controllers/api/v1/case_metadata_controller.rb @@ -19,7 +19,7 @@ def update private def metadata_params - params.require(:metadata).permit(:last_viewed_at) + params.expect(metadata: [ :last_viewed_at ]) end end end diff --git a/app/controllers/api/v1/case_scores_controller.rb b/app/controllers/api/v1/case_scores_controller.rb index 98776196d..ee7373e6e 100644 --- a/app/controllers/api/v1/case_scores_controller.rb +++ b/app/controllers/api/v1/case_scores_controller.rb @@ -60,6 +60,8 @@ def update private + # rubocop:disable Rails/StrongParametersExpect + # tried to migrate and had no love. def score_params params.require(:case_score).permit( :score, @@ -69,6 +71,7 @@ def score_params queries: [ :text, :score, :maxScore, :numFound ] ) end + # rubocop:enable Rails/StrongParametersExpect end end end diff --git a/app/controllers/api/v1/cases_controller.rb b/app/controllers/api/v1/cases_controller.rb index 8e22f77ee..a125ff461 100644 --- a/app/controllers/api/v1/cases_controller.rb +++ b/app/controllers/api/v1/cases_controller.rb @@ -113,7 +113,7 @@ def destroy private def case_params - params.require(:case).permit(:case_name, :scorer_id, :archived, :book_id, :last_try_number, :nightly) + params.expect(case: [ :case_name, :scorer_id, :archived, :book_id, :last_try_number, :nightly ]) end def default_scorer_removed? params = {} diff --git a/app/controllers/api/v1/clone/tries_controller.rb b/app/controllers/api/v1/clone/tries_controller.rb index 214675a0c..b0b67ff4d 100644 --- a/app/controllers/api/v1/clone/tries_controller.rb +++ b/app/controllers/api/v1/clone/tries_controller.rb @@ -47,12 +47,12 @@ def set_try end def try_params - params.require(:try).permit( - :name, - :field_spec, - :query_params, - :escape_query, - :number_of_rows + params.expect( + try: [ :name, + :field_spec, + :query_params, + :escape_query, + :number_of_rows ] ) end end diff --git a/app/controllers/api/v1/judgements_controller.rb b/app/controllers/api/v1/judgements_controller.rb index 107439df8..855fd6052 100644 --- a/app/controllers/api/v1/judgements_controller.rb +++ b/app/controllers/api/v1/judgements_controller.rb @@ -109,7 +109,7 @@ def destroy private def judgement_params - params.require(:judgement).permit(:rating, :unrateable, :query_doc_pair_id, :user_id, :explanation) + params.expect(judgement: [ :rating, :unrateable, :query_doc_pair_id, :user_id, :explanation ]) end def set_judgement diff --git a/app/controllers/api/v1/queries/notes_controller.rb b/app/controllers/api/v1/queries/notes_controller.rb index c675cfbac..168605579 100644 --- a/app/controllers/api/v1/queries/notes_controller.rb +++ b/app/controllers/api/v1/queries/notes_controller.rb @@ -20,7 +20,7 @@ def update private def query_params - params.require(:query).permit(:notes, :information_need) + params.expect(query: [ :notes, :information_need ]) end end end diff --git a/app/controllers/api/v1/queries/options_controller.rb b/app/controllers/api/v1/queries/options_controller.rb index a7d009745..21bcacd9d 100644 --- a/app/controllers/api/v1/queries/options_controller.rb +++ b/app/controllers/api/v1/queries/options_controller.rb @@ -20,7 +20,7 @@ def update private def query_params - params.require(:query).permit(options: {}) + params.expect(query: [ options: {} ]) end end end diff --git a/app/controllers/api/v1/queries/ratings_controller.rb b/app/controllers/api/v1/queries/ratings_controller.rb index 114643244..56098d60d 100644 --- a/app/controllers/api/v1/queries/ratings_controller.rb +++ b/app/controllers/api/v1/queries/ratings_controller.rb @@ -30,7 +30,7 @@ def destroy private def rating_params - params.require(:rating).permit(:rating, :doc_id) + params.expect(rating: [ :rating, :doc_id ]) end def set_doc_id diff --git a/app/controllers/api/v1/queries_controller.rb b/app/controllers/api/v1/queries_controller.rb index 6b2d695de..487a1012c 100644 --- a/app/controllers/api/v1/queries_controller.rb +++ b/app/controllers/api/v1/queries_controller.rb @@ -91,7 +91,7 @@ def destroy private def query_params - params.require(:query).permit(:query_text, :information_need, :notes, options: {}) + params.expect(query: [ :query_text, :information_need, :notes, { options: {} } ]) end end end diff --git a/app/controllers/api/v1/query_doc_pairs_controller.rb b/app/controllers/api/v1/query_doc_pairs_controller.rb index 7d144b330..21a6ee39a 100644 --- a/app/controllers/api/v1/query_doc_pairs_controller.rb +++ b/app/controllers/api/v1/query_doc_pairs_controller.rb @@ -102,8 +102,8 @@ def destroy private def query_doc_pair_params - params.require(:query_doc_pair).permit(:document_fields, :position, :query_text, :doc_id, :notes, - :information_need, options: {}) + params.expect(query_doc_pair: [ :document_fields, :position, :query_text, :doc_id, :notes, + :information_need, { options: {} } ]) end def set_query_doc_pair diff --git a/app/controllers/api/v1/scorers_controller.rb b/app/controllers/api/v1/scorers_controller.rb index 8d130dccc..d658a31f0 100644 --- a/app/controllers/api/v1/scorers_controller.rb +++ b/app/controllers/api/v1/scorers_controller.rb @@ -151,13 +151,13 @@ def destroy def scorer_params return unless params[:scorer] - params.require(:scorer).permit( - :code, - :name, - :show_scale_labels, - :communal, - scale: [], - scale_with_labels: {} + params.expect( + scorer: [ :code, + :name, + :show_scale_labels, + :communal, + { scale: [], + scale_with_labels: {} } ] ) end diff --git a/app/controllers/api/v1/search_endpoints_controller.rb b/app/controllers/api/v1/search_endpoints_controller.rb index 55df1ee03..8bfdbb564 100644 --- a/app/controllers/api/v1/search_endpoints_controller.rb +++ b/app/controllers/api/v1/search_endpoints_controller.rb @@ -110,9 +110,9 @@ def set_search_endpoint end def search_endpoint_params - params.require(:search_endpoint).permit(:api_method, :archived, :basic_auth_credential, :custom_headers, - :endpoint_url, :mapper_code, :name, :proxy_requests, :search_engine, - options: {}) + params.expect(search_endpoint: [ :api_method, :archived, :basic_auth_credential, :custom_headers, + :endpoint_url, :mapper_code, :name, :proxy_requests, :search_engine, + { options: {} } ]) end end end diff --git a/app/controllers/api/v1/signups_controller.rb b/app/controllers/api/v1/signups_controller.rb index 834d31bc7..4bc183a01 100644 --- a/app/controllers/api/v1/signups_controller.rb +++ b/app/controllers/api/v1/signups_controller.rb @@ -36,12 +36,12 @@ def create private def user_params - params.require(:user).permit( - :name, - :email, - :password, - :agreed, - :email_marketing + params.expect( + user: [ :name, + :email, + :password, + :agreed, + :email_marketing ] ) end end diff --git a/app/controllers/api/v1/teams_controller.rb b/app/controllers/api/v1/teams_controller.rb index 17edb34e0..f9ef92615 100644 --- a/app/controllers/api/v1/teams_controller.rb +++ b/app/controllers/api/v1/teams_controller.rb @@ -57,7 +57,7 @@ def destroy private def team_params - params.require(:team).permit(:name) + params.expect(team: [ :name ]) end end end diff --git a/app/controllers/api/v1/tries_controller.rb b/app/controllers/api/v1/tries_controller.rb index c22f79b93..285aeb372 100644 --- a/app/controllers/api/v1/tries_controller.rb +++ b/app/controllers/api/v1/tries_controller.rb @@ -60,11 +60,12 @@ def show def create try_parameters_to_use = try_params - if params[:parent_try_number] # We need special translation from try_number to the try.id + if params[:parent_try_number] + # Look up the parent try to maintain the chain of ancestry. try_parameters_to_use[:parent_id] = @case.tries.where(try_number: params[:parent_try_number]).first.id end - @try = @case.tries.build try_parameters_to_use + @try = @case.tries.build try_parameters_to_use.except(:parent_try_number) # if we are creating a new try with an existing search_endpoint_id, # then the params[:search_endpoint] will be empty @@ -160,15 +161,15 @@ def set_try end def try_params - params.require(:try).permit( - :escape_query, - :field_spec, - :name, - :number_of_rows, - :query_params, - :parent_id, - :parent_try_number, - :search_endpoint_id + params.expect( + try: [ :escape_query, + :field_spec, + :name, + :number_of_rows, + :query_params, + :parent_id, + :parent_try_number, + :search_endpoint_id ] ) end @@ -176,15 +177,15 @@ def search_endpoint_params # we do not REQUIRE a search_endpoint on a try return {} if params[:search_endpoint].nil? - params.require(:search_endpoint).permit( - :name, - :api_method, - :custom_headers, - :search_engine, - :endpoint_url, - :basic_auth_credential, - :mapper_code, - :proxy_requests + params.expect( + search_endpoint: [ :name, + :api_method, + :custom_headers, + :search_engine, + :endpoint_url, + :basic_auth_credential, + :mapper_code, + :proxy_requests ] ) end end diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 4e1f5b3bf..764f8fa90 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -49,10 +49,10 @@ def set_user end def user_params - params.require(:user).permit( - :completed_case_wizard, - :company, - :default_scorer_id + params.expect( + user: [ :completed_case_wizard, + :company, + :default_scorer_id ] ) end diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index 9472816ff..47743e257 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -309,10 +309,10 @@ def find_user end def book_params - params_to_use = params.require(:book).permit(:scorer_id, :selection_strategy_id, :name, - :support_implicit_judgements, :link_the_case, :origin_case_id, - :delete_export_file, :delete_populate_file, :delete_import_file, - :show_rank, team_ids: [], ai_judge_ids: []) + params_to_use = params.expect(book: [ :scorer_id, :selection_strategy_id, :name, + :support_implicit_judgements, :link_the_case, :origin_case_id, + :delete_export_file, :delete_populate_file, :delete_import_file, + :show_rank, { team_ids: [], ai_judge_ids: [] } ]) # Crafting a book[team_ids] parameter from the AngularJS side didn't work, so using top level parameter params_to_use[:team_ids] = params[:team_ids] if params[:team_ids] diff --git a/app/controllers/judgements_controller.rb b/app/controllers/judgements_controller.rb index ef093d597..03c893496 100644 --- a/app/controllers/judgements_controller.rb +++ b/app/controllers/judgements_controller.rb @@ -134,6 +134,6 @@ def set_judgement end def judgement_params - params.require(:judgement).permit(:user_id, :rating, :query_doc_pair_id, :unrateable, :explanation) + params.expect(judgement: [ :user_id, :rating, :query_doc_pair_id, :unrateable, :explanation ]) end end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index cda369986..f3deba106 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -19,6 +19,6 @@ def update private def user_params - params.require(:user).permit(:name, :email, :company, :email_marketing) + params.expect(user: [ :name, :email, :company, :email_marketing ]) end end diff --git a/app/controllers/query_doc_pairs_controller.rb b/app/controllers/query_doc_pairs_controller.rb index 7211363e4..8ce95596b 100644 --- a/app/controllers/query_doc_pairs_controller.rb +++ b/app/controllers/query_doc_pairs_controller.rb @@ -47,6 +47,6 @@ def set_query_doc_pair end def query_doc_pair_params - params.require(:query_doc_pair).permit(:query_text, :position, :document_fields, :doc_id) + params.expect(query_doc_pair: [ :query_text, :position, :document_fields, :doc_id ]) end end diff --git a/app/controllers/search_endpoints_controller.rb b/app/controllers/search_endpoints_controller.rb index 7d6ccc189..7e8544c2f 100644 --- a/app/controllers/search_endpoints_controller.rb +++ b/app/controllers/search_endpoints_controller.rb @@ -73,10 +73,10 @@ def set_search_endpoint end def search_endpoint_params - params.require(:search_endpoint).permit(:name, :endpoint_url, :search_engine, :custom_headers, - :api_method, :archived, - :basic_auth_credential, :mapper_code, :proxy_requests, - :options, - team_ids: []) + params.expect(search_endpoint: [ :name, :endpoint_url, :search_engine, :custom_headers, + :api_method, :archived, + :basic_auth_credential, :mapper_code, :proxy_requests, + :options, + { team_ids: [] } ]) end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 75287e46d..d7c338d2b 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -76,6 +76,6 @@ def login email, password end def user_params - params.require(:user).permit(:email, :password) + params.expect(user: [ :email, :password ]) end end diff --git a/app/controllers/users/invitations_controller.rb b/app/controllers/users/invitations_controller.rb index b40c419d0..17cd6b2f0 100644 --- a/app/controllers/users/invitations_controller.rb +++ b/app/controllers/users/invitations_controller.rb @@ -33,14 +33,14 @@ def update private def update_resource_params - params.require(:user).permit( - :name, - :email, - :invitation_token, - :password, - :password_confirmation, - :agreed, - :email_marketing + params.expect( + user: [ :name, + :email, + :invitation_token, + :password, + :password_confirmation, + :agreed, + :email_marketing ] ) end end diff --git a/app/controllers/users/signups_controller.rb b/app/controllers/users/signups_controller.rb index 6f3bd4d41..a1430a8e2 100644 --- a/app/controllers/users/signups_controller.rb +++ b/app/controllers/users/signups_controller.rb @@ -33,13 +33,13 @@ def create private def user_params - params.require(:user).permit( - :name, - :email, - :password, - :password_confirmation, - :agreed, - :email_marketing + params.expect( + user: [ :name, + :email, + :password, + :password_confirmation, + :agreed, + :email_marketing ] ) end end diff --git a/test/controllers/api/v1/cases_controller_test.rb b/test/controllers/api/v1/cases_controller_test.rb index a8cc3f54e..5a6cd0c31 100644 --- a/test/controllers/api/v1/cases_controller_test.rb +++ b/test/controllers/api/v1/cases_controller_test.rb @@ -34,7 +34,7 @@ class CasesControllerTest < ActionController::TestCase end test 'requires a case name' do - post :create, params: { case: { name: '' } } + post :create, params: { case: { case_name: '' } } assert_response :bad_request diff --git a/test/controllers/api/v1/queries/options_controller_test.rb b/test/controllers/api/v1/queries/options_controller_test.rb index 62b818595..75448e3fb 100644 --- a/test/controllers/api/v1/queries/options_controller_test.rb +++ b/test/controllers/api/v1/queries/options_controller_test.rb @@ -61,7 +61,7 @@ class OptionsControllerTest < ActionController::TestCase test 'posts event' do expects_any_ga_event_call - options = "{ foo: 'bar' }" + options = JSON.parse('{ "foo": "bar" }') perform_enqueued_jobs do put :update, params: { case_id: acase.id, query_id: query.id, query: { options: options } } diff --git a/test/controllers/api/v1/tries_controller_test.rb b/test/controllers/api/v1/tries_controller_test.rb index 904cdd5da..ed3363f78 100644 --- a/test/controllers/api/v1/tries_controller_test.rb +++ b/test/controllers/api/v1/tries_controller_test.rb @@ -374,7 +374,7 @@ def assert_curator_vars_equal vars, response_vars test 'updates search endpoint' do try = the_case.tries.first post :create, - params: { case_id: the_case.id, try: { try_number: try.try_number }, + params: { case_id: the_case.id, try: { parent_try_number: try.try_number }, search_endpoint: { search_engine: 'os', search_url: 'http://my.os.url' } } assert_response :ok