From 63d0a00c58e9962be780bcb93668288f4233aebf Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Sun, 15 Sep 2019 15:38:52 +0300 Subject: [PATCH] Upgrade to Rails 5.0 Closes #377 --- .codeclimate.yml | 1 - .travis.yml | 2 - Gemfile | 3 +- Gemfile.lock | 218 +-- app/controllers/admin/contacts_controller.rb | 7 +- .../admin/domains/force_delete_controller.rb | 2 +- app/controllers/api/cors_controller.rb | 2 +- app/controllers/api/v1/base_controller.rb | 2 - .../api/v1/registrant/auth_controller.rb | 3 +- .../api/v1/registrant/base_controller.rb | 1 - app/controllers/application_controller.rb | 2 +- app/controllers/epp/base_controller.rb | 1 - .../registrant/contacts_controller.rb | 5 + .../registrar/contacts_controller.rb | 7 + .../registrar/domains_controller.rb | 44 +- .../registrar/sessions_controller.rb | 4 +- .../registrar/xml_consoles_controller.rb | 2 +- app/models/account.rb | 2 +- app/models/account_activity.rb | 2 +- app/models/action.rb | 2 +- app/models/api_log/db.rb | 2 +- app/models/application_record.rb | 3 + app/models/auction.rb | 2 +- app/models/bank_statement.rb | 2 +- app/models/bank_transaction.rb | 2 +- app/models/billing/price.rb | 2 +- app/models/blocked_domain.rb | 2 +- app/models/certificate.rb | 2 +- app/models/concerns/domain/force_delete.rb | 2 +- app/models/concerns/epp_errors.rb | 2 +- app/models/contact.rb | 10 +- app/models/directo.rb | 2 +- app/models/dns/zone.rb | 4 +- app/models/dnskey.rb | 2 +- app/models/domain.rb | 10 +- app/models/domain_contact.rb | 2 +- app/models/domain_status.rb | 2 +- app/models/domain_transfer.rb | 2 +- app/models/epp/contact.rb | 2 +- app/models/epp/domain.rb | 2 +- app/models/epp_session.rb | 2 +- app/models/invoice.rb | 4 +- app/models/invoice_item.rb | 2 +- app/models/legal_document.rb | 2 +- app/models/nameserver.rb | 2 +- app/models/notification.rb | 2 +- app/models/que_job.rb | 2 +- app/models/registrant_verification.rb | 4 +- app/models/registrar.rb | 2 +- app/models/reserved_domain.rb | 2 +- app/models/type/vat_rate.rb | 4 +- app/models/user.rb | 2 +- app/models/white_ip.rb | 2 +- app/models/whois/server.rb | 2 +- app/models/whois_record.rb | 2 +- .../admin/contacts/partials/_domains.haml | 3 +- .../contacts/show/_domains.html.erb | 5 +- .../registrar/contacts/partials/_domains.haml | 3 +- .../registrar/domains/_search_form.html.erb | 6 +- bin/rails | 2 +- bin/setup | 4 +- bin/update | 29 + config/application.rb | 40 +- config/boot.rb | 5 +- config/cable.yml | 9 + config/environment.rb | 2 +- config/environments/production.rb | 63 +- config/environments/test.rb | 22 +- .../application_controller_renderer.rb | 8 + config/initializers/assets.rb | 18 +- config/initializers/cookies_serializer.rb | 2 + config/initializers/new_framework_defaults.rb | 25 + config/initializers/wrap_parameters.rb | 4 +- config/puma.rb | 23 +- config/secrets.yml | 22 + db/structure.sql | 1216 ++++++----------- lib/action_controller/api.rb | 149 -- lib/action_controller/api/api_rendering.rb | 16 - .../metal/basic_implicit_render.rb | 13 - lib/rails5_api_controller_backport.rb | 3 - test/application_system_test_case.rb | 2 +- .../integration/admin_area/registrars_test.rb | 2 +- test/integration/admin_area/zones_test.rb | 2 +- test/integration/api/domain_contacts_test.rb | 66 +- test/integration/api/domain_transfers_test.rb | 43 +- test/integration/api/nameservers/put_test.rb | 74 +- .../registrant_api_authentication_test.rb | 8 +- .../registrant_api_contacts_test.rb | 15 +- .../registrant_api_cors_headers_test.rb | 13 +- .../registrant/registrant_api_domains_test.rb | 21 +- .../registrant_api_registry_locks_test.rb | 21 +- .../api/v1/auctions/details_test.rb | 6 +- test/integration/api/v1/auctions/list_test.rb | 6 +- .../api/v1/auctions/update_test.rb | 60 +- .../v1/registrant/contacts/details_test.rb | 18 +- .../api/v1/registrant/contacts/list_test.rb | 10 +- .../api/v1/registrant/contacts/update_test.rb | 112 +- test/integration/epp/base_test.rb | 15 +- test/integration/epp/contact/base_test.rb | 3 +- .../epp/contact/check/base_test.rb | 12 +- .../epp/contact/create/base_test.rb | 9 +- .../epp/contact/delete/base_test.rb | 8 +- .../integration/epp/contact/info/base_test.rb | 3 +- .../epp/contact/transfer/base_test.rb | 3 +- .../epp/contact/update/base_test.rb | 23 +- test/integration/epp/domain/base_test.rb | 3 +- .../epp/domain/check/auction_test.rb | 15 +- .../integration/epp/domain/check/base_test.rb | 24 +- .../epp/domain/create/auction_idn_test.rb | 18 +- .../epp/domain/create/auction_test.rb | 21 +- .../epp/domain/create/base_test.rb | 24 +- .../epp/domain/delete/base_test.rb | 14 +- test/integration/epp/domain/info/base_test.rb | 12 +- .../integration/epp/domain/renew/base_test.rb | 22 +- .../epp/domain/transfer/query_test.rb | 9 +- .../epp/domain/transfer/request_test.rb | 41 +- .../epp/domain/update/base_test.rb | 27 +- test/integration/epp/hello_test.rb | 3 +- .../integration/epp/login/credentials_test.rb | 6 +- .../epp/login/password_change_test.rb | 3 +- .../epp/login/session_limit_test.rb | 6 +- test/integration/epp/logout_test.rb | 12 +- test/integration/epp/poll_test.rb | 18 +- .../registrant_area/sign_in/id_card_test.rb | 8 +- .../invoices/payment_callback_test.rb | 2 +- .../invoices/payment_return_test.rb | 8 +- .../settings/balance_auto_reload_test.rb | 4 +- .../registrar_area/sign_in/id_card_test.rb | 13 +- test/learning/paper_trail_test.rb | 4 +- test/models/contact/disclosable_test.rb | 2 +- test/models/contact_test.rb | 10 +- .../domain/releasable/auctionable_test.rb | 2 +- test/models/domain_test.rb | 4 +- test/support/rails5_assertions.rb | 2 + .../registrant_area/contacts/update_test.rb | 6 +- .../bulk_change/bulk_transfer_test.rb | 4 +- .../bulk_change/nameserver_test.rb | 4 +- .../bulk_change/tech_contact_test.rb | 2 +- .../convert_domain_delete_date_test.rb | 2 +- test/tasks/invoices/cancel_overdue_test.rb | 2 +- test/test_helper.rb | 17 +- 141 files changed, 1368 insertions(+), 1660 deletions(-) create mode 100644 app/models/application_record.rb create mode 100644 bin/update create mode 100644 config/cable.yml create mode 100644 config/initializers/application_controller_renderer.rb create mode 100644 config/initializers/new_framework_defaults.rb create mode 100644 config/secrets.yml delete mode 100644 lib/action_controller/api.rb delete mode 100644 lib/action_controller/api/api_rendering.rb delete mode 100644 lib/action_controller/metal/basic_implicit_render.rb delete mode 100644 lib/rails5_api_controller_backport.rb diff --git a/.codeclimate.yml b/.codeclimate.yml index 3802e689be..02617274a8 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -28,7 +28,6 @@ exclude_patterns: - "bin/" - "config/" - "db/" - - "lib/action_controller/" - "lib/core_ext/" - "lib/daemons/" - "lib/gem_ext/" diff --git a/.travis.yml b/.travis.yml index 460122e122..dcb988d67b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,6 @@ before_script: - "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter" - "chmod +x ./cc-test-reporter" - "./cc-test-reporter before-build" -script: - - "bundle exec rake test" after_script: - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT" services: diff --git a/Gemfile b/Gemfile index 948d1185ae..5497cb79f1 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,7 @@ source 'https://rubygems.org' # core gem 'iso8601', '0.8.6' # for dates and times -gem 'rails', '4.2.11.1' # when update, all initializers eis_custom files needs check/update +gem 'rails', '~> 5.0.7' gem 'rest-client' gem 'uglifier' @@ -66,7 +66,6 @@ gem 'daemons-rails', '1.2.1' gem 'que-web' gem 'pdfkit' gem 'jquery-ui-rails', '5.0.5' -gem 'active_model-errors_details' # Backport from Rails 5, https://github.com/rails/rails/pull/18322 gem 'airbrake' gem 'company_register', github: 'internetee/company_register', branch: :master diff --git a/Gemfile.lock b/Gemfile.lock index 9445b7f3d9..9027ccd5dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,10 +19,10 @@ GIT GIT remote: https://github.com/internetee/epp-xml.git - revision: 5dd542e67ef26d58365f30e553254d6db809277d + revision: 27959f8cb244ea5eabaeeee747984988b454e840 specs: epp-xml (1.1.0) - activesupport (~> 4.1) + activesupport (>= 4.1) builder (~> 3.2) GIT @@ -58,58 +58,58 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) + actioncable (5.0.7.2) + actionpack (= 5.0.7.2) + nio4r (>= 1.2, < 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.1) - actionview (= 4.2.11.1) - activesupport (= 4.2.11.1) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.7.2) + actionview (= 5.0.7.2) + activesupport (= 5.0.7.2) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.1) - activesupport (= 4.2.11.1) + actionview (5.0.7.2) + activesupport (= 5.0.7.2) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_model-errors_details (1.3.1) - activemodel (>= 3.2.13, < 5.0.0) - activesupport - activejob (4.2.11.1) - activesupport (= 4.2.11.1) - globalid (>= 0.3.0) - activemodel (4.2.11.1) - activesupport (= 4.2.11.1) - builder (~> 3.1) - activerecord (4.2.11.1) - activemodel (= 4.2.11.1) - activesupport (= 4.2.11.1) - arel (~> 6.0) - activesupport (4.2.11.1) - i18n (~> 0.7) + activejob (5.0.7.2) + activesupport (= 5.0.7.2) + globalid (>= 0.3.6) + activemodel (5.0.7.2) + activesupport (= 5.0.7.2) + activerecord (5.0.7.2) + activemodel (= 5.0.7.2) + activesupport (= 5.0.7.2) + arel (~> 7.0) + activesupport (5.0.7.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - airbrake (9.4.3) - airbrake-ruby (~> 4.6) - airbrake-ruby (4.6.0) + airbrake (9.4.5) + airbrake-ruby (~> 4.7) + airbrake-ruby (4.7.1) rbtree3 (~> 0.5) akami (1.3.1) gyoku (>= 0.4.0) nokogiri - arel (6.0.4) - autodoc (0.6.0) + arel (7.1.4) + autodoc (0.7.3) actionpack activesupport (>= 3.0.0) rspec - autoprefixer-rails (9.4.8) + autoprefixer-rails (9.6.5) execjs axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -149,13 +149,13 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.5) - daemons (1.2.4) + daemons (1.3.1) daemons-rails (1.2.1) daemons multi_json (~> 1.0) - data_migrate (5.3.2) - rails (>= 4.2) - database_cleaner (1.6.1) + data_migrate (6.0.5) + rails (>= 5.0) + database_cleaner (1.7.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) devise (4.7.1) @@ -171,12 +171,12 @@ GEM equalizer (0.0.11) erubis (2.7.0) execjs (2.7.0) - ffi (1.9.25) + ffi (1.11.1) figaro (1.1.1) thor (~> 0.14) globalid (0.4.2) activesupport (>= 4.2.0) - grape (1.2.3) + grape (1.2.4) activesupport builder mustermann-grape (~> 1.0.0) @@ -190,13 +190,14 @@ GEM tilt hashdiff (1.0.0) hpricot (0.8.6) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) httpi (2.4.4) rack socksify - i18n (0.9.5) + i18n (1.7.0) concurrent-ruby (~> 1.0) i18n_data (0.8.0) ice_nine (0.11.2) @@ -229,25 +230,25 @@ GEM mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.8.2) - mime-types (3.1) + mime-types (3.3) mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) + mime-types-data (3.2019.1009) mina (0.3.1) open4 (~> 1.3.4) rake mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.10.3) - monetize (1.9.0) + monetize (1.9.2) money (~> 6.12) - money (6.12.0) - i18n (>= 0.6.4, < 1.1) - money-rails (1.12.0) + money (6.13.4) + i18n (>= 0.6.4, <= 2) + money-rails (1.13.2) activesupport (>= 3.0) monetize (~> 1.9.0) - money (~> 6.12.0) + money (~> 6.13.2) railties (>= 3.0) - multi_json (1.13.1) + multi_json (1.14.1) mustermann (1.0.3) mustermann-grape (1.0.0) mustermann (~> 1.0.0) @@ -276,83 +277,89 @@ GEM erubis que (~> 0.8) sinatra - rack (1.6.11) + rack (2.0.7) rack-accept (0.4.5) rack (>= 0.4) - rack-protection (1.5.5) + rack-protection (2.0.7) rack rack-test (0.6.3) rack (>= 1.0) railroady (1.3.0) - rails (4.2.11.1) - actionmailer (= 4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - activemodel (= 4.2.11.1) - activerecord (= 4.2.11.1) - activesupport (= 4.2.11.1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.1) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + rails (5.0.7.2) + actioncable (= 5.0.7.2) + actionmailer (= 5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + activemodel (= 5.0.7.2) + activerecord (= 5.0.7.2) + activesupport (= 5.0.7.2) + bundler (>= 1.3.0) + railties (= 5.0.7.2) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) rails-settings-cached (0.7.2) rails (>= 4.2.0) - railties (4.2.11.1) - actionpack (= 4.2.11.1) - activesupport (= 4.2.11.1) + railties (5.0.7.2) + actionpack (= 5.0.7.2) + activesupport (= 5.0.7.2) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.3) + rake (13.0.0) ransack (1.8.10) actionpack (>= 3.0, < 5.2) activerecord (>= 3.0, < 5.2) activesupport (>= 3.0, < 5.2) i18n + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) rbtree3 (0.5.0) rdoc (4.3.0) regexp_parser (1.6.0) request_store (1.4.1) rack (>= 1.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - rest-client (2.0.1) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rspec (3.6.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.0) + rspec-support (~> 3.9.0) + rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-mocks (3.6.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) - rspec-support (3.6.0) + rspec-support (~> 3.9.0) + rspec-support (3.9.0) rubyzip (2.0.0) safe_yaml (1.0.5) - sass (3.4.23) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.0.0) - ffi (~> 1.9.6) - rake + sassc (2.2.1) + ffi (~> 1.9) savon (2.12.0) akami (~> 1.2) builder (>= 2.1.2) @@ -376,10 +383,11 @@ GEM simplecov-html (~> 0.10.0) simplecov-html (0.10.2) simpleidn (0.0.7) - sinatra (1.4.8) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) + sinatra (2.0.7) + mustermann (~> 1.0) + rack (~> 2.0) + rack-protection (= 2.0.7) + tilt (~> 2.0) sixarm_ruby_unaccent (1.2.0) slop (3.6.0) socksify (1.7.1) @@ -396,7 +404,7 @@ GEM tilt (2.0.10) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.11) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext @@ -409,8 +417,8 @@ GEM coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) equalizer (~> 0.0, >= 0.0.9) - warden (1.2.7) - rack (>= 1.0) + warden (1.2.8) + rack (>= 2.0.6) wasabi (3.5.0) httpi (~> 2.0) nokogiri (>= 1.4.2) @@ -422,6 +430,9 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) whenever (0.9.4) chronic (>= 0.6.3) wkhtmltopdf-binary (0.12.4) @@ -432,7 +443,6 @@ PLATFORMS ruby DEPENDENCIES - active_model-errors_details airbrake autodoc bootstrap-sass (~> 3.4) @@ -472,7 +482,7 @@ DEPENDENCIES que que-web railroady (= 1.3.0) - rails (= 4.2.11.1) + rails (~> 5.0.7) rails-settings-cached (= 0.7.2) ransack (~> 1.8) rest-client diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index b53d366abd..4eea4faadb 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -3,6 +3,7 @@ class ContactsController < BaseController load_and_authorize_resource before_action :set_contact, only: [:show] helper_method :ident_types + helper_method :domain_filter_params def index params[:q] ||= {} @@ -19,7 +20,7 @@ def index normalize_search_parameters do @q = contacts.search(search_params) - @contacts = @q.result.uniq.page(params[:page]) + @contacts = @q.result.distinct.page(params[:page]) end @contacts = @contacts.per(params[:results_per_page]) if params[:results_per_page].to_i.positive? @@ -84,5 +85,9 @@ def normalize_search_parameters def ident_types Contact::Ident.types end + + def domain_filter_params + params.permit(:domain_filter) + end end end diff --git a/app/controllers/admin/domains/force_delete_controller.rb b/app/controllers/admin/domains/force_delete_controller.rb index 946231077e..b01962fc74 100644 --- a/app/controllers/admin/domains/force_delete_controller.rb +++ b/app/controllers/admin/domains/force_delete_controller.rb @@ -33,7 +33,7 @@ def domain end def notify_by_email? - ActiveRecord::Type::Boolean.new.type_cast_from_user(params[:notify_by_email]) + ActiveRecord::Type::Boolean.new.cast(params[:notify_by_email]) end end end diff --git a/app/controllers/api/cors_controller.rb b/app/controllers/api/cors_controller.rb index cd4c1a8d3c..8dfebf0267 100644 --- a/app/controllers/api/cors_controller.rb +++ b/app/controllers/api/cors_controller.rb @@ -5,7 +5,7 @@ class CorsController < ApplicationController def cors_preflight_check set_access_control_headers - render text: '' + render plain: '' end def set_access_control_headers diff --git a/app/controllers/api/v1/base_controller.rb b/app/controllers/api/v1/base_controller.rb index c93160d9c5..2cc3afd1c6 100644 --- a/app/controllers/api/v1/base_controller.rb +++ b/app/controllers/api/v1/base_controller.rb @@ -1,5 +1,3 @@ -require 'rails5_api_controller_backport' - module Api module V1 class BaseController < ActionController::API diff --git a/app/controllers/api/v1/registrant/auth_controller.rb b/app/controllers/api/v1/registrant/auth_controller.rb index c1fe3fbf8f..03dfa45f39 100644 --- a/app/controllers/api/v1/registrant/auth_controller.rb +++ b/app/controllers/api/v1/registrant/auth_controller.rb @@ -1,4 +1,3 @@ -require 'rails5_api_controller_backport' require 'auth_token/auth_token_creator' module Api @@ -16,7 +15,7 @@ class AuthController < ActionController::API end def eid - user = RegistrantUser.find_or_create_by_api_data(eid_params) + user = RegistrantUser.find_or_create_by_api_data(eid_params.to_h) token = create_token(user) if token diff --git a/app/controllers/api/v1/registrant/base_controller.rb b/app/controllers/api/v1/registrant/base_controller.rb index 05702b4c9b..277c7c133e 100644 --- a/app/controllers/api/v1/registrant/base_controller.rb +++ b/app/controllers/api/v1/registrant/base_controller.rb @@ -1,4 +1,3 @@ -require 'rails5_api_controller_backport' require 'auth_token/auth_token_decryptor' module Api diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index dec34acbf2..1a57b55734 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,7 +3,7 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. - protect_from_forgery with: :exception + protect_from_forgery with: :exception, prepend: true before_action do resource = controller_name.singularize.to_sym diff --git a/app/controllers/epp/base_controller.rb b/app/controllers/epp/base_controller.rb index d491126434..f774a7819e 100644 --- a/app/controllers/epp/base_controller.rb +++ b/app/controllers/epp/base_controller.rb @@ -3,7 +3,6 @@ class BaseController < ActionController::Base class AuthorizationError < StandardError; end check_authorization - skip_before_action :verify_authenticity_token layout false before_action :ensure_session_id_passed diff --git a/app/controllers/registrant/contacts_controller.rb b/app/controllers/registrant/contacts_controller.rb index a4b335defc..af7136ce99 100644 --- a/app/controllers/registrant/contacts_controller.rb +++ b/app/controllers/registrant/contacts_controller.rb @@ -1,6 +1,7 @@ class Registrant::ContactsController < RegistrantController helper_method :domain helper_method :fax_enabled? + helper_method :domain_filter_params skip_authorization_check only: %i[edit update] def show @@ -99,4 +100,8 @@ def update_contact_via_api(uuid) http.request(request) end end + + def domain_filter_params + params.permit(:domain_filter) + end end diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb index 49569d7a00..667ff95d35 100644 --- a/app/controllers/registrar/contacts_controller.rb +++ b/app/controllers/registrar/contacts_controller.rb @@ -3,6 +3,7 @@ class ContactsController < DeppController before_action :init_epp_contact helper_method :address_processing? helper_method :ident_types + helper_method :domain_filter_params def index authorize! :view, Depp::Contact @@ -104,6 +105,12 @@ def destroy end end + protected + + def domain_filter_params + params.permit(:domain_filter) + end + private def init_epp_contact diff --git a/app/controllers/registrar/domains_controller.rb b/app/controllers/registrar/domains_controller.rb index bdab2eefc7..5c82ba6759 100644 --- a/app/controllers/registrar/domains_controller.rb +++ b/app/controllers/registrar/domains_controller.rb @@ -2,16 +2,17 @@ class Registrar class DomainsController < DeppController before_action :init_domain, except: :new helper_method :contacts + helper_method :search_params def index authorize! :view, Depp::Domain - params[:q] ||= {} - params[:q].delete_if { |_k, v| v.blank? } - if params[:q].length == 1 && params[:q][:name_matches].present? - @domain = Domain.find_by(name: params[:q][:name_matches]) - if @domain - redirect_to info_registrar_domains_url(domain_name: @domain.name) and return + if search_params.to_h.delete_if { |_key, value| value.blank? }.length == 1 && + search_params[:name_matches].present? + domain = Domain.find_by(name: search_params[:name_matches]) + + if domain + redirect_to info_registrar_domains_url(domain_name: domain.name) and return end end @@ -24,15 +25,15 @@ def index end normalize_search_parameters do - @q = domains.search(params[:q]) + @q = domains.search(search_params) @domains = @q.result.page(params[:page]) - if @domains.count == 0 && params[:q][:name_matches] !~ /^%.+%$/ - # if we do not get any results, add wildcards to the name field and search again - n_cache = params[:q][:name_matches] - params[:q][:name_matches] = "%#{params[:q][:name_matches]}%" - @q = domains.search(params[:q]) + + # if we do not get any results, add wildcards to the name field and search again + if @domains.count == 0 && search_params[:name_matches] !~ /^%.+%$/ + new_search_params = search_params.to_h + new_search_params[:name_matches] = "%#{new_search_params[:name_matches]}%" + @q = domains.search(new_search_params) @domains = @q.result.page(params[:page]) - params[:q][:name_matches] = n_cache # we don't want to show wildcards in search form end end @@ -164,17 +165,26 @@ def contacts end def normalize_search_parameters - ca_cache = params[:q][:valid_to_lteq] + ca_cache = search_params[:valid_to_lteq] begin - end_time = params[:q][:valid_to_lteq].try(:to_date) - params[:q][:valid_to_lteq] = end_time.try(:end_of_day) + end_time = search_params[:valid_to_lteq].try(:to_date) + search_params[:valid_to_lteq] = end_time.try(:end_of_day) rescue logger.warn('Invalid date') end yield - params[:q][:valid_to_lteq] = ca_cache + search_params[:valid_to_lteq] = ca_cache + end + + def search_params + params.fetch(:q, {}).permit(:name_matches, + :registrant_ident_eq, + :contacts_ident_eq, + :nameservers_hostname_eq, + :valid_to_gteq, + :valid_to_lteq) end end end diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb index c97c3155dd..2ca8f5cc7d 100644 --- a/app/controllers/registrar/sessions_controller.rb +++ b/app/controllers/registrar/sessions_controller.rb @@ -55,7 +55,7 @@ def id_card ip_allowed = restricted_ip.can_access_registrar_area?(resource.registrar) unless ip_allowed - render text: t('registrar.authorization.ip_not_allowed', ip: request.ip) + render plain: t('registrar.authorization.ip_not_allowed', ip: request.ip) warden.logout(:registrar_user) return end @@ -171,7 +171,7 @@ def check_ip_restriction return if allowed - render text: t('registrar.authorization.ip_not_allowed', ip: request.ip) + render plain: t('registrar.authorization.ip_not_allowed', ip: request.ip) end def current_ability diff --git a/app/controllers/registrar/xml_consoles_controller.rb b/app/controllers/registrar/xml_consoles_controller.rb index 083dec5327..b07b9cbee6 100644 --- a/app/controllers/registrar/xml_consoles_controller.rb +++ b/app/controllers/registrar/xml_consoles_controller.rb @@ -19,7 +19,7 @@ def load_xml xml_dir_path = Rails.root + 'app/views/registrar/xml_consoles/epp_requests' xml = File.read("#{xml_dir_path}/#{params[:obj]}/#{params[:epp_action]}.xml") xml.gsub!('ABC-12345', "#{cl_trid}") - render text: xml + render plain: xml end end end diff --git a/app/models/account.rb b/app/models/account.rb index b7c43eab31..420f43e48d 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,4 +1,4 @@ -class Account < ActiveRecord::Base +class Account < ApplicationRecord include Versions belongs_to :registrar, required: true diff --git a/app/models/account_activity.rb b/app/models/account_activity.rb index c5857631ed..d8e6be4d46 100644 --- a/app/models/account_activity.rb +++ b/app/models/account_activity.rb @@ -1,4 +1,4 @@ -class AccountActivity < ActiveRecord::Base +class AccountActivity < ApplicationRecord include Versions belongs_to :account, required: true belongs_to :bank_transaction diff --git a/app/models/action.rb b/app/models/action.rb index 1d4f30d867..4ac4de013e 100644 --- a/app/models/action.rb +++ b/app/models/action.rb @@ -1,4 +1,4 @@ -class Action < ActiveRecord::Base +class Action < ApplicationRecord has_paper_trail class_name: 'ActionVersion' belongs_to :user diff --git a/app/models/api_log/db.rb b/app/models/api_log/db.rb index 255caffda0..ca1162e8ff 100644 --- a/app/models/api_log/db.rb +++ b/app/models/api_log/db.rb @@ -1,5 +1,5 @@ module ApiLog - class Db < ActiveRecord::Base + class Db < ApplicationRecord self.abstract_class = true # to_sym is needed because passing a string to ActiveRecord::Base.establish_connection # for a configuration lookup is deprecated diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000000..10a4cba84d --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/auction.rb b/app/models/auction.rb index 80df11eef5..6ddd8e394b 100644 --- a/app/models/auction.rb +++ b/app/models/auction.rb @@ -1,4 +1,4 @@ -class Auction < ActiveRecord::Base +class Auction < ApplicationRecord enum status: { started: 'started', awaiting_payment: 'awaiting_payment', diff --git a/app/models/bank_statement.rb b/app/models/bank_statement.rb index 5997927cf4..8d4608f64f 100644 --- a/app/models/bank_statement.rb +++ b/app/models/bank_statement.rb @@ -1,4 +1,4 @@ -class BankStatement < ActiveRecord::Base +class BankStatement < ApplicationRecord include Versions has_many :bank_transactions diff --git a/app/models/bank_transaction.rb b/app/models/bank_transaction.rb index eb8c846220..6fbf7ce592 100644 --- a/app/models/bank_transaction.rb +++ b/app/models/bank_transaction.rb @@ -1,4 +1,4 @@ -class BankTransaction < ActiveRecord::Base +class BankTransaction < ApplicationRecord include Versions belongs_to :bank_statement has_one :account_activity diff --git a/app/models/billing/price.rb b/app/models/billing/price.rb index b48c9f0bb7..283a6e5bc9 100644 --- a/app/models/billing/price.rb +++ b/app/models/billing/price.rb @@ -1,5 +1,5 @@ module Billing - class Price < ActiveRecord::Base + class Price < ApplicationRecord include Concerns::Billing::Price::Expirable belongs_to :zone, class_name: 'DNS::Zone', required: true diff --git a/app/models/blocked_domain.rb b/app/models/blocked_domain.rb index 26d5fedd72..d292827dc7 100644 --- a/app/models/blocked_domain.rb +++ b/app/models/blocked_domain.rb @@ -1,4 +1,4 @@ -class BlockedDomain < ActiveRecord::Base +class BlockedDomain < ApplicationRecord include Versions before_save :generate_data after_destroy :remove_data diff --git a/app/models/certificate.rb b/app/models/certificate.rb index 2121148621..5259403c2c 100644 --- a/app/models/certificate.rb +++ b/app/models/certificate.rb @@ -1,6 +1,6 @@ require 'open3' -class Certificate < ActiveRecord::Base +class Certificate < ApplicationRecord include Versions belongs_to :api_user diff --git a/app/models/concerns/domain/force_delete.rb b/app/models/concerns/domain/force_delete.rb index 5247ce93de..d820d8f4ba 100644 --- a/app/models/concerns/domain/force_delete.rb +++ b/app/models/concerns/domain/force_delete.rb @@ -35,7 +35,7 @@ def stop_all_pending_actions end def preserve_current_statuses_for_force_delete - self.statuses_before_force_delete = statuses + self.statuses_before_force_delete = statuses.clone end def restore_statuses_before_force_delete diff --git a/app/models/concerns/epp_errors.rb b/app/models/concerns/epp_errors.rb index 7395732ca5..c1e4fa2e13 100644 --- a/app/models/concerns/epp_errors.rb +++ b/app/models/concerns/epp_errors.rb @@ -20,7 +20,7 @@ def construct_epp_errors epp_errors << collect_parent_errors(attr, errors) end - errors[:epp_errors] = epp_errors + errors.add(:epp_errors, epp_errors) errors[:epp_errors].flatten! end diff --git a/app/models/contact.rb b/app/models/contact.rb index 06407ae699..d45597d3ce 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -1,4 +1,4 @@ -class Contact < ActiveRecord::Base +class Contact < ApplicationRecord include Versions # version/contact_version.rb include EppErrors include UserEvents @@ -246,10 +246,8 @@ def address_attribute_names end def registrant_user_contacts(registrant_user) - # In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can - # be removed. - from("(#{registrant_user_direct_contacts(registrant_user).to_sql} UNION " \ - "#{registrant_user_indirect_contacts(registrant_user).to_sql}) AS contacts") + registrant_user_direct_contacts(registrant_user) + .or(registrant_user_indirect_contacts(registrant_user)) end def registrant_user_direct_contacts(registrant_user) @@ -415,7 +413,7 @@ def strip_email # if total is smaller than needed, the load more # we also need to sort by valid_to # todo: extract to drapper. Then we can remove Domain#roles - def all_domains(page: nil, per: nil, params: {}) + def all_domains(page: nil, per: nil, params:) # compose filter sql filter_sql = case params[:domain_filter] when "Registrant".freeze diff --git a/app/models/directo.rb b/app/models/directo.rb index f062912f91..5f73a3f169 100644 --- a/app/models/directo.rb +++ b/app/models/directo.rb @@ -1,4 +1,4 @@ -class Directo < ActiveRecord::Base +class Directo < ApplicationRecord DOMAIN_TO_PRODUCT = {"ee" => "01EE", "com.ee" => "02COM", "pri.ee" => "03PRI", "fie.ee"=>"04FIE", "med.ee" => "05MED"}.freeze belongs_to :item, polymorphic: true diff --git a/app/models/dns/zone.rb b/app/models/dns/zone.rb index a63d9b2804..a641c4e49d 100644 --- a/app/models/dns/zone.rb +++ b/app/models/dns/zone.rb @@ -1,11 +1,11 @@ module DNS - class Zone < ActiveRecord::Base + class Zone < ApplicationRecord validates :origin, :ttl, :refresh, :retry, :expire, :minimum_ttl, :email, :master_nameserver, presence: true validates :ttl, :refresh, :retry, :expire, :minimum_ttl, numericality: { only_integer: true } validates :origin, uniqueness: true before_destroy do - !used? + throw(:abort) if used? end def self.generate_zonefiles diff --git a/app/models/dnskey.rb b/app/models/dnskey.rb index 02b43d7295..4772188a6e 100644 --- a/app/models/dnskey.rb +++ b/app/models/dnskey.rb @@ -1,4 +1,4 @@ -class Dnskey < ActiveRecord::Base +class Dnskey < ApplicationRecord include Versions # version/dnskey_version.rb include EppErrors diff --git a/app/models/domain.rb b/app/models/domain.rb index cce1c9f416..bf8072cbf7 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -1,4 +1,4 @@ -class Domain < ActiveRecord::Base +class Domain < ApplicationRecord include UserEvents include Versions # version/domain_version.rb include Concerns::Domain::Expirable @@ -191,8 +191,6 @@ def nameserver_required? end def registrant_user_domains(registrant_user) - # In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can - # be removed. from( "(#{registrant_user_domains_by_registrant(registrant_user).to_sql} UNION " \ "#{registrant_user_domains_by_contact(registrant_user).to_sql}) AS domains" @@ -200,8 +198,6 @@ def registrant_user_domains(registrant_user) end def registrant_user_direct_domains(registrant_user) - # In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can - # be removed. from( "(#{registrant_user_direct_domains_by_registrant(registrant_user).to_sql} UNION " \ "#{registrant_user_direct_domains_by_contact(registrant_user).to_sql}) AS domains" @@ -209,8 +205,6 @@ def registrant_user_direct_domains(registrant_user) end def registrant_user_administered_domains(registrant_user) - # In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can - # be removed. from( "(#{registrant_user_domains_by_registrant(registrant_user).to_sql} UNION " \ "#{registrant_user_domains_by_admin_contact(registrant_user).to_sql}) AS domains" @@ -229,7 +223,7 @@ def registrant_user_domains_by_contact(registrant_user) def registrant_user_domains_by_admin_contact(registrant_user) joins(:domain_contacts).where(domain_contacts: { contact_id: registrant_user.contacts, - type: [AdminDomainContact] }) + type: [AdminDomainContact.name] }) end def registrant_user_direct_domains_by_registrant(registrant_user) diff --git a/app/models/domain_contact.rb b/app/models/domain_contact.rb index b433cd3dca..26d23dd568 100644 --- a/app/models/domain_contact.rb +++ b/app/models/domain_contact.rb @@ -1,4 +1,4 @@ -class DomainContact < ActiveRecord::Base +class DomainContact < ApplicationRecord # STI: tech_domain_contact # STI: admin_domain_contact include Versions # version/domain_contact_version.rb diff --git a/app/models/domain_status.rb b/app/models/domain_status.rb index 151ecb0ee2..fba75737c7 100644 --- a/app/models/domain_status.rb +++ b/app/models/domain_status.rb @@ -1,4 +1,4 @@ -class DomainStatus < ActiveRecord::Base +class DomainStatus < ApplicationRecord include Versions # version/domain_status_version.rb include EppErrors diff --git a/app/models/domain_transfer.rb b/app/models/domain_transfer.rb index 91cdb2d672..02ab2bc88a 100644 --- a/app/models/domain_transfer.rb +++ b/app/models/domain_transfer.rb @@ -1,4 +1,4 @@ -class DomainTransfer < ActiveRecord::Base +class DomainTransfer < ApplicationRecord belongs_to :domain belongs_to :old_registrar, class_name: 'Registrar' diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 8ea01b67d2..742f0339fe 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -9,7 +9,7 @@ class Epp::Contact < Contact def manage_permissions return unless update_prohibited? || delete_prohibited? add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation)) - false + throw(:abort) end class << self diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index dc5de8d61e..176e5710d6 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -12,7 +12,7 @@ def manage_permissions return unless update_prohibited? || delete_prohibited? stat = (statuses & (DomainStatus::UPDATE_PROHIBIT_STATES + DomainStatus::DELETE_PROHIBIT_STATES)).first add_epp_error('2304', 'status', stat, I18n.t(:object_status_prohibits_operation)) - false + throw(:abort) end after_validation :validate_contacts diff --git a/app/models/epp_session.rb b/app/models/epp_session.rb index dfd603fc48..6427c503cb 100644 --- a/app/models/epp_session.rb +++ b/app/models/epp_session.rb @@ -1,4 +1,4 @@ -class EppSession < ActiveRecord::Base +class EppSession < ApplicationRecord belongs_to :user, required: true validates :session_id, uniqueness: true, presence: true diff --git a/app/models/invoice.rb b/app/models/invoice.rb index cde439c706..7f1dea8252 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -1,4 +1,4 @@ -class Invoice < ActiveRecord::Base +class Invoice < ApplicationRecord include Versions include Concerns::Invoice::Cancellable include Concerns::Invoice::Payable @@ -47,7 +47,7 @@ def set_invoice_number errors.add(:base, I18n.t('failed_to_generate_invoice_invoice_number_limit_reached')) logger.error('INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE') - false + throw(:abort) end def to_s diff --git a/app/models/invoice_item.rb b/app/models/invoice_item.rb index 6efd7b829c..ec0c777672 100644 --- a/app/models/invoice_item.rb +++ b/app/models/invoice_item.rb @@ -1,4 +1,4 @@ -class InvoiceItem < ActiveRecord::Base +class InvoiceItem < ApplicationRecord include Versions belongs_to :invoice diff --git a/app/models/legal_document.rb b/app/models/legal_document.rb index 630c52d986..3dc8f883c5 100644 --- a/app/models/legal_document.rb +++ b/app/models/legal_document.rb @@ -1,4 +1,4 @@ -class LegalDocument < ActiveRecord::Base +class LegalDocument < ApplicationRecord cattr_accessor :explicitly_write_file include EppErrors MIN_BODY_SIZE = (1.37 * 3.kilobytes).ceil diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 4a03613975..77c7417ded 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -1,4 +1,4 @@ -class Nameserver < ActiveRecord::Base +class Nameserver < ApplicationRecord include Versions # version/nameserver_version.rb include EppErrors diff --git a/app/models/notification.rb b/app/models/notification.rb index d6427323b2..e83b2c9da5 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,4 +1,4 @@ -class Notification < ActiveRecord::Base +class Notification < ApplicationRecord include Versions # version/notification_version.rb belongs_to :registrar diff --git a/app/models/que_job.rb b/app/models/que_job.rb index 5eed581fc3..f9dd50ac87 100644 --- a/app/models/que_job.rb +++ b/app/models/que_job.rb @@ -1,4 +1,4 @@ # To be able to remove existing jobs -class QueJob < ActiveRecord::Base +class QueJob < ApplicationRecord self.primary_key = 'job_id' end diff --git a/app/models/registrant_verification.rb b/app/models/registrant_verification.rb index 95e24d36bf..952197cf57 100644 --- a/app/models/registrant_verification.rb +++ b/app/models/registrant_verification.rb @@ -1,10 +1,10 @@ # Used in Registrant portal to collect registrant verifications # Registrant postgres user can access this table directly. -class RegistrantVerification < ActiveRecord::Base +class RegistrantVerification < ApplicationRecord # actions CONFIRMED = 'confirmed' REJECTED = 'rejected' - + # action types DOMAIN_REGISTRANT_CHANGE = 'domain_registrant_change' DOMAIN_DELETE = 'domain_delete' diff --git a/app/models/registrar.rb b/app/models/registrar.rb index fa8747114f..69a8a1dee6 100644 --- a/app/models/registrar.rb +++ b/app/models/registrar.rb @@ -1,4 +1,4 @@ -class Registrar < ActiveRecord::Base +class Registrar < ApplicationRecord include Versions # version/registrar_version.rb has_many :domains, dependent: :restrict_with_error diff --git a/app/models/reserved_domain.rb b/app/models/reserved_domain.rb index 2e3d17a205..871c1991a3 100644 --- a/app/models/reserved_domain.rb +++ b/app/models/reserved_domain.rb @@ -1,4 +1,4 @@ -class ReservedDomain < ActiveRecord::Base +class ReservedDomain < ApplicationRecord include Versions # version/reserved_domain_version.rb before_save :fill_empty_passwords before_save :generate_data diff --git a/app/models/type/vat_rate.rb b/app/models/type/vat_rate.rb index 5ee9932119..6a31e389be 100644 --- a/app/models/type/vat_rate.rb +++ b/app/models/type/vat_rate.rb @@ -1,10 +1,10 @@ module Type class VATRate < ActiveRecord::Type::Decimal - def type_cast_from_database(value) + def deserialize(value) super * 100 if value end - def type_cast_for_database(value) + def serialize(value) super / 100.0 if value end end diff --git a/app/models/user.rb b/app/models/user.rb index 573cddc940..cc299640cb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ -class User < ActiveRecord::Base +class User < ApplicationRecord include Versions # version/user_version.rb has_many :actions, dependent: :restrict_with_exception diff --git a/app/models/white_ip.rb b/app/models/white_ip.rb index 251fc60acf..303ff58861 100644 --- a/app/models/white_ip.rb +++ b/app/models/white_ip.rb @@ -1,4 +1,4 @@ -class WhiteIp < ActiveRecord::Base +class WhiteIp < ApplicationRecord include Versions belongs_to :registrar diff --git a/app/models/whois/server.rb b/app/models/whois/server.rb index 2cec52e4e6..bec234b6ba 100644 --- a/app/models/whois/server.rb +++ b/app/models/whois/server.rb @@ -1,5 +1,5 @@ module Whois - class Server < ActiveRecord::Base + class Server < ApplicationRecord self.abstract_class = true establish_connection :"whois_#{Rails.env}" end diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb index 8d91c85eef..cace829fa2 100644 --- a/app/models/whois_record.rb +++ b/app/models/whois_record.rb @@ -1,5 +1,5 @@ require "erb" -class WhoisRecord < ActiveRecord::Base +class WhoisRecord < ApplicationRecord belongs_to :domain belongs_to :registrar diff --git a/app/views/admin/contacts/partials/_domains.haml b/app/views/admin/contacts/partials/_domains.haml index 3a60074d18..91b0715bad 100644 --- a/app/views/admin/contacts/partials/_domains.haml +++ b/app/views/admin/contacts/partials/_domains.haml @@ -1,4 +1,5 @@ -- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params) +- domains = contact.all_domains(page: params[:domain_page], per: 20, + params: domain_filter_params.to_h) .panel.panel-default .panel-heading .pull-left diff --git a/app/views/registrant/contacts/show/_domains.html.erb b/app/views/registrant/contacts/show/_domains.html.erb index bb6d39fc03..167ab1240b 100644 --- a/app/views/registrant/contacts/show/_domains.html.erb +++ b/app/views/registrant/contacts/show/_domains.html.erb @@ -1,4 +1,5 @@ -<% domains = contact.all_domains(page: params[:domain_page], per: 20, params: params) %> +<% domains = contact.all_domains(page: params[:domain_page], per: 20, + params: domain_filter_params.to_h) %>
@@ -50,4 +51,4 @@ -
\ No newline at end of file +
diff --git a/app/views/registrar/contacts/partials/_domains.haml b/app/views/registrar/contacts/partials/_domains.haml index f409a6f24c..cf721cb862 100644 --- a/app/views/registrar/contacts/partials/_domains.haml +++ b/app/views/registrar/contacts/partials/_domains.haml @@ -1,4 +1,5 @@ -- domains = contact.all_domains(page: params[:domain_page], per: 20, params: params) +- domains = contact.all_domains(page: params[:domain_page], per: 20, + params: domain_filter_params.to_h) .panel.panel-default .panel-heading .pull-left diff --git a/app/views/registrar/domains/_search_form.html.erb b/app/views/registrar/domains/_search_form.html.erb index 743f8de60b..08b370b767 100644 --- a/app/views/registrar/domains/_search_form.html.erb +++ b/app/views/registrar/domains/_search_form.html.erb @@ -3,7 +3,7 @@
<%= f.label :name, for: nil %> - <%= f.search_field :name_matches, value: params[:q][:name_matches], class: 'form-control', + <%= f.search_field :name_matches, value: search_params[:name_matches], class: 'form-control', placeholder: t(:name) %>
@@ -44,7 +44,7 @@
<%= f.label :valid_to_from, for: nil %> - <%= f.search_field :valid_to_gteq, value: params[:q][:valid_to_gteq], + <%= f.search_field :valid_to_gteq, value: search_params[:valid_to_gteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_from) %>
@@ -53,7 +53,7 @@
<%= f.label :valid_to_until, for: nil %> - <%= f.search_field :valid_to_lteq, value: params[:q][:valid_to_lteq], + <%= f.search_field :valid_to_lteq, value: search_params[:valid_to_lteq], class: 'form-control js-datepicker', placeholder: t(:valid_to_until) %>
diff --git a/bin/rails b/bin/rails index 5191e6927a..0739660237 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup index fdf4596e73..b3067cf227 100755 --- a/bin/setup +++ b/bin/setup @@ -3,7 +3,7 @@ require 'pathname' require 'fileutils' # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) def system!(*args) @@ -22,7 +22,7 @@ Dir.chdir APP_ROOT do end puts "\n== Preparing database ==" - system! 'bin/rake db:setup' + system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rake log:clear tmp:clear' diff --git a/bin/update b/bin/update new file mode 100644 index 0000000000..a8e4462f20 --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/config/application.rb b/config/application.rb index d02c6e9d01..fadb0931c4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,15 +1,8 @@ -require File.expand_path('../boot', __FILE__) - -# Pick the frameworks you want: -require 'active_model/railtie' -require 'active_record/railtie' -require 'action_controller/railtie' -require 'action_mailer/railtie' -require 'action_view/railtie' -require 'sprockets/railtie' -require 'csv' +require_relative 'boot' + require 'rails/all' -# require "rails/test_unit/railtie" + +require 'csv' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -43,21 +36,6 @@ class Application < Rails::Application config.eager_load_paths << config.root.join('lib', 'validators') config.watchable_dirs['lib'] = %i[rb] - # Add the fonts path - config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts') - - # Precompile additional assets - config.assets.precompile += %w(*.svg *.eot *.woff *.ttf) - config.assets.precompile += %w(admin-manifest.css admin-manifest.js) - config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js) - config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js) - - # Active Record used to suppresses errors raised within - # `after_rollback`/`after_commit` callbacks and only printed them to the logs. - # In the next version, these errors will no longer be suppressed. - # Instead, the errors will propagate normally just like in other Active Record callbacks. - config.active_record.raise_in_transactional_callbacks = true - config.active_record.schema_format = :sql config.generators do |g| @@ -93,5 +71,13 @@ class Application < Rails::Application config.action_view.default_form_builder = 'DefaultFormBuilder' config.secret_key_base = Figaro.env.secret_key_base + + # Using `Rails.application.config.active_record.belongs_to_required_by_default` in + # `new_framework_defaults.rb` has no effect in Rails 5.0.x. + # https://github.com/rails/rails/issues/23589 + # https://stackoverflow.com/questions/38850712/rails-5-belongs-to-required-by-default-doesnt-work + # Not supported by `paper_trail` gem < 5.0 + # https://github.com/paper-trail-gem/paper_trail/issues/682 + config.active_record.belongs_to_required_by_default = false end -end \ No newline at end of file +end diff --git a/config/boot.rb b/config/boot.rb index 5e5f0c1fac..30f5120df6 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,3 @@ -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000000..0bbde6f74f --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,9 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 diff --git a/config/environment.rb b/config/environment.rb index ee8d90dc65..426333bb46 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/production.rb b/config/environments/production.rb index 11a620e35a..c2262235db 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -19,8 +19,7 @@ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # config.action_dispatch.rack_cache = true - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_files = false + config.public_file_server.enabled = false # Compress JavaScripts and CSS. config.assets.js_compressor = Uglifier.new(harmony: true) @@ -29,38 +28,37 @@ # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. - config.assets.digest = true + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Set to :debug to see everything in the log. - config.log_level = :info + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug # Prepend all log lines with the following tags. - config.log_tags = [:subdomain, :uuid, :remote_ip] - - # Use a different logger for distributed setups. - require 'syslog/logger' - config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new(ENV['app_name'] || 'registry')) + config.log_tags = [:request_id, :subdomain, :remote_ip] # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "domain_name_registry_#{Rails.env}" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -68,22 +66,29 @@ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). - config.i18n.fallbacks = true + config.i18n.fallbacks = [I18n.default_locale] # Send deprecation notices to registered listeners. - config.active_support.deprecation = :log - - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false + config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + require 'syslog/logger' + config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new(ENV['app_name'] || 'registry')) + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end -# In off mode, queueing a job will simply insert it into the database - -# the current process will make no effort to run it. +# In off mode, queueing a job will simply insert it into the database - +# the current process will make no effort to run it. # You should use this if you want to use a dedicated process to work tasks -Que.mode = :off +Que.mode = :off diff --git a/config/environments/test.rb b/config/environments/test.rb index 119f6d815a..73ae40f083 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,24 +1,36 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! config.cache_classes = true - config.eager_load = false - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false config.consider_all_requests_local = true config.action_controller.perform_caching = false + # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false + # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - config.active_support.test_order = :random + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - config.logger = ActiveSupport::Logger.new(nil) + # Raises error for missing translations config.action_view.raise_on_missing_translations = true # If set to :null_store, Setting.x returns nil after first spec runs (database is emptied) diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000000..89d2efab2b --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index d1a94d7c68..d3b8408d53 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1 +1,17 @@ -Rails.application.config.assets.precompile += %w( login.css registrar-manifest.css shared/pdf.css ) +# Be sure to restart your server when you modify this file. + +Rails.application.configure do + # Version of your assets, change this if you want to expire all your assets. + config.assets.version = '1.0' + + # Add additional assets to the asset load path + config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts') + + # Precompile additional assets. + # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. + config.assets.precompile += %w[login.css registrar-manifest.css shared/pdf.css] + config.assets.precompile += %w(*.svg *.eot *.woff *.ttf) + config.assets.precompile += %w(admin-manifest.css admin-manifest.js) + config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js) + config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js) +end diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7f70458dee..5a6a32d371 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb new file mode 100644 index 0000000000..99b2db3b02 --- /dev/null +++ b/config/initializers/new_framework_defaults.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +Rails.application.config.action_controller.raise_on_unfiltered_parameters = true + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = true + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = true + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = true + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = false + +# Configure SSL options to enable HSTS with subdomains. Previous versions had false. +Rails.application.config.ssl_options = { hsts: { subdomains: true } } diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95fd..bbfc3961bf 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,10 +5,10 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/puma.rb b/config/puma.rb index 1e19380dcb..c7f311f811 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,13 +1,13 @@ # Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers: a minimum and maximum. +# The `threads` method setting takes two numbers a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum; this matches the default thread size of Active Record. +# and maximum, this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i threads threads_count, threads_count -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. # port ENV.fetch("PORT") { 3000 } @@ -32,25 +32,16 @@ # # preload_app! -# If you are preloading your application and using Active Record, it's -# recommended that you close any connections to the database before workers -# are forked to prevent connection leakage. -# -# before_fork do -# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) -# end - # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker -# process is booted, this block will be run. If you are using the `preload_app!` -# option, you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, as Ruby +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby # cannot share connections between processes. # # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end -# # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000000..5a3114b22a --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: d876b4cf172fe17628b4486b302e1d805109f4dfbf25aa8f2d89e6cf821dfdc94f4c753e4fdbaa0b6647ba687058266661632b2cd3975c41fb21dbc588b38c92 + +test: + secret_key_base: 69ecc590b3de231130e3fb390df48a4eb9259722754ef5df6a9e9ab78d69149d8c16ec2d79791c5ba7a89ad7c5afaa8cec1aa794e9a6f986d3c7319a08d6bce2 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/db/structure.sql b/db/structure.sql index de94f1eae3..32ec2eb151 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -402,6 +402,18 @@ CREATE SEQUENCE public.actions_id_seq ALTER SEQUENCE public.actions_id_seq OWNED BY public.actions.id; +-- +-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -; Tablespace: +-- + +CREATE TABLE public.ar_internal_metadata ( + key character varying NOT NULL, + value character varying, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + -- -- Name: auctions; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -2695,6 +2707,14 @@ ALTER TABLE ONLY public.actions ADD CONSTRAINT actions_pkey PRIMARY KEY (id); +-- +-- Name: ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: +-- + +ALTER TABLE ONLY public.ar_internal_metadata + ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); + + -- -- Name: auctions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -3942,801 +3962,405 @@ ALTER TABLE ONLY public.users SET search_path TO "$user",public; -INSERT INTO schema_migrations (version) VALUES ('20140616073945'); - -INSERT INTO schema_migrations (version) VALUES ('20140620130107'); - -INSERT INTO schema_migrations (version) VALUES ('20140627082711'); - -INSERT INTO schema_migrations (version) VALUES ('20140701130945'); - -INSERT INTO schema_migrations (version) VALUES ('20140702144833'); - -INSERT INTO schema_migrations (version) VALUES ('20140702145448'); - -INSERT INTO schema_migrations (version) VALUES ('20140724084927'); - -INSERT INTO schema_migrations (version) VALUES ('20140730082358'); - -INSERT INTO schema_migrations (version) VALUES ('20140730082532'); - -INSERT INTO schema_migrations (version) VALUES ('20140730104916'); - -INSERT INTO schema_migrations (version) VALUES ('20140730141443'); - -INSERT INTO schema_migrations (version) VALUES ('20140731073300'); - -INSERT INTO schema_migrations (version) VALUES ('20140731081816'); - -INSERT INTO schema_migrations (version) VALUES ('20140801140249'); - -INSERT INTO schema_migrations (version) VALUES ('20140804095654'); - -INSERT INTO schema_migrations (version) VALUES ('20140808132327'); - -INSERT INTO schema_migrations (version) VALUES ('20140813102245'); - -INSERT INTO schema_migrations (version) VALUES ('20140813135408'); - -INSERT INTO schema_migrations (version) VALUES ('20140815082619'); - -INSERT INTO schema_migrations (version) VALUES ('20140815110028'); - -INSERT INTO schema_migrations (version) VALUES ('20140815114000'); - -INSERT INTO schema_migrations (version) VALUES ('20140819095802'); - -INSERT INTO schema_migrations (version) VALUES ('20140819103517'); - -INSERT INTO schema_migrations (version) VALUES ('20140822122938'); - -INSERT INTO schema_migrations (version) VALUES ('20140826082057'); - -INSERT INTO schema_migrations (version) VALUES ('20140826103454'); - -INSERT INTO schema_migrations (version) VALUES ('20140827140759'); - -INSERT INTO schema_migrations (version) VALUES ('20140828072329'); - -INSERT INTO schema_migrations (version) VALUES ('20140828074404'); - -INSERT INTO schema_migrations (version) VALUES ('20140828080320'); - -INSERT INTO schema_migrations (version) VALUES ('20140828133057'); - -INSERT INTO schema_migrations (version) VALUES ('20140902121843'); - -INSERT INTO schema_migrations (version) VALUES ('20140911101310'); - -INSERT INTO schema_migrations (version) VALUES ('20140911101604'); - -INSERT INTO schema_migrations (version) VALUES ('20140925073340'); - -INSERT INTO schema_migrations (version) VALUES ('20140925073734'); - -INSERT INTO schema_migrations (version) VALUES ('20140925073831'); - -INSERT INTO schema_migrations (version) VALUES ('20140925084916'); - -INSERT INTO schema_migrations (version) VALUES ('20140925085340'); - -INSERT INTO schema_migrations (version) VALUES ('20140925101927'); - -INSERT INTO schema_migrations (version) VALUES ('20140926081324'); - -INSERT INTO schema_migrations (version) VALUES ('20140926082627'); - -INSERT INTO schema_migrations (version) VALUES ('20140926121409'); - -INSERT INTO schema_migrations (version) VALUES ('20140929095329'); - -INSERT INTO schema_migrations (version) VALUES ('20140930093039'); - -INSERT INTO schema_migrations (version) VALUES ('20141001085322'); - -INSERT INTO schema_migrations (version) VALUES ('20141006124904'); - -INSERT INTO schema_migrations (version) VALUES ('20141006130306'); - -INSERT INTO schema_migrations (version) VALUES ('20141008134959'); - -INSERT INTO schema_migrations (version) VALUES ('20141009100818'); - -INSERT INTO schema_migrations (version) VALUES ('20141009101337'); - -INSERT INTO schema_migrations (version) VALUES ('20141010085152'); - -INSERT INTO schema_migrations (version) VALUES ('20141010130412'); - -INSERT INTO schema_migrations (version) VALUES ('20141014073435'); - -INSERT INTO schema_migrations (version) VALUES ('20141015135255'); - -INSERT INTO schema_migrations (version) VALUES ('20141015135742'); - -INSERT INTO schema_migrations (version) VALUES ('20141105150721'); - -INSERT INTO schema_migrations (version) VALUES ('20141111105931'); - -INSERT INTO schema_migrations (version) VALUES ('20141114130737'); - -INSERT INTO schema_migrations (version) VALUES ('20141120110330'); - -INSERT INTO schema_migrations (version) VALUES ('20141120140837'); - -INSERT INTO schema_migrations (version) VALUES ('20141121093125'); - -INSERT INTO schema_migrations (version) VALUES ('20141124105221'); - -INSERT INTO schema_migrations (version) VALUES ('20141125111414'); - -INSERT INTO schema_migrations (version) VALUES ('20141126140434'); - -INSERT INTO schema_migrations (version) VALUES ('20141127091027'); - -INSERT INTO schema_migrations (version) VALUES ('20141202114457'); - -INSERT INTO schema_migrations (version) VALUES ('20141203090115'); - -INSERT INTO schema_migrations (version) VALUES ('20141210085432'); - -INSERT INTO schema_migrations (version) VALUES ('20141211095604'); - -INSERT INTO schema_migrations (version) VALUES ('20141215085117'); - -INSERT INTO schema_migrations (version) VALUES ('20141216075056'); - -INSERT INTO schema_migrations (version) VALUES ('20141216133831'); - -INSERT INTO schema_migrations (version) VALUES ('20141218154829'); - -INSERT INTO schema_migrations (version) VALUES ('20141229115619'); - -INSERT INTO schema_migrations (version) VALUES ('20150105134026'); - -INSERT INTO schema_migrations (version) VALUES ('20150109081914'); - -INSERT INTO schema_migrations (version) VALUES ('20150110000000'); - -INSERT INTO schema_migrations (version) VALUES ('20150110113257'); - -INSERT INTO schema_migrations (version) VALUES ('20150122091556'); - -INSERT INTO schema_migrations (version) VALUES ('20150122091557'); - -INSERT INTO schema_migrations (version) VALUES ('20150128134352'); - -INSERT INTO schema_migrations (version) VALUES ('20150129093938'); - -INSERT INTO schema_migrations (version) VALUES ('20150129144652'); - -INSERT INTO schema_migrations (version) VALUES ('20150130085458'); - -INSERT INTO schema_migrations (version) VALUES ('20150130155904'); - -INSERT INTO schema_migrations (version) VALUES ('20150130180452'); - -INSERT INTO schema_migrations (version) VALUES ('20150130191056'); - -INSERT INTO schema_migrations (version) VALUES ('20150200000000'); - -INSERT INTO schema_migrations (version) VALUES ('20150202084444'); - -INSERT INTO schema_migrations (version) VALUES ('20150202140346'); - -INSERT INTO schema_migrations (version) VALUES ('20150203135303'); - -INSERT INTO schema_migrations (version) VALUES ('20150212125339'); - -INSERT INTO schema_migrations (version) VALUES ('20150213104014'); - -INSERT INTO schema_migrations (version) VALUES ('20150217133755'); - -INSERT INTO schema_migrations (version) VALUES ('20150217133937'); - -INSERT INTO schema_migrations (version) VALUES ('20150223104842'); - -INSERT INTO schema_migrations (version) VALUES ('20150226121252'); - -INSERT INTO schema_migrations (version) VALUES ('20150226144723'); - -INSERT INTO schema_migrations (version) VALUES ('20150227092508'); - -INSERT INTO schema_migrations (version) VALUES ('20150227113121'); - -INSERT INTO schema_migrations (version) VALUES ('20150302161712'); - -INSERT INTO schema_migrations (version) VALUES ('20150303130729'); - -INSERT INTO schema_migrations (version) VALUES ('20150303151224'); - -INSERT INTO schema_migrations (version) VALUES ('20150305092921'); - -INSERT INTO schema_migrations (version) VALUES ('20150318084300'); - -INSERT INTO schema_migrations (version) VALUES ('20150318085110'); - -INSERT INTO schema_migrations (version) VALUES ('20150318114921'); - -INSERT INTO schema_migrations (version) VALUES ('20150319125655'); - -INSERT INTO schema_migrations (version) VALUES ('20150320132023'); - -INSERT INTO schema_migrations (version) VALUES ('20150330083700'); - -INSERT INTO schema_migrations (version) VALUES ('20150402114712'); - -INSERT INTO schema_migrations (version) VALUES ('20150407145943'); - -INSERT INTO schema_migrations (version) VALUES ('20150408081917'); - -INSERT INTO schema_migrations (version) VALUES ('20150410124724'); - -INSERT INTO schema_migrations (version) VALUES ('20150410132037'); - -INSERT INTO schema_migrations (version) VALUES ('20150413080832'); - -INSERT INTO schema_migrations (version) VALUES ('20150413102310'); - -INSERT INTO schema_migrations (version) VALUES ('20150413115829'); - -INSERT INTO schema_migrations (version) VALUES ('20150413140933'); - -INSERT INTO schema_migrations (version) VALUES ('20150414092249'); - -INSERT INTO schema_migrations (version) VALUES ('20150414124630'); - -INSERT INTO schema_migrations (version) VALUES ('20150414151357'); - -INSERT INTO schema_migrations (version) VALUES ('20150415075408'); - -INSERT INTO schema_migrations (version) VALUES ('20150416080828'); - -INSERT INTO schema_migrations (version) VALUES ('20150416091357'); - -INSERT INTO schema_migrations (version) VALUES ('20150416092026'); - -INSERT INTO schema_migrations (version) VALUES ('20150416094704'); - -INSERT INTO schema_migrations (version) VALUES ('20150417082723'); - -INSERT INTO schema_migrations (version) VALUES ('20150421134820'); - -INSERT INTO schema_migrations (version) VALUES ('20150422092514'); - -INSERT INTO schema_migrations (version) VALUES ('20150422132631'); - -INSERT INTO schema_migrations (version) VALUES ('20150422134243'); - -INSERT INTO schema_migrations (version) VALUES ('20150423083308'); - -INSERT INTO schema_migrations (version) VALUES ('20150427073517'); - -INSERT INTO schema_migrations (version) VALUES ('20150428075052'); - -INSERT INTO schema_migrations (version) VALUES ('20150429135339'); - -INSERT INTO schema_migrations (version) VALUES ('20150430121807'); - -INSERT INTO schema_migrations (version) VALUES ('20150504104922'); - -INSERT INTO schema_migrations (version) VALUES ('20150504110926'); - -INSERT INTO schema_migrations (version) VALUES ('20150505111437'); - -INSERT INTO schema_migrations (version) VALUES ('20150511120755'); - -INSERT INTO schema_migrations (version) VALUES ('20150512160938'); - -INSERT INTO schema_migrations (version) VALUES ('20150513080013'); - -INSERT INTO schema_migrations (version) VALUES ('20150514132606'); - -INSERT INTO schema_migrations (version) VALUES ('20150515103222'); - -INSERT INTO schema_migrations (version) VALUES ('20150518084324'); - -INSERT INTO schema_migrations (version) VALUES ('20150519094929'); - -INSERT INTO schema_migrations (version) VALUES ('20150519095416'); - -INSERT INTO schema_migrations (version) VALUES ('20150519102521'); - -INSERT INTO schema_migrations (version) VALUES ('20150519115050'); - -INSERT INTO schema_migrations (version) VALUES ('20150519140853'); - -INSERT INTO schema_migrations (version) VALUES ('20150519144118'); - -INSERT INTO schema_migrations (version) VALUES ('20150520163237'); - -INSERT INTO schema_migrations (version) VALUES ('20150520164507'); - -INSERT INTO schema_migrations (version) VALUES ('20150521120145'); - -INSERT INTO schema_migrations (version) VALUES ('20150522164020'); - -INSERT INTO schema_migrations (version) VALUES ('20150525075550'); - -INSERT INTO schema_migrations (version) VALUES ('20150601083516'); - -INSERT INTO schema_migrations (version) VALUES ('20150601083800'); - -INSERT INTO schema_migrations (version) VALUES ('20150603141549'); - -INSERT INTO schema_migrations (version) VALUES ('20150603211318'); - -INSERT INTO schema_migrations (version) VALUES ('20150603212659'); - -INSERT INTO schema_migrations (version) VALUES ('20150609093515'); - -INSERT INTO schema_migrations (version) VALUES ('20150609103333'); - -INSERT INTO schema_migrations (version) VALUES ('20150610111019'); - -INSERT INTO schema_migrations (version) VALUES ('20150610112238'); - -INSERT INTO schema_migrations (version) VALUES ('20150610144547'); - -INSERT INTO schema_migrations (version) VALUES ('20150611124920'); - -INSERT INTO schema_migrations (version) VALUES ('20150612123111'); - -INSERT INTO schema_migrations (version) VALUES ('20150612125720'); - -INSERT INTO schema_migrations (version) VALUES ('20150701074344'); - -INSERT INTO schema_migrations (version) VALUES ('20150703084206'); - -INSERT INTO schema_migrations (version) VALUES ('20150703084632'); - -INSERT INTO schema_migrations (version) VALUES ('20150706091724'); - -INSERT INTO schema_migrations (version) VALUES ('20150707103241'); - -INSERT INTO schema_migrations (version) VALUES ('20150707103801'); - -INSERT INTO schema_migrations (version) VALUES ('20150707104937'); - -INSERT INTO schema_migrations (version) VALUES ('20150707154543'); - -INSERT INTO schema_migrations (version) VALUES ('20150709092549'); - -INSERT INTO schema_migrations (version) VALUES ('20150713113436'); - -INSERT INTO schema_migrations (version) VALUES ('20150722071128'); - -INSERT INTO schema_migrations (version) VALUES ('20150803080914'); - -INSERT INTO schema_migrations (version) VALUES ('20150810114746'); - -INSERT INTO schema_migrations (version) VALUES ('20150810114747'); - -INSERT INTO schema_migrations (version) VALUES ('20150825125118'); - -INSERT INTO schema_migrations (version) VALUES ('20150827151906'); - -INSERT INTO schema_migrations (version) VALUES ('20150903105659'); - -INSERT INTO schema_migrations (version) VALUES ('20150910113839'); - -INSERT INTO schema_migrations (version) VALUES ('20150915094707'); - -INSERT INTO schema_migrations (version) VALUES ('20150921110152'); - -INSERT INTO schema_migrations (version) VALUES ('20150921111842'); - -INSERT INTO schema_migrations (version) VALUES ('20151028183132'); - -INSERT INTO schema_migrations (version) VALUES ('20151029152638'); - -INSERT INTO schema_migrations (version) VALUES ('20151112160452'); - -INSERT INTO schema_migrations (version) VALUES ('20151117081204'); - -INSERT INTO schema_migrations (version) VALUES ('20151120090455'); - -INSERT INTO schema_migrations (version) VALUES ('20151124200353'); - -INSERT INTO schema_migrations (version) VALUES ('20151125155601'); - -INSERT INTO schema_migrations (version) VALUES ('20151127091716'); - -INSERT INTO schema_migrations (version) VALUES ('20151130175654'); - -INSERT INTO schema_migrations (version) VALUES ('20151202123506'); - -INSERT INTO schema_migrations (version) VALUES ('20151209122816'); - -INSERT INTO schema_migrations (version) VALUES ('20160106101725'); - -INSERT INTO schema_migrations (version) VALUES ('20160108135436'); - -INSERT INTO schema_migrations (version) VALUES ('20160113143447'); - -INSERT INTO schema_migrations (version) VALUES ('20160118092453'); - -INSERT INTO schema_migrations (version) VALUES ('20160118092454'); - -INSERT INTO schema_migrations (version) VALUES ('20160218102355'); - -INSERT INTO schema_migrations (version) VALUES ('20160225113801'); - -INSERT INTO schema_migrations (version) VALUES ('20160225113812'); - -INSERT INTO schema_migrations (version) VALUES ('20160226132045'); - -INSERT INTO schema_migrations (version) VALUES ('20160226132056'); - -INSERT INTO schema_migrations (version) VALUES ('20160304125933'); - -INSERT INTO schema_migrations (version) VALUES ('20160311085956'); - -INSERT INTO schema_migrations (version) VALUES ('20160311085957'); - -INSERT INTO schema_migrations (version) VALUES ('20160405131315'); - -INSERT INTO schema_migrations (version) VALUES ('20160411140719'); - -INSERT INTO schema_migrations (version) VALUES ('20160414110443'); - -INSERT INTO schema_migrations (version) VALUES ('20160421074023'); - -INSERT INTO schema_migrations (version) VALUES ('20160429114732'); - -INSERT INTO schema_migrations (version) VALUES ('20160527110738'); - -INSERT INTO schema_migrations (version) VALUES ('20160629114503'); - -INSERT INTO schema_migrations (version) VALUES ('20161004101419'); - -INSERT INTO schema_migrations (version) VALUES ('20161227193500'); - -INSERT INTO schema_migrations (version) VALUES ('20170221115548'); - -INSERT INTO schema_migrations (version) VALUES ('20170419120048'); - -INSERT INTO schema_migrations (version) VALUES ('20170420125200'); - -INSERT INTO schema_migrations (version) VALUES ('20170422130054'); - -INSERT INTO schema_migrations (version) VALUES ('20170422142116'); - -INSERT INTO schema_migrations (version) VALUES ('20170422162824'); - -INSERT INTO schema_migrations (version) VALUES ('20170423151046'); - -INSERT INTO schema_migrations (version) VALUES ('20170423210622'); - -INSERT INTO schema_migrations (version) VALUES ('20170423214500'); - -INSERT INTO schema_migrations (version) VALUES ('20170423222302'); - -INSERT INTO schema_migrations (version) VALUES ('20170423225333'); - -INSERT INTO schema_migrations (version) VALUES ('20170424115801'); - -INSERT INTO schema_migrations (version) VALUES ('20170506144743'); - -INSERT INTO schema_migrations (version) VALUES ('20170506155009'); - -INSERT INTO schema_migrations (version) VALUES ('20170506162952'); - -INSERT INTO schema_migrations (version) VALUES ('20170506205356'); - -INSERT INTO schema_migrations (version) VALUES ('20170506205946'); - -INSERT INTO schema_migrations (version) VALUES ('20170506212014'); - -INSERT INTO schema_migrations (version) VALUES ('20170509215614'); - -INSERT INTO schema_migrations (version) VALUES ('20170604182521'); - -INSERT INTO schema_migrations (version) VALUES ('20170606133501'); - -INSERT INTO schema_migrations (version) VALUES ('20170606150352'); - -INSERT INTO schema_migrations (version) VALUES ('20170606202859'); - -INSERT INTO schema_migrations (version) VALUES ('20171009080822'); - -INSERT INTO schema_migrations (version) VALUES ('20171009082321'); - -INSERT INTO schema_migrations (version) VALUES ('20171025113808'); - -INSERT INTO schema_migrations (version) VALUES ('20171025153841'); - -INSERT INTO schema_migrations (version) VALUES ('20171121233843'); - -INSERT INTO schema_migrations (version) VALUES ('20171123035941'); - -INSERT INTO schema_migrations (version) VALUES ('20180112080312'); - -INSERT INTO schema_migrations (version) VALUES ('20180112084221'); - -INSERT INTO schema_migrations (version) VALUES ('20180112084442'); - -INSERT INTO schema_migrations (version) VALUES ('20180120172042'); - -INSERT INTO schema_migrations (version) VALUES ('20180120172649'); - -INSERT INTO schema_migrations (version) VALUES ('20180120172657'); - -INSERT INTO schema_migrations (version) VALUES ('20180120182712'); - -INSERT INTO schema_migrations (version) VALUES ('20180120183441'); - -INSERT INTO schema_migrations (version) VALUES ('20180121165304'); - -INSERT INTO schema_migrations (version) VALUES ('20180122105335'); - -INSERT INTO schema_migrations (version) VALUES ('20180123154407'); - -INSERT INTO schema_migrations (version) VALUES ('20180123165604'); - -INSERT INTO schema_migrations (version) VALUES ('20180123170112'); - -INSERT INTO schema_migrations (version) VALUES ('20180125092422'); - -INSERT INTO schema_migrations (version) VALUES ('20180126104536'); - -INSERT INTO schema_migrations (version) VALUES ('20180126104903'); - -INSERT INTO schema_migrations (version) VALUES ('20180129143538'); - -INSERT INTO schema_migrations (version) VALUES ('20180129232054'); - -INSERT INTO schema_migrations (version) VALUES ('20180129233223'); - -INSERT INTO schema_migrations (version) VALUES ('20180206213435'); - -INSERT INTO schema_migrations (version) VALUES ('20180206234620'); - -INSERT INTO schema_migrations (version) VALUES ('20180207071528'); - -INSERT INTO schema_migrations (version) VALUES ('20180207072139'); - -INSERT INTO schema_migrations (version) VALUES ('20180211011450'); - -INSERT INTO schema_migrations (version) VALUES ('20180211011948'); - -INSERT INTO schema_migrations (version) VALUES ('20180212123810'); - -INSERT INTO schema_migrations (version) VALUES ('20180212152810'); - -INSERT INTO schema_migrations (version) VALUES ('20180212154731'); - -INSERT INTO schema_migrations (version) VALUES ('20180213183818'); - -INSERT INTO schema_migrations (version) VALUES ('20180214200224'); - -INSERT INTO schema_migrations (version) VALUES ('20180214213743'); - -INSERT INTO schema_migrations (version) VALUES ('20180218004148'); - -INSERT INTO schema_migrations (version) VALUES ('20180228055259'); - -INSERT INTO schema_migrations (version) VALUES ('20180228064342'); - -INSERT INTO schema_migrations (version) VALUES ('20180228070102'); - -INSERT INTO schema_migrations (version) VALUES ('20180228070431'); - -INSERT INTO schema_migrations (version) VALUES ('20180228074442'); - -INSERT INTO schema_migrations (version) VALUES ('20180306180401'); - -INSERT INTO schema_migrations (version) VALUES ('20180306181538'); - -INSERT INTO schema_migrations (version) VALUES ('20180306181554'); - -INSERT INTO schema_migrations (version) VALUES ('20180306181911'); - -INSERT INTO schema_migrations (version) VALUES ('20180306182456'); - -INSERT INTO schema_migrations (version) VALUES ('20180306182758'); - -INSERT INTO schema_migrations (version) VALUES ('20180306182941'); - -INSERT INTO schema_migrations (version) VALUES ('20180306183540'); - -INSERT INTO schema_migrations (version) VALUES ('20180306183549'); - -INSERT INTO schema_migrations (version) VALUES ('20180308123240'); - -INSERT INTO schema_migrations (version) VALUES ('20180309053424'); - -INSERT INTO schema_migrations (version) VALUES ('20180309053921'); - -INSERT INTO schema_migrations (version) VALUES ('20180309054510'); - -INSERT INTO schema_migrations (version) VALUES ('20180310142630'); - -INSERT INTO schema_migrations (version) VALUES ('20180313090437'); - -INSERT INTO schema_migrations (version) VALUES ('20180313124751'); - -INSERT INTO schema_migrations (version) VALUES ('20180314122722'); - -INSERT INTO schema_migrations (version) VALUES ('20180327151906'); - -INSERT INTO schema_migrations (version) VALUES ('20180331200125'); - -INSERT INTO schema_migrations (version) VALUES ('20180422154642'); - -INSERT INTO schema_migrations (version) VALUES ('20180612042234'); - -INSERT INTO schema_migrations (version) VALUES ('20180612042625'); - -INSERT INTO schema_migrations (version) VALUES ('20180612042953'); - -INSERT INTO schema_migrations (version) VALUES ('20180613030330'); - -INSERT INTO schema_migrations (version) VALUES ('20180613045614'); - -INSERT INTO schema_migrations (version) VALUES ('20180713154915'); - -INSERT INTO schema_migrations (version) VALUES ('20180808064402'); - -INSERT INTO schema_migrations (version) VALUES ('20180816123540'); - -INSERT INTO schema_migrations (version) VALUES ('20180823161237'); - -INSERT INTO schema_migrations (version) VALUES ('20180823163548'); - -INSERT INTO schema_migrations (version) VALUES ('20180823174331'); - -INSERT INTO schema_migrations (version) VALUES ('20180823212823'); - -INSERT INTO schema_migrations (version) VALUES ('20180824092855'); - -INSERT INTO schema_migrations (version) VALUES ('20180824102834'); - -INSERT INTO schema_migrations (version) VALUES ('20180824215326'); - -INSERT INTO schema_migrations (version) VALUES ('20180825193437'); - -INSERT INTO schema_migrations (version) VALUES ('20180825232819'); - -INSERT INTO schema_migrations (version) VALUES ('20180826162821'); - -INSERT INTO schema_migrations (version) VALUES ('20181001090536'); - -INSERT INTO schema_migrations (version) VALUES ('20181002090319'); - -INSERT INTO schema_migrations (version) VALUES ('20181017092829'); - -INSERT INTO schema_migrations (version) VALUES ('20181017153658'); - -INSERT INTO schema_migrations (version) VALUES ('20181017153812'); - -INSERT INTO schema_migrations (version) VALUES ('20181017153935'); - -INSERT INTO schema_migrations (version) VALUES ('20181017154038'); - -INSERT INTO schema_migrations (version) VALUES ('20181017154143'); - -INSERT INTO schema_migrations (version) VALUES ('20181017205123'); - -INSERT INTO schema_migrations (version) VALUES ('20181022100114'); - -INSERT INTO schema_migrations (version) VALUES ('20181108154921'); - -INSERT INTO schema_migrations (version) VALUES ('20181129150515'); - -INSERT INTO schema_migrations (version) VALUES ('20181212105100'); - -INSERT INTO schema_migrations (version) VALUES ('20181212145456'); - -INSERT INTO schema_migrations (version) VALUES ('20181212145914'); - -INSERT INTO schema_migrations (version) VALUES ('20181213113115'); - -INSERT INTO schema_migrations (version) VALUES ('20181217144701'); - -INSERT INTO schema_migrations (version) VALUES ('20181217144845'); - -INSERT INTO schema_migrations (version) VALUES ('20181220094738'); - -INSERT INTO schema_migrations (version) VALUES ('20181220095053'); - -INSERT INTO schema_migrations (version) VALUES ('20181223153407'); - -INSERT INTO schema_migrations (version) VALUES ('20181226211337'); - -INSERT INTO schema_migrations (version) VALUES ('20181227155537'); - -INSERT INTO schema_migrations (version) VALUES ('20181227172042'); - -INSERT INTO schema_migrations (version) VALUES ('20181230231015'); - -INSERT INTO schema_migrations (version) VALUES ('20190102114702'); - -INSERT INTO schema_migrations (version) VALUES ('20190102115333'); - -INSERT INTO schema_migrations (version) VALUES ('20190102144032'); - -INSERT INTO schema_migrations (version) VALUES ('20190209150026'); - -INSERT INTO schema_migrations (version) VALUES ('20190302091059'); - -INSERT INTO schema_migrations (version) VALUES ('20190302111152'); - -INSERT INTO schema_migrations (version) VALUES ('20190311111718'); - -INSERT INTO schema_migrations (version) VALUES ('20190312211614'); - -INSERT INTO schema_migrations (version) VALUES ('20190315172802'); - -INSERT INTO schema_migrations (version) VALUES ('20190319133036'); - -INSERT INTO schema_migrations (version) VALUES ('20190322152123'); - -INSERT INTO schema_migrations (version) VALUES ('20190322152529'); - -INSERT INTO schema_migrations (version) VALUES ('20190328151516'); - -INSERT INTO schema_migrations (version) VALUES ('20190328151838'); - -INSERT INTO schema_migrations (version) VALUES ('20190415120246'); - -INSERT INTO schema_migrations (version) VALUES ('20190426174225'); - -INSERT INTO schema_migrations (version) VALUES ('20190506100655'); - -INSERT INTO schema_migrations (version) VALUES ('20190510090240'); - -INSERT INTO schema_migrations (version) VALUES ('20190510102549'); - -INSERT INTO schema_migrations (version) VALUES ('20190515113153'); - -INSERT INTO schema_migrations (version) VALUES ('20190516161439'); - -INSERT INTO schema_migrations (version) VALUES ('20190520093231'); - -INSERT INTO schema_migrations (version) VALUES ('20190617120112'); - -INSERT INTO schema_migrations (version) VALUES ('20190617121716'); - -INSERT INTO schema_migrations (version) VALUES ('20190617121949'); - -INSERT INTO schema_migrations (version) VALUES ('20190617122505'); - -INSERT INTO schema_migrations (version) VALUES ('20190620084334'); - -INSERT INTO schema_migrations (version) VALUES ('20190811184334'); - -INSERT INTO schema_migrations (version) VALUES ('20190811195814'); - -INSERT INTO schema_migrations (version) VALUES ('20190811202042'); - -INSERT INTO schema_migrations (version) VALUES ('20190811202347'); - -INSERT INTO schema_migrations (version) VALUES ('20190811202711'); - -INSERT INTO schema_migrations (version) VALUES ('20190811205406'); - -INSERT INTO schema_migrations (version) VALUES ('20190917114907'); - -INSERT INTO schema_migrations (version) VALUES ('20191004095229'); - -INSERT INTO schema_migrations (version) VALUES ('20191004103144'); - -INSERT INTO schema_migrations (version) VALUES ('20191004105643'); - -INSERT INTO schema_migrations (version) VALUES ('20191004105732'); - -INSERT INTO schema_migrations (version) VALUES ('20191004110234'); - -INSERT INTO schema_migrations (version) VALUES ('20191004154844'); - -INSERT INTO schema_migrations (version) VALUES ('20191005162437'); - -INSERT INTO schema_migrations (version) VALUES ('20191007123000'); - -INSERT INTO schema_migrations (version) VALUES ('20191008024334'); - -INSERT INTO schema_migrations (version) VALUES ('20191024153351'); +INSERT INTO "schema_migrations" (version) VALUES +('20140616073945'), +('20140620130107'), +('20140627082711'), +('20140701130945'), +('20140702144833'), +('20140702145448'), +('20140724084927'), +('20140730082358'), +('20140730082532'), +('20140730104916'), +('20140730141443'), +('20140731073300'), +('20140731081816'), +('20140801140249'), +('20140804095654'), +('20140808132327'), +('20140813102245'), +('20140813135408'), +('20140815082619'), +('20140815110028'), +('20140815114000'), +('20140819095802'), +('20140819103517'), +('20140822122938'), +('20140826082057'), +('20140826103454'), +('20140827140759'), +('20140828072329'), +('20140828074404'), +('20140828080320'), +('20140828133057'), +('20140902121843'), +('20140911101310'), +('20140911101604'), +('20140925073340'), +('20140925073734'), +('20140925073831'), +('20140925084916'), +('20140925085340'), +('20140925101927'), +('20140926081324'), +('20140926082627'), +('20140926121409'), +('20140929095329'), +('20140930093039'), +('20141001085322'), +('20141006124904'), +('20141006130306'), +('20141008134959'), +('20141009100818'), +('20141009101337'), +('20141010085152'), +('20141010130412'), +('20141014073435'), +('20141015135255'), +('20141015135742'), +('20141105150721'), +('20141111105931'), +('20141114130737'), +('20141120110330'), +('20141120140837'), +('20141121093125'), +('20141124105221'), +('20141125111414'), +('20141126140434'), +('20141127091027'), +('20141202114457'), +('20141203090115'), +('20141210085432'), +('20141211095604'), +('20141215085117'), +('20141216075056'), +('20141216133831'), +('20141218154829'), +('20141229115619'), +('20150105134026'), +('20150109081914'), +('20150110000000'), +('20150110113257'), +('20150122091556'), +('20150122091557'), +('20150128134352'), +('20150129093938'), +('20150129144652'), +('20150130085458'), +('20150130155904'), +('20150130180452'), +('20150130191056'), +('20150200000000'), +('20150202084444'), +('20150202140346'), +('20150203135303'), +('20150212125339'), +('20150213104014'), +('20150217133755'), +('20150217133937'), +('20150223104842'), +('20150226121252'), +('20150226144723'), +('20150227092508'), +('20150227113121'), +('20150302161712'), +('20150303130729'), +('20150303151224'), +('20150305092921'), +('20150318084300'), +('20150318085110'), +('20150318114921'), +('20150319125655'), +('20150320132023'), +('20150330083700'), +('20150402114712'), +('20150407145943'), +('20150408081917'), +('20150410124724'), +('20150410132037'), +('20150413080832'), +('20150413102310'), +('20150413115829'), +('20150413140933'), +('20150414092249'), +('20150414124630'), +('20150414151357'), +('20150415075408'), +('20150416080828'), +('20150416091357'), +('20150416092026'), +('20150416094704'), +('20150417082723'), +('20150421134820'), +('20150422092514'), +('20150422132631'), +('20150422134243'), +('20150423083308'), +('20150427073517'), +('20150428075052'), +('20150429135339'), +('20150430121807'), +('20150504104922'), +('20150504110926'), +('20150505111437'), +('20150511120755'), +('20150512160938'), +('20150513080013'), +('20150514132606'), +('20150515103222'), +('20150518084324'), +('20150519094929'), +('20150519095416'), +('20150519102521'), +('20150519115050'), +('20150519140853'), +('20150519144118'), +('20150520163237'), +('20150520164507'), +('20150521120145'), +('20150522164020'), +('20150525075550'), +('20150601083516'), +('20150601083800'), +('20150603141549'), +('20150603211318'), +('20150603212659'), +('20150609093515'), +('20150609103333'), +('20150610111019'), +('20150610112238'), +('20150610144547'), +('20150611124920'), +('20150612123111'), +('20150612125720'), +('20150701074344'), +('20150703084206'), +('20150703084632'), +('20150706091724'), +('20150707103241'), +('20150707103801'), +('20150707104937'), +('20150707154543'), +('20150709092549'), +('20150713113436'), +('20150722071128'), +('20150803080914'), +('20150810114746'), +('20150810114747'), +('20150825125118'), +('20150827151906'), +('20150903105659'), +('20150910113839'), +('20150915094707'), +('20150921110152'), +('20150921111842'), +('20151028183132'), +('20151029152638'), +('20151112160452'), +('20151117081204'), +('20151120090455'), +('20151124200353'), +('20151125155601'), +('20151127091716'), +('20151130175654'), +('20151202123506'), +('20151209122816'), +('20160106101725'), +('20160108135436'), +('20160113143447'), +('20160118092453'), +('20160118092454'), +('20160218102355'), +('20160225113801'), +('20160225113812'), +('20160226132045'), +('20160226132056'), +('20160304125933'), +('20160311085956'), +('20160311085957'), +('20160405131315'), +('20160411140719'), +('20160414110443'), +('20160421074023'), +('20160429114732'), +('20160527110738'), +('20160629114503'), +('20161004101419'), +('20161227193500'), +('20170221115548'), +('20170419120048'), +('20170420125200'), +('20170422130054'), +('20170422142116'), +('20170422162824'), +('20170423151046'), +('20170423210622'), +('20170423214500'), +('20170423222302'), +('20170423225333'), +('20170424115801'), +('20170506144743'), +('20170506155009'), +('20170506162952'), +('20170506205356'), +('20170506205946'), +('20170506212014'), +('20170509215614'), +('20170604182521'), +('20170606133501'), +('20170606150352'), +('20170606202859'), +('20171009080822'), +('20171009082321'), +('20171025113808'), +('20171025153841'), +('20171121233843'), +('20171123035941'), +('20180112080312'), +('20180112084221'), +('20180112084442'), +('20180120172042'), +('20180120172649'), +('20180120172657'), +('20180120182712'), +('20180120183441'), +('20180121165304'), +('20180122105335'), +('20180123154407'), +('20180123165604'), +('20180123170112'), +('20180125092422'), +('20180126104536'), +('20180126104903'), +('20180129143538'), +('20180129232054'), +('20180129233223'), +('20180206213435'), +('20180206234620'), +('20180207071528'), +('20180207072139'), +('20180211011450'), +('20180211011948'), +('20180212123810'), +('20180212152810'), +('20180212154731'), +('20180213183818'), +('20180214200224'), +('20180214213743'), +('20180218004148'), +('20180228055259'), +('20180228064342'), +('20180228070102'), +('20180228070431'), +('20180228074442'), +('20180306180401'), +('20180306181538'), +('20180306181554'), +('20180306181911'), +('20180306182456'), +('20180306182758'), +('20180306182941'), +('20180306183540'), +('20180306183549'), +('20180308123240'), +('20180309053424'), +('20180309053921'), +('20180309054510'), +('20180310142630'), +('20180313090437'), +('20180313124751'), +('20180314122722'), +('20180327151906'), +('20180331200125'), +('20180422154642'), +('20180612042234'), +('20180612042625'), +('20180612042953'), +('20180613030330'), +('20180613045614'), +('20180713154915'), +('20180808064402'), +('20180816123540'), +('20180823161237'), +('20180823163548'), +('20180823174331'), +('20180823212823'), +('20180824092855'), +('20180824102834'), +('20180824215326'), +('20180825193437'), +('20180825232819'), +('20180826162821'), +('20181001090536'), +('20181002090319'), +('20181017092829'), +('20181017153658'), +('20181017153812'), +('20181017153935'), +('20181017154038'), +('20181017154143'), +('20181017205123'), +('20181022100114'), +('20181108154921'), +('20181129150515'), +('20181212105100'), +('20181212145456'), +('20181212145914'), +('20181213113115'), +('20181217144701'), +('20181217144845'), +('20181220094738'), +('20181220095053'), +('20181223153407'), +('20181226211337'), +('20181227155537'), +('20181227172042'), +('20181230231015'), +('20190102114702'), +('20190102115333'), +('20190102144032'), +('20190209150026'), +('20190302091059'), +('20190302111152'), +('20190311111718'), +('20190312211614'), +('20190315172802'), +('20190319133036'), +('20190322152123'), +('20190322152529'), +('20190328151516'), +('20190328151838'), +('20190415120246'), +('20190426174225'), +('20190506100655'), +('20190510090240'), +('20190510102549'), +('20190515113153'), +('20190516161439'), +('20190520093231'), +('20190617120112'), +('20190617121716'), +('20190617121949'), +('20190617122505'), +('20190620084334'), +('20190811184334'), +('20190811195814'), +('20190811202042'), +('20190811202347'), +('20190811202711'), +('20190811205406'), +('20190917114907'), +('20191004095229'), +('20191004103144'), +('20191004105643'), +('20191004105732'), +('20191004110234'), +('20191004154844'), +('20191005162437'), +('20191007123000'), +('20191008024334'), +('20191024153351'), +('20191024160038'); -INSERT INTO schema_migrations (version) VALUES ('20191024160038'); diff --git a/lib/action_controller/api.rb b/lib/action_controller/api.rb deleted file mode 100644 index 5a9fd45121..0000000000 --- a/lib/action_controller/api.rb +++ /dev/null @@ -1,149 +0,0 @@ -# frozen_string_literal: true - -require "action_view" -require "action_controller" -require "action_controller/log_subscriber" - -module ActionController - # API Controller is a lightweight version of ActionController::Base, - # created for applications that don't require all functionalities that a complete - # \Rails controller provides, allowing you to create controllers with just the - # features that you need for API only applications. - # - # An API Controller is different from a normal controller in the sense that - # by default it doesn't include a number of features that are usually required - # by browser access only: layouts and templates rendering, cookies, sessions, - # flash, assets, and so on. This makes the entire controller stack thinner, - # suitable for API applications. It doesn't mean you won't have such - # features if you need them: they're all available for you to include in - # your application, they're just not part of the default API controller stack. - # - # Normally, +ApplicationController+ is the only controller that inherits from - # ActionController::API. All other controllers in turn inherit from - # +ApplicationController+. - # - # A sample controller could look like this: - # - # class PostsController < ApplicationController - # def index - # posts = Post.all - # render json: posts - # end - # end - # - # Request, response, and parameters objects all work the exact same way as - # ActionController::Base. - # - # == Renders - # - # The default API Controller stack includes all renderers, which means you - # can use render :json and brothers freely in your controllers. Keep - # in mind that templates are not going to be rendered, so you need to ensure - # your controller is calling either render or redirect_to in - # all actions, otherwise it will return 204 No Content. - # - # def show - # post = Post.find(params[:id]) - # render json: post - # end - # - # == Redirects - # - # Redirects are used to move from one action to another. You can use the - # redirect_to method in your controllers in the same way as in - # ActionController::Base. For example: - # - # def create - # redirect_to root_url and return if not_authorized? - # # do stuff here - # end - # - # == Adding New Behavior - # - # In some scenarios you may want to add back some functionality provided by - # ActionController::Base that is not present by default in - # ActionController::API, for instance MimeResponds. This - # module gives you the respond_to method. Adding it is quite simple, - # you just need to include the module in a specific controller or in - # +ApplicationController+ in case you want it available in your entire - # application: - # - # class ApplicationController < ActionController::API - # include ActionController::MimeResponds - # end - # - # class PostsController < ApplicationController - # def index - # posts = Post.all - # - # respond_to do |format| - # format.json { render json: posts } - # format.xml { render xml: posts } - # end - # end - # end - # - # Make sure to check the modules included in ActionController::Base - # if you want to use any other functionality that is not provided - # by ActionController::API out of the box. - class API < Metal - abstract! - - # Shortcut helper that returns all the ActionController::API modules except - # the ones passed as arguments: - # - # class MyAPIBaseController < ActionController::Metal - # ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left| - # include left - # end - # end - # - # This gives better control over what you want to exclude and makes it easier - # to create an API controller class, instead of listing the modules required - # manually. - def self.without_modules(*modules) - modules = modules.map do |m| - m.is_a?(Symbol) ? ActionController.const_get(m) : m - end - - MODULES - modules - end - - MODULES = [ - AbstractController::Rendering, - - UrlFor, - Redirecting, - ApiRendering, - Renderers::All, - ConditionalGet, - BasicImplicitRender, - StrongParameters, - - ForceSSL, - DataStreaming, - - # Before callbacks should also be executed as early as possible, so - # also include them at the bottom. - AbstractController::Callbacks, - - # Append rescue at the bottom to wrap as much as possible. - Rescue, - - # Add instrumentations hooks at the bottom, to ensure they instrument - # all the methods properly. - Instrumentation, - - # Params wrapper should come before instrumentation so they are - # properly showed in logs - ParamsWrapper - ] - - MODULES.each do |mod| - include mod - end - - ActiveSupport.run_load_hooks(:action_controller_api, self) - ActiveSupport.run_load_hooks(:action_controller, self) - end -end diff --git a/lib/action_controller/api/api_rendering.rb b/lib/action_controller/api/api_rendering.rb deleted file mode 100644 index 52e9f60fc4..0000000000 --- a/lib/action_controller/api/api_rendering.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module ActionController - module ApiRendering - extend ActiveSupport::Concern - - included do - include Rendering - end - - def render_to_body(options = {}) - _process_options(options) - super - end - end -end \ No newline at end of file diff --git a/lib/action_controller/metal/basic_implicit_render.rb b/lib/action_controller/metal/basic_implicit_render.rb deleted file mode 100644 index 9030ea5850..0000000000 --- a/lib/action_controller/metal/basic_implicit_render.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module ActionController - module BasicImplicitRender # :nodoc: - def send_action(method, *args) - super.tap { default_render unless performed? } - end - - def default_render(*args) - head :no_content - end - end -end \ No newline at end of file diff --git a/lib/rails5_api_controller_backport.rb b/lib/rails5_api_controller_backport.rb deleted file mode 100644 index 252332488a..0000000000 --- a/lib/rails5_api_controller_backport.rb +++ /dev/null @@ -1,3 +0,0 @@ -require_relative 'action_controller/metal/basic_implicit_render' -require_relative 'action_controller/api/api_rendering' -require_relative 'action_controller/api' \ No newline at end of file diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 036ecd3829..b31489691f 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -17,7 +17,7 @@ class ApplicationSystemTestCase < ActionDispatch::IntegrationTest end class JavaScriptApplicationSystemTestCase < ApplicationSystemTestCase - self.use_transactional_fixtures = false + self.use_transactional_tests = false DatabaseCleaner.strategy = :truncation Capybara.register_driver(:chrome) do |app| diff --git a/test/integration/admin_area/registrars_test.rb b/test/integration/admin_area/registrars_test.rb index 009e7c6d67..d734968995 100644 --- a/test/integration/admin_area/registrars_test.rb +++ b/test/integration/admin_area/registrars_test.rb @@ -12,7 +12,7 @@ def test_updates_registrar_optional_attributes new_iban = 'GB94BARC10201530093459' assert_not_equal new_iban, @registrar.iban - patch admin_registrar_path(@registrar), registrar: { iban: new_iban } + patch admin_registrar_path(@registrar), params: { registrar: { iban: new_iban } } @registrar.reload assert_equal new_iban, @registrar.iban diff --git a/test/integration/admin_area/zones_test.rb b/test/integration/admin_area/zones_test.rb index cf95aedc5e..468bbd8b65 100644 --- a/test/integration/admin_area/zones_test.rb +++ b/test/integration/admin_area/zones_test.rb @@ -10,7 +10,7 @@ def test_updates_zone new_master_nameserver = 'new.test' assert_not_equal new_master_nameserver, @zone.master_nameserver - patch admin_zone_path(@zone), zone: { master_nameserver: new_master_nameserver } + patch admin_zone_path(@zone), params: { zone: { master_nameserver: new_master_nameserver } } @zone.reload assert_equal new_master_nameserver, @zone.master_nameserver diff --git a/test/integration/api/domain_contacts_test.rb b/test/integration/api/domain_contacts_test.rb index e99a458256..5336cc10a3 100644 --- a/test/integration/api/domain_contacts_test.rb +++ b/test/integration/api/domain_contacts_test.rb @@ -2,9 +2,9 @@ class APIDomainContactsTest < ApplicationIntegrationTest def test_replace_all_tech_contacts_of_the_current_registrar - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'john-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'john-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_nil domains(:shop).tech_contacts.find_by(code: 'william-001') assert domains(:shop).tech_contacts.find_by(code: 'john-001') @@ -14,17 +14,17 @@ def test_replace_all_tech_contacts_of_the_current_registrar def test_skip_discarded_domains domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE]) - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'john-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'john-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert domains(:airport).tech_contacts.find_by(code: 'william-001') end def test_return_affected_domains_in_alphabetical_order - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'john-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'john-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response :ok assert_equal ({ affected_domains: %w[airport.test shop.test], @@ -36,9 +36,9 @@ def test_return_skipped_domains_in_alphabetical_order domains(:shop).update!(statuses: [DomainStatus::DELETE_CANDIDATE]) domains(:airport).update!(statuses: [DomainStatus::DELETE_CANDIDATE]) - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'john-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'john-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response :ok assert_equal %w[airport.test shop.test], JSON.parse(response.body, @@ -46,25 +46,25 @@ def test_return_skipped_domains_in_alphabetical_order end def test_keep_other_tech_contacts_intact - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'john-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'john-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert domains(:shop).tech_contacts.find_by(code: 'acme-ltd-001') end def test_keep_admin_contacts_intact - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'john-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'john-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert domains(:airport).admin_contacts.find_by(code: 'william-001') end def test_restrict_contacts_to_the_current_registrar - patch '/repp/v1/domains/contacts', { current_contact_id: 'jack-001', - new_contact_id: 'william-002' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'jack-001', + new_contact_id: 'william-002' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response :bad_request assert_equal ({ error: { type: 'invalid_request_error', @@ -74,9 +74,9 @@ def test_restrict_contacts_to_the_current_registrar end def test_non_existent_current_contact - patch '/repp/v1/domains/contacts', { current_contact_id: 'non-existent', - new_contact_id: 'john-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'non-existent', + new_contact_id: 'john-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response :bad_request assert_equal ({ error: { type: 'invalid_request_error', param: 'current_contact_id', @@ -85,9 +85,9 @@ def test_non_existent_current_contact end def test_non_existent_new_contact - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'non-existent' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'non-existent' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response :bad_request assert_equal ({ error: { type: 'invalid_request_error', param: 'new_contact_id', @@ -96,9 +96,9 @@ def test_non_existent_new_contact end def test_disallow_invalid_new_contact - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'invalid' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'invalid' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response :bad_request assert_equal ({ error: { type: 'invalid_request_error', param: 'new_contact_id', @@ -107,9 +107,9 @@ def test_disallow_invalid_new_contact end def test_disallow_self_replacement - patch '/repp/v1/domains/contacts', { current_contact_id: 'william-001', - new_contact_id: 'william-001' }, - { 'HTTP_AUTHORIZATION' => http_auth_key } + patch '/repp/v1/domains/contacts', params: { current_contact_id: 'william-001', + new_contact_id: 'william-001' }, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response :bad_request assert_equal ({ error: { type: 'invalid_request_error', message: 'New contact ID must be different from current contact ID' } }), diff --git a/test/integration/api/domain_transfers_test.rb b/test/integration/api/domain_transfers_test.rb index 7cd0874c17..aabaeb728f 100644 --- a/test/integration/api/domain_transfers_test.rb +++ b/test/integration/api/domain_transfers_test.rb @@ -13,7 +13,8 @@ class APIDomainTransfersTest < ApplicationIntegrationTest end def test_returns_domain_transfers - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response 200 assert_equal ({ data: [{ type: 'domain_transfer', @@ -26,17 +27,20 @@ def test_returns_domain_transfers def test_creates_new_domain_transfer assert_difference -> { @domain.transfers.size } do - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } end end def test_approves_automatically_if_auto_approval_is_enabled - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert @domain.transfers.last.approved? end def test_assigns_new_registrar - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } @domain.reload assert_equal @new_registrar, @domain.registrar end @@ -44,7 +48,8 @@ def test_assigns_new_registrar def test_regenerates_transfer_code @old_transfer_code = @domain.transfer_code - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } @domain.reload refute_equal @domain.transfer_code, @old_transfer_code end @@ -53,34 +58,41 @@ def test_notifies_old_registrar @old_registrar = @domain.registrar assert_difference -> { @old_registrar.notifications.count } do - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } end end def test_duplicates_registrant_admin_and_tech_contacts assert_difference -> { @new_registrar.contacts.size }, 3 do - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } end end def test_reuses_identical_contact - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', params: request_params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_equal 1, @new_registrar.contacts.where(name: 'William').size end def test_fails_if_domain_does_not_exist - request_params = { format: :json, - data: { domainTransfers: [{ domainName: 'non-existent.test', transferCode: 'any' }] } } - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', + params: { data: { domainTransfers: [{ domainName: 'non-existent.test', + transferCode: 'any' }] } }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response 400 assert_equal ({ errors: [{ title: 'non-existent.test does not exist' }] }), JSON.parse(response.body, symbolize_names: true) end def test_fails_if_transfer_code_is_wrong - request_params = { format: :json, - data: { domainTransfers: [{ domainName: 'shop.test', transferCode: 'wrong' }] } } - post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + post '/repp/v1/domain_transfers', + params: { data: { domainTransfers: [{ domainName: 'shop.test', + transferCode: 'wrong' }] } }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response 400 refute_equal @new_registrar, @domain.registrar assert_equal ({ errors: [{ title: 'shop.test transfer code is wrong' }] }), @@ -90,8 +102,7 @@ def test_fails_if_transfer_code_is_wrong private def request_params - { format: :json, - data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } } + { data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } } end def http_auth_key diff --git a/test/integration/api/nameservers/put_test.rb b/test/integration/api/nameservers/put_test.rb index 4c35d3e778..853a20549a 100644 --- a/test/integration/api/nameservers/put_test.rb +++ b/test/integration/api/nameservers/put_test.rb @@ -5,18 +5,23 @@ def test_replaces_registrar_nameservers old_nameserver_ids = [nameservers(:shop_ns1).id, nameservers(:airport_ns1).id, nameservers(:metro_ns1).id] - request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test', - attributes: { hostname: 'ns55.bestnames.test' } } } - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } - assert_empty (old_nameserver_ids & registrars(:bestnames).nameservers(true).ids) + params = { data: { type: 'nameserver', + id: 'ns1.bestnames.test', + attributes: { hostname: 'ns55.bestnames.test' } } } + + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } + + assert_empty (old_nameserver_ids & registrars(:bestnames).nameservers.reload.ids) end def test_saves_all_attributes - request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test', - attributes: { hostname: 'ns55.bestnames.test', - ipv4: ['192.0.2.55'], - ipv6: ['2001:db8::55'] } } } - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + params = { data: { type: 'nameserver', id: 'ns1.bestnames.test', + attributes: { hostname: 'ns55.bestnames.test', + ipv4: ['192.0.2.55'], + ipv6: ['2001:db8::55'] } } } + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } new_nameserver = domains(:shop).nameservers.find_by(hostname: 'ns55.bestnames.test') assert_equal ['192.0.2.55'], new_nameserver.ipv4 @@ -24,52 +29,60 @@ def test_saves_all_attributes end def test_keeps_other_nameserver_intact - request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test', - attributes: { hostname: 'ns55.bestnames.test' } } } + params = { data: { type: 'nameserver', id: 'ns1.bestnames.test', + attributes: { hostname: 'ns55.bestnames.test' } } } other_nameserver_hash = nameservers(:shop_ns2).attributes - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } + assert_equal other_nameserver_hash, nameservers(:shop_ns2).reload.attributes end def test_keeps_other_registrar_nameservers_intact - request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test', - attributes: { hostname: 'ns55.bestnames.test' } } } + params = { data: { type: 'nameserver', id: 'ns1.bestnames.test', + attributes: { hostname: 'ns55.bestnames.test' } } } nameserver_hash = nameservers(:metro_ns1).attributes - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } + assert_equal nameserver_hash, nameservers(:metro_ns1).reload.attributes end def test_returns_new_nameserver_record_and_affected_domain - request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test', - attributes: { hostname: 'ns55.bestnames.test', - ipv4: ['192.0.2.55'], - ipv6: ['2001:db8::55'] } } } + params = { data: { type: 'nameserver', id: 'ns1.bestnames.test', + attributes: { hostname: 'ns55.bestnames.test', + ipv4: ['192.0.2.55'], + ipv6: ['2001:db8::55'] } } } - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response 200 assert_equal ({ data: { type: 'nameserver', id: 'ns55.bestnames.test', attributes: { hostname: 'ns55.bestnames.test', ipv4: ['192.0.2.55'], - ipv6: ['2001:db8::55'] }}, + ipv6: ['2001:db8::55'] } }, affected_domains: ["airport.test", "shop.test"] }), JSON.parse(response.body, symbolize_names: true) end def test_optional_params - request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test', - attributes: { hostname: 'ns55.bestnames.test' } } } - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + params = { data: { type: 'nameserver', id: 'ns1.bestnames.test', + attributes: { hostname: 'ns55.bestnames.test' } } } + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } + assert_response 200 end def test_non_existent_nameserver_hostname - request_params = { format: :json, data: { type: 'nameserver', id: 'non-existent.test', - attributes: { hostname: 'any.bestnames.test' } } } - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + params = { data: { type: 'nameserver', id: 'non-existent.test', + attributes: { hostname: 'any.bestnames.test' } } } + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response 404 assert_equal ({ errors: [{ title: 'Hostname non-existent.test does not exist' }] }), @@ -77,9 +90,10 @@ def test_non_existent_nameserver_hostname end def test_invalid_request_params - request_params = { format: :json, data: { type: 'nameserver', id: 'ns1.bestnames.test', - attributes: { hostname: '' } } } - put '/repp/v1/registrar/nameservers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key } + params = { data: { type: 'nameserver', id: 'ns1.bestnames.test', + attributes: { hostname: '' } } } + put '/repp/v1/registrar/nameservers', params: params, as: :json, + headers: { 'HTTP_AUTHORIZATION' => http_auth_key } assert_response 400 assert_equal ({ errors: [{ title: 'Hostname is missing' }] }), diff --git a/test/integration/api/registrant/registrant_api_authentication_test.rb b/test/integration/api/registrant/registrant_api_authentication_test.rb index 10858d005e..9daeabfcac 100644 --- a/test/integration/api/registrant/registrant_api_authentication_test.rb +++ b/test/integration/api/registrant/registrant_api_authentication_test.rb @@ -20,7 +20,7 @@ def test_request_creates_user_when_one_does_not_exist last_name: 'Smith', } - post '/api/v1/registrant/auth/eid', params + post '/api/v1/registrant/auth/eid', params: params assert(User.find_by(registrant_ident: 'EE-30110100103')) json = JSON.parse(response.body, symbolize_names: true) @@ -29,7 +29,7 @@ def test_request_creates_user_when_one_does_not_exist def test_request_returns_existing_user assert_no_changes User.count do - post '/api/v1/registrant/auth/eid', @user_hash + post '/api/v1/registrant/auth/eid', params: @user_hash end end @@ -38,7 +38,7 @@ def test_request_returns_401_from_a_not_whitelisted_ip @original_whitelist_ip = ENV['registrant_api_auth_allowed_ips'] ENV['registrant_api_auth_allowed_ips'] = '1.2.3.4' - post '/api/v1/registrant/auth/eid', params + post '/api/v1/registrant/auth/eid', params: params assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) @@ -50,7 +50,7 @@ def test_request_returns_401_from_a_not_whitelisted_ip def test_request_documented_parameters_are_required params = { foo: :bar, test: :test } - post '/api/v1/registrant/auth/eid', params + post '/api/v1/registrant/auth/eid', params: params json = JSON.parse(response.body, symbolize_names: true) assert_equal({ errors: [{ ident: ['parameter is required'] }] }, json) assert_equal(422, response.status) diff --git a/test/integration/api/registrant/registrant_api_contacts_test.rb b/test/integration/api/registrant/registrant_api_contacts_test.rb index 0658ecac1a..c2950a5f8b 100644 --- a/test/integration/api/registrant/registrant_api_contacts_test.rb +++ b/test/integration/api/registrant/registrant_api_contacts_test.rb @@ -14,18 +14,19 @@ def test_root_accepts_limit_and_offset_parameters contacts(:william).update!(ident: '1234', ident_type: 'priv', ident_country_code: 'US') assert_equal 3, @user.contacts.size - get '/api/v1/registrant/contacts', { 'limit' => 1, 'offset' => 0 }, @auth_headers + get '/api/v1/registrant/contacts', params: { 'limit' => 1, 'offset' => 0 }, + headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(200, response.status) assert_equal(1, response_json.count) - get '/api/v1/registrant/contacts', {}, @auth_headers + get '/api/v1/registrant/contacts', headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(3, response_json.count) end def test_get_contact_details_by_uuid - get api_v1_registrant_contact_path(@contact.uuid), nil, @auth_headers + get api_v1_registrant_contact_path(@contact.uuid), headers: @auth_headers assert_response :ok response_json = JSON.parse(response.body, symbolize_names: true) @@ -33,21 +34,23 @@ def test_get_contact_details_by_uuid end def test_root_does_not_accept_limit_higher_than_200 - get '/api/v1/registrant/contacts', { 'limit' => 400, 'offset' => 0 }, @auth_headers + get '/api/v1/registrant/contacts', params: { 'limit' => 400, 'offset' => 0 }, + headers: @auth_headers assert_equal(400, response.status) response_json = JSON.parse(response.body, symbolize_names: true) assert_equal({ errors: [{ limit: ['parameter is out of range'] }] }, response_json) end def test_root_does_not_accept_offset_lower_than_0 - get '/api/v1/registrant/contacts', { 'limit' => 200, 'offset' => "-10" }, @auth_headers + get '/api/v1/registrant/contacts', params: { 'limit' => 200, 'offset' => "-10" }, + headers: @auth_headers assert_equal(400, response.status) response_json = JSON.parse(response.body, symbolize_names: true) assert_equal({ errors: [{ offset: ['parameter is out of range'] }] }, response_json) end def test_root_returns_401_without_authorization - get '/api/v1/registrant/contacts', {}, {} + get '/api/v1/registrant/contacts' assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) diff --git a/test/integration/api/registrant/registrant_api_cors_headers_test.rb b/test/integration/api/registrant/registrant_api_cors_headers_test.rb index 6bb768bc38..3b9fa46dcc 100644 --- a/test/integration/api/registrant/registrant_api_cors_headers_test.rb +++ b/test/integration/api/registrant/registrant_api_cors_headers_test.rb @@ -2,13 +2,13 @@ class RegistrantApiCorsHeadersTest < ApplicationIntegrationTest def test_returns_200_response_code_for_options_request - options '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' } - + process :options, api_v1_registrant_auth_eid_path, + headers: { 'Origin' => 'https://example.com' } assert_equal('200', response.code) end def test_returns_expected_headers_for_options_requests - options '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' } + process :options, api_v1_registrant_auth_eid_path, headers: { 'Origin' => 'https://example.com' } assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin']) assert_equal('POST, GET, PUT, PATCH, DELETE, OPTIONS', @@ -20,16 +20,15 @@ def test_returns_expected_headers_for_options_requests end def test_returns_empty_body - options '/api/v1/registrant/auth/eid', { 'Origin' => 'https://example.com' } - + process :options, api_v1_registrant_auth_eid_path, headers: { 'Origin' => 'https://example.com' } assert_equal('', response.body) end def test_it_returns_cors_headers_for_other_requests - post '/api/v1/registrant/auth/eid', {}, { 'Origin' => 'https://example.com' } + post '/api/v1/registrant/auth/eid', headers: { 'Origin' => 'https://example.com' } assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin']) - get '/api/v1/registrant/contacts', {}, { 'Origin' => 'https://example.com' } + get '/api/v1/registrant/contacts', headers: { 'Origin' => 'https://example.com' } assert_equal('https://example.com', response.headers['Access-Control-Allow-Origin']) end end diff --git a/test/integration/api/registrant/registrant_api_domains_test.rb b/test/integration/api/registrant/registrant_api_domains_test.rb index 9095323f2c..354ceb567a 100644 --- a/test/integration/api/registrant/registrant_api_domains_test.rb +++ b/test/integration/api/registrant/registrant_api_domains_test.rb @@ -12,7 +12,7 @@ def setup end def test_get_domain_details_by_uuid - get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', {}, @auth_headers + get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', headers: @auth_headers assert_equal(200, response.status) domain = JSON.parse(response.body, symbolize_names: true) @@ -30,7 +30,7 @@ def test_get_domain_details_by_uuid end def test_get_non_existent_domain_details_by_uuid - get '/api/v1/registrant/domains/random-uuid', {}, @auth_headers + get '/api/v1/registrant/domains/random-uuid', headers: @auth_headers assert_equal(404, response.status) response_json = JSON.parse(response.body, symbolize_names: true) @@ -38,7 +38,7 @@ def test_get_non_existent_domain_details_by_uuid end def test_root_returns_domain_list - get '/api/v1/registrant/domains', {}, @auth_headers + get '/api/v1/registrant/domains', headers: @auth_headers assert_equal(200, response.status) response_json = JSON.parse(response.body, symbolize_names: true) @@ -50,20 +50,22 @@ def test_root_returns_domain_list end def test_root_accepts_limit_and_offset_parameters - get '/api/v1/registrant/domains', { 'limit' => 2, 'offset' => 0 }, @auth_headers + get '/api/v1/registrant/domains', params: { 'limit' => 2, 'offset' => 0 }, + headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(200, response.status) assert_equal(2, response_json.count) - get '/api/v1/registrant/domains', {}, @auth_headers + get '/api/v1/registrant/domains', headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(4, response_json.count) end def test_root_does_not_accept_limit_higher_than_200 - get '/api/v1/registrant/domains', { 'limit' => 400, 'offset' => 0 }, @auth_headers + get '/api/v1/registrant/domains', params: { 'limit' => 400, 'offset' => 0 }, + headers: @auth_headers assert_equal(400, response.status) response_json = JSON.parse(response.body, symbolize_names: true) @@ -71,7 +73,8 @@ def test_root_does_not_accept_limit_higher_than_200 end def test_root_does_not_accept_offset_lower_than_0 - get '/api/v1/registrant/domains', { 'limit' => 200, 'offset' => "-10" }, @auth_headers + get '/api/v1/registrant/domains', params: { 'limit' => 200, 'offset' => "-10" }, + headers: @auth_headers assert_equal(400, response.status) response_json = JSON.parse(response.body, symbolize_names: true) @@ -79,7 +82,7 @@ def test_root_does_not_accept_offset_lower_than_0 end def test_root_returns_401_without_authorization - get '/api/v1/registrant/domains', {}, {} + get '/api/v1/registrant/domains' assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) @@ -87,7 +90,7 @@ def test_root_returns_401_without_authorization end def test_details_returns_401_without_authorization - get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37', {}, {} + get '/api/v1/registrant/domains/5edda1a5-3548-41ee-8b65-6d60daf85a37' assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) diff --git a/test/integration/api/registrant/registrant_api_registry_locks_test.rb b/test/integration/api/registrant/registrant_api_registry_locks_test.rb index 049345fb50..4babdf4286 100644 --- a/test/integration/api/registrant/registrant_api_registry_locks_test.rb +++ b/test/integration/api/registrant/registrant_api_registry_locks_test.rb @@ -12,7 +12,7 @@ def setup def test_can_lock_a_not_locked_domain post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', - {}, @auth_headers + headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) @@ -27,7 +27,7 @@ def test_can_lock_a_not_locked_domain def test_locking_a_domain_creates_a_version_record assert_difference '@domain.versions.count', 1 do post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', - {}, @auth_headers + headers: @auth_headers end @domain.reload @@ -39,7 +39,7 @@ def test_cannot_lock_a_domain_in_pending_state @domain.save post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', - {}, @auth_headers + headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(422, response.status) @@ -51,7 +51,7 @@ def test_cannot_lock_an_already_locked_domain assert(@domain.locked_by_registrant?) post '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', - {}, @auth_headers + headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(422, response.status) @@ -62,7 +62,7 @@ def test_can_unlock_a_locked_domain @domain.apply_registry_lock delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', - {}, @auth_headers + headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert(response_json[:statuses].include?(DomainStatus::OK)) @@ -73,7 +73,7 @@ def test_can_unlock_a_locked_domain def test_cannot_unlock_a_not_locked_domain delete '/api/v1/registrant/domains/2df2c1a1-8f6a-490a-81be-8bdf29866880/registry_lock', - {}, @auth_headers + headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(422, response.status) @@ -81,8 +81,7 @@ def test_cannot_unlock_a_not_locked_domain end def test_returns_404_when_domain_is_not_found - post '/api/v1/registrant/domains/random-uuid/registry_lock', - {}, @auth_headers + post '/api/v1/registrant/domains/random-uuid/registry_lock', headers: @auth_headers response_json = JSON.parse(response.body, symbolize_names: true) assert_equal(404, response.status) @@ -99,7 +98,7 @@ def test_technical_contact_cannot_lock_a_domain assert_equal '1234', contact.ident assert_equal 'US', contact.ident_country_code - post api_v1_registrant_domain_registry_lock_path(domain.uuid), nil, @auth_headers + post api_v1_registrant_domain_registry_lock_path(domain.uuid), headers: @auth_headers assert_response :unauthorized response_json = JSON.parse(response.body, symbolize_names: true) @@ -109,7 +108,7 @@ def test_technical_contact_cannot_lock_a_domain def test_registrant_can_lock_a_domain post '/api/v1/registrant/domains/1b3ee442-e8fe-4922-9492-8fcb9dccc69c/registry_lock', - {}, @auth_headers + headers: @auth_headers assert_equal(200, response.status) response_json = JSON.parse(response.body, symbolize_names: true) @@ -125,7 +124,7 @@ def test_locking_domains_returns_serialized_domain_object assert_equal 'https://bestnames.test', @domain.registrar.website post '/api/v1/registrant/domains/1b3ee442-e8fe-4922-9492-8fcb9dccc69c/registry_lock', - {}, @auth_headers + headers: @auth_headers assert_equal(200, response.status) response_json = JSON.parse(response.body, symbolize_names: true) diff --git a/test/integration/api/v1/auctions/details_test.rb b/test/integration/api/v1/auctions/details_test.rb index 996151cee2..f1cab52af6 100644 --- a/test/integration/api/v1/auctions/details_test.rb +++ b/test/integration/api/v1/auctions/details_test.rb @@ -15,18 +15,18 @@ def test_returns_auction_details assert_equal 'auction.test', @auction.domain assert_equal Auction.statuses[:no_bids], @auction.status - get api_v1_auction_path(@auction.uuid), nil, 'Content-Type' => Mime::JSON.to_s + get api_v1_auction_path(@auction.uuid), as: :json assert_response :ok assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c', 'domain' => 'auction.test', 'status' => Auction.statuses[:no_bids] }), ActiveSupport::JSON - .decode(response.body) + .decode(response.body) end def test_auction_not_found assert_raises ActiveRecord::RecordNotFound do - get api_v1_auction_path('non-existing-uuid'), nil, 'Content-Type' => Mime::JSON.to_s + get api_v1_auction_path('non-existing-uuid'), as: :json end end end \ No newline at end of file diff --git a/test/integration/api/v1/auctions/list_test.rb b/test/integration/api/v1/auctions/list_test.rb index 3dfaff39ea..ae3f4338fd 100644 --- a/test/integration/api/v1/auctions/list_test.rb +++ b/test/integration/api/v1/auctions/list_test.rb @@ -10,19 +10,19 @@ def test_returns_started_auctions_without_authentication domain: 'auction.test', status: Auction.statuses[:started]) - get api_v1_auctions_path, nil, 'Content-Type' => Mime::JSON.to_s + get api_v1_auctions_path, as: :json assert_response :ok assert_equal ([{ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c', 'domain' => 'auction.test', 'status' => Auction.statuses[:started] }]), ActiveSupport::JSON - .decode(response.body) + .decode(response.body) end def test_does_not_return_finished_auctions @auction.update!(domain: 'auction.test', status: Auction.statuses[:awaiting_payment]) - get api_v1_auctions_path, nil, 'Content-Type' => Mime::JSON.to_s + get api_v1_auctions_path, as: :json assert_response :ok assert_empty ActiveSupport::JSON.decode(response.body) diff --git a/test/integration/api/v1/auctions/update_test.rb b/test/integration/api/v1/auctions/update_test.rb index 64b3a92f56..fe4d075b0a 100644 --- a/test/integration/api/v1/auctions/update_test.rb +++ b/test/integration/api/v1/auctions/update_test.rb @@ -20,47 +20,53 @@ def test_returns_auction_details assert_equal '1b3ee442-e8fe-4922-9492-8fcb9dccc69c', @auction.uuid assert_equal 'auction.test', @auction.domain - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:awaiting_payment] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:awaiting_payment] }, + as: :json assert_response :ok assert_equal ({ 'id' => '1b3ee442-e8fe-4922-9492-8fcb9dccc69c', 'domain' => 'auction.test', 'status' => Auction.statuses[:awaiting_payment] }), ActiveSupport::JSON - .decode(response.body) + .decode(response.body) end def test_marks_as_awaiting_payment - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:awaiting_payment] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:awaiting_payment] }, + as: :json @auction.reload assert @auction.awaiting_payment? end def test_marks_as_no_bids - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:no_bids] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:no_bids] }, + as: :json @auction.reload assert @auction.no_bids? end def test_marks_as_payment_received - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:payment_received] }, + as: :json @auction.reload assert @auction.payment_received? end def test_marks_as_payment_not_received - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_not_received] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:payment_not_received] }, + as: :json @auction.reload assert @auction.payment_not_received? end def test_marks_as_domain_not_registered - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:domain_not_registered] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:domain_not_registered] }, + as: :json @auction.reload assert @auction.domain_not_registered? end @@ -69,8 +75,9 @@ def test_reveals_registration_code_when_payment_is_received @auction.update!(registration_code: 'auction-001', status: Auction.statuses[:awaiting_payment]) - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:payment_received] }, + as: :json response_json = ActiveSupport::JSON.decode(response.body) assert_not_nil response_json['registration_code'] @@ -79,8 +86,9 @@ def test_reveals_registration_code_when_payment_is_received def test_conceals_registration_code_when_payment_is_not_received @auction.update!(status: Auction.statuses[:awaiting_payment]) - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_not_received] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:payment_not_received] }, + as: :json response_json = ActiveSupport::JSON.decode(response.body) assert_nil response_json['registration_code'] @@ -91,8 +99,9 @@ def test_updates_whois assert_equal 'auction.test', @auction.domain @whois_record.update!(updated_at: '2010-07-04') - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:payment_received] }, + as: :json @whois_record.reload assert_equal Time.zone.parse('2010-07-05 10:00'), @whois_record.updated_at @@ -103,8 +112,9 @@ def test_creates_whois_record_if_does_not_exist assert_equal 'auction.test', @auction.domain @whois_record.delete - patch api_v1_auction_path(@auction.uuid), { status: Auction.statuses[:payment_received] } - .to_json, 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), + params: { status: Auction.statuses[:payment_received] }, + as: :json new_whois_record = Whois::Record.find_by(name: @auction.domain) assert_equal Time.zone.parse('2010-07-05 10:00'), new_whois_record.updated_at @@ -114,16 +124,16 @@ def test_creates_whois_record_if_does_not_exist def test_inaccessible_when_ip_address_is_not_allowed ENV['auction_api_allowed_ips'] = '' - patch api_v1_auction_path(@auction.uuid), { status: 'any' }.to_json, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path(@auction.uuid), params: { status: 'any' }, as: :json assert_response :unauthorized end def test_auction_not_found assert_raises ActiveRecord::RecordNotFound do - patch api_v1_auction_path('non-existing-uuid'), { status: Auction.statuses[:no_bids] }.to_json, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_auction_path('non-existing-uuid'), + params: { status: Auction.statuses[:no_bids] }, + as: :json end end end diff --git a/test/integration/api/v1/registrant/contacts/details_test.rb b/test/integration/api/v1/registrant/contacts/details_test.rb index 073c8e2b8c..901d5be924 100644 --- a/test/integration/api/v1/registrant/contacts/details_test.rb +++ b/test/integration/api/v1/registrant/contacts/details_test.rb @@ -14,8 +14,8 @@ class RegistrantApiV1ContactDetailsTest < ActionDispatch::IntegrationTest end def test_returns_contact_details - get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token, - 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contact_path(@contact.uuid), as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :ok assert_equal ({ id: @contact.uuid, @@ -43,8 +43,8 @@ def test_returns_contact_details end def test_non_existent_contact - get api_v1_registrant_contact_path('non-existent'), nil, 'HTTP_AUTHORIZATION' => auth_token, - 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contact_path('non-existent'), as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :not_found assert_equal({ errors: [base: ['Contact not found']] }, JSON.parse(response.body, @@ -52,7 +52,7 @@ def test_non_existent_contact end def test_anonymous_user - get api_v1_registrant_contact_path(@contact.uuid), nil, 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contact_path(@contact.uuid) assert_response :unauthorized assert_equal({ errors: [base: ['Not authorized']] }, JSON.parse(response.body, @@ -66,8 +66,8 @@ def test_returns_direct_contact_when_company_register_is_unavailable assert_equal 'US-1234', @user.registrant_ident CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do - get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token, - 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contact_path(@contact.uuid), as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } end response_json = JSON.parse(response.body, symbolize_names: true) @@ -78,8 +78,8 @@ def test_unmanaged_contact_cannot_be_accessed assert_equal 'US-1234', @user.registrant_ident @contact.update!(ident: '12345') - get api_v1_registrant_contact_path(@contact.uuid), nil, 'HTTP_AUTHORIZATION' => auth_token, - 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contact_path(@contact.uuid), as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :not_found response_json = JSON.parse(response.body, symbolize_names: true) diff --git a/test/integration/api/v1/registrant/contacts/list_test.rb b/test/integration/api/v1/registrant/contacts/list_test.rb index 36b5cf6e30..864d56c0d5 100644 --- a/test/integration/api/v1/registrant/contacts/list_test.rb +++ b/test/integration/api/v1/registrant/contacts/list_test.rb @@ -20,8 +20,7 @@ def test_returns_direct_contacts assert_equal 'US', @contact.ident_country_code assert_equal 'US-1234', @user.registrant_ident - get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token, - 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contacts_path, as: :json, headers: { 'HTTP_AUTHORIZATION' => auth_token } response_json = JSON.parse(response.body, symbolize_names: true) assert_equal 1, response_json.size @@ -33,8 +32,7 @@ def test_returns_indirect_contacts @contact = contacts(:acme_ltd) assert_equal 'acme-ltd-001', @contact.code - get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token, - 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contacts_path, as: :json, headers: { 'HTTP_AUTHORIZATION' => auth_token } response_json = JSON.parse(response.body, symbolize_names: true) assert_equal 1, response_json.size @@ -48,8 +46,8 @@ def test_returns_direct_contacts_when_company_register_is_unavailable assert_equal 'US-1234', @user.registrant_ident CompanyRegister::Client.stub(:new, CompanyRegisterClientStub.new) do - get api_v1_registrant_contacts_path, nil, 'HTTP_AUTHORIZATION' => auth_token, - 'Content-Type' => Mime::JSON.to_s + get api_v1_registrant_contacts_path, as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } end response_json = JSON.parse(response.body, symbolize_names: true) diff --git a/test/integration/api/v1/registrant/contacts/update_test.rb b/test/integration/api/v1/registrant/contacts/update_test.rb index 679ef36e11..6e0c0eea38 100644 --- a/test/integration/api/v1/registrant/contacts/update_test.rb +++ b/test/integration/api/v1/registrant/contacts/update_test.rb @@ -21,12 +21,11 @@ def test_update_contact email: 'john@shop.test', phone: '+111.1') - patch api_v1_registrant_contact_path(@contact.uuid), { name: 'William', - email: 'william@shop.test', - phone: '+222.2' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'William', + email: 'william@shop.test', + phone: '+222.2' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :ok @contact.reload @@ -37,10 +36,9 @@ def test_update_contact def test_notify_registrar assert_difference -> { @contact.registrar.notifications.count } do - patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } end notification = @contact.registrar.notifications.last assert_equal 'Contact john-001 has been updated by registrant', notification.text @@ -50,10 +48,9 @@ def test_update_fax_when_enabled @contact.update!(fax: '+666.6') ENV['fax_enabled'] = 'true' - patch api_v1_registrant_contact_path(@contact.uuid), { fax: '+777.7' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { fax: '+777.7' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :ok @contact.reload @@ -63,10 +60,9 @@ def test_update_fax_when_enabled def test_fax_cannot_be_updated_when_disabled ENV['fax_enabled'] = 'false' - patch api_v1_registrant_contact_path(@contact.uuid), { fax: '+823.7' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { fax: '+823.7' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :bad_request @contact.reload @@ -80,14 +76,13 @@ def test_fax_cannot_be_updated_when_disabled def test_update_address_when_enabled Setting.address_processing = true - patch api_v1_registrant_contact_path(@contact.uuid), { address: { city: 'new city', - street: 'new street', - zip: '92837', - country_code: 'RU', - state: 'new state' } }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { address: { city: 'new city', + street: 'new street', + zip: '92837', + country_code: 'RU', + state: 'new state' } }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :ok @contact.reload @@ -99,10 +94,9 @@ def test_address_is_optional_when_enabled @contact.update!(street: 'any', zip: 'any', city: 'any', state: 'any', country_code: 'US') Setting.address_processing = true - patch api_v1_registrant_contact_path(@contact.uuid), { name: 'any' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'any' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :ok end @@ -111,11 +105,10 @@ def test_address_cannot_be_updated_when_disabled @contact.update!(street: 'old street') Setting.address_processing = false - patch api_v1_registrant_contact_path(@contact.uuid), { address: { street: 'new street' } } - .to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), + params: { address: { street: 'new street' } }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } @contact.reload assert_response :bad_request @@ -130,10 +123,10 @@ def test_disclose_private_persons_data @contact.update!(ident_type: Contact::PRIV, disclosed_attributes: %w[]) - patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: %w[name] }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), + params: { disclosed_attributes: %w[name] }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } @contact.reload assert_response :ok @@ -143,10 +136,10 @@ def test_disclose_private_persons_data def test_conceal_private_persons_data @contact.update!(ident_type: Contact::PRIV, disclosed_attributes: %w[name]) - patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: [] }.to_json, - { 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s } + patch api_v1_registrant_contact_path(@contact.uuid), + params: { disclosed_attributes: [] }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } @contact.reload @@ -166,11 +159,10 @@ def test_legal_persons_disclosed_attributes_cannot_be_changed assert_equal 'US-1234', @user.registrant_ident assert_no_changes -> { @contact.disclosed_attributes } do - patch api_v1_registrant_contact_path(@contact.uuid), { disclosed_attributes: %w[name] } - .to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), + params: { disclosed_attributes: %w[name] }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } @contact.reload end assert_response :bad_request @@ -182,10 +174,9 @@ def test_legal_persons_disclosed_attributes_cannot_be_changed end def test_return_contact_details - patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_equal ({ id: @contact.uuid, name: 'new name', code: @contact.code, @@ -211,10 +202,9 @@ def test_return_contact_details end def test_errors - patch api_v1_registrant_contact_path(@contact.uuid), { phone: 'invalid' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { phone: 'invalid' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :bad_request assert_equal ({ errors: { phone: ['Phone nr is invalid'] } }), JSON.parse(response.body, @@ -225,10 +215,9 @@ def test_unmanaged_contact_cannot_be_updated assert_equal 'US-1234', @user.registrant_ident @contact.update!(ident: '12345') - patch api_v1_registrant_contact_path(@contact.uuid), { name: 'new name' }.to_json, - 'HTTP_AUTHORIZATION' => auth_token, - 'Accept' => Mime::JSON, - 'Content-Type' => Mime::JSON.to_s + patch api_v1_registrant_contact_path(@contact.uuid), params: { name: 'new name' }, + as: :json, + headers: { 'HTTP_AUTHORIZATION' => auth_token } @contact.reload assert_response :not_found @@ -236,7 +225,8 @@ def test_unmanaged_contact_cannot_be_updated end def test_non_existent_contact - patch api_v1_registrant_contact_path('non-existent'), nil, 'HTTP_AUTHORIZATION' => auth_token + patch api_v1_registrant_contact_path('non-existent'), + headers: { 'HTTP_AUTHORIZATION' => auth_token } assert_response :not_found assert_equal ({ errors: [{ base: ['Not found'] }] }), JSON.parse(response.body, symbolize_names: true) diff --git a/test/integration/epp/base_test.rb b/test/integration/epp/base_test.rb index 6d85318701..456e7b41e8 100644 --- a/test/integration/epp/base_test.rb +++ b/test/integration/epp/base_test.rb @@ -15,8 +15,8 @@ def test_internal_error begin assert_difference 'ApiLog::EppLog.count' do - post '/epp/command/internal_error', { frame: valid_request_xml }, - 'HTTP_COOKIE' => 'session=api_bestnames' + post '/epp/command/internal_error', params: { frame: valid_request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :command_failed rescue @@ -32,7 +32,8 @@ def test_validates_request_xml XML - post valid_command_path, { frame: invalid_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post valid_command_path, params: { frame: invalid_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :syntax_error end @@ -50,8 +51,8 @@ def test_anonymous_user XML - post epp_info_path, { frame: xml_of_epp_command_that_requires_authentication }, - 'HTTP_COOKIE' => 'session=non-existent' + post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authentication }, + headers: { 'HTTP_COOKIE' => 'session=non-existent' } assert_epp_response :authorization_error end @@ -74,8 +75,8 @@ def test_non_authorized_user XML - post epp_info_path, { frame: xml_of_epp_command_that_requires_authorization }, - 'HTTP_COOKIE' => "session=#{session.session_id}" + post epp_info_path, params: { frame: xml_of_epp_command_that_requires_authorization }, + headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" } assert_epp_response :authorization_error end diff --git a/test/integration/epp/contact/base_test.rb b/test/integration/epp/contact/base_test.rb index ef10fdb35a..79bb8579ce 100644 --- a/test/integration/epp/contact/base_test.rb +++ b/test/integration/epp/contact/base_test.rb @@ -14,7 +14,8 @@ def test_non_existent_contact XML - post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_does_not_exist end diff --git a/test/integration/epp/contact/check/base_test.rb b/test/integration/epp/contact/check/base_test.rb index 4e630c94c1..528d69d864 100644 --- a/test/integration/epp/contact/check/base_test.rb +++ b/test/integration/epp/contact/check/base_test.rb @@ -21,7 +21,8 @@ def test_returns_valid_response XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully @@ -42,7 +43,8 @@ def test_contact_is_available XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '1', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail'] @@ -65,7 +67,8 @@ def test_contact_is_unavailable XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '0', response_xml.at_xpath('//contact:id', contact: xml_schema)['avail'] @@ -88,7 +91,8 @@ def test_multiple_contacts XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal 3, response_xml.xpath('//contact:cd', contact: xml_schema).size diff --git a/test/integration/epp/contact/create/base_test.rb b/test/integration/epp/contact/create/base_test.rb index 1f749123cb..0a14f1f4fd 100644 --- a/test/integration/epp/contact/create/base_test.rb +++ b/test/integration/epp/contact/create/base_test.rb @@ -29,7 +29,8 @@ def test_creates_new_contact_with_required_attributes XML assert_difference 'Contact.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :completed_successfully @@ -68,7 +69,8 @@ def test_respects_custom_code XML - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}" + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" } contact = Contact.find_by(name: name) assert_equal "#{session.user.registrar.code}:#{code}".upcase, contact.code @@ -98,7 +100,8 @@ def test_fails_when_required_attributes_are_missing XML assert_no_difference 'Contact.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :required_parameter_missing end diff --git a/test/integration/epp/contact/delete/base_test.rb b/test/integration/epp/contact/delete/base_test.rb index d8ce06c95f..26ba63897b 100644 --- a/test/integration/epp/contact/delete/base_test.rb +++ b/test/integration/epp/contact/delete/base_test.rb @@ -21,7 +21,8 @@ def test_deletes_contact XML assert_difference 'Contact.count', -1 do - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :completed_successfully end @@ -47,7 +48,8 @@ def test_undeletable_cannot_be_deleted XML assert_no_difference 'Contact.count' do - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :object_association_prohibits_operation end @@ -55,7 +57,7 @@ def test_undeletable_cannot_be_deleted private def deletable_contact - Domain.update_all(registrant_id: contacts(:william)) + Domain.update_all(registrant_id: contacts(:william).id) DomainContact.delete_all contacts(:john) end diff --git a/test/integration/epp/contact/info/base_test.rb b/test/integration/epp/contact/info/base_test.rb index 6bfcc896df..23a8398010 100644 --- a/test/integration/epp/contact/info/base_test.rb +++ b/test/integration/epp/contact/info/base_test.rb @@ -29,7 +29,8 @@ def test_returns_valid_response XML - post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully diff --git a/test/integration/epp/contact/transfer/base_test.rb b/test/integration/epp/contact/transfer/base_test.rb index e76fce5e45..2d4ebb62cf 100644 --- a/test/integration/epp/contact/transfer/base_test.rb +++ b/test/integration/epp/contact/transfer/base_test.rb @@ -16,7 +16,8 @@ def test_not_implemented XML - post epp_transfer_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :unimplemented end diff --git a/test/integration/epp/contact/update/base_test.rb b/test/integration/epp/contact/update/base_test.rb index ad5e588625..3d332711f7 100644 --- a/test/integration/epp/contact/update/base_test.rb +++ b/test/integration/epp/contact/update/base_test.rb @@ -37,7 +37,8 @@ def test_updates_contact XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @contact.reload assert_epp_response :completed_successfully @@ -69,7 +70,8 @@ def test_notifies_contact_by_email_when_email_is_changed XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_emails 1 end @@ -97,7 +99,8 @@ def test_skips_notifying_contact_when_email_is_not_changed XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_no_emails end @@ -128,7 +131,8 @@ def test_skips_notifying_a_contact_when_a_contact_is_not_a_registrant XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_no_emails end @@ -154,7 +158,8 @@ def test_non_existing_contact XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_does_not_exist end @@ -188,7 +193,8 @@ def test_ident_code_cannot_be_updated XML assert_no_changes -> { @contact.updated_at } do - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :data_management_policy_violation end @@ -220,7 +226,8 @@ def test_ident_type_and_ident_country_code_can_be_updated_when_absent XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :completed_successfully end @@ -230,6 +237,6 @@ def test_ident_type_and_ident_country_code_can_be_updated_when_absent def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact) other_contact = contacts(:william) assert_not_equal other_contact, contact - Domain.update_all(registrant_id: other_contact) + Domain.update_all(registrant_id: other_contact.id) end end diff --git a/test/integration/epp/domain/base_test.rb b/test/integration/epp/domain/base_test.rb index 125e173a79..34d9fb2bd3 100644 --- a/test/integration/epp/domain/base_test.rb +++ b/test/integration/epp/domain/base_test.rb @@ -14,7 +14,8 @@ def test_non_existent_domain XML - post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_does_not_exist end diff --git a/test/integration/epp/domain/check/auction_test.rb b/test/integration/epp/domain/check/auction_test.rb index 7b4dcb595a..9fee851b65 100644 --- a/test/integration/epp/domain/check/auction_test.rb +++ b/test/integration/epp/domain/check/auction_test.rb @@ -28,7 +28,8 @@ def test_domain_is_unavailable_when_at_auction XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully @@ -52,7 +53,8 @@ def test_idn_ascii_domain_is_unavailable_when_at_auction XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully @@ -76,7 +78,8 @@ def test_idn_unicode_domain_is_unavailable_when_at_auction XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully @@ -100,7 +103,8 @@ def test_domain_is_unavailable_when_awaiting_payment XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully @@ -124,7 +128,8 @@ def test_domain_is_available_when_payment_received XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully diff --git a/test/integration/epp/domain/check/base_test.rb b/test/integration/epp/domain/check/base_test.rb index bed7a5b2f4..5966f62390 100644 --- a/test/integration/epp/domain/check/base_test.rb +++ b/test/integration/epp/domain/check/base_test.rb @@ -15,7 +15,8 @@ def test_returns_valid_response XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully @@ -36,7 +37,8 @@ def test_domain_is_available_when_not_registered_or_blocked XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] @@ -59,7 +61,8 @@ def test_domain_is_available_when_reserved XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '1', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] @@ -80,7 +83,8 @@ def test_domain_is_unavailable_when_format_is_invalid XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] @@ -103,7 +107,8 @@ def test_domain_is_unavailable_when_registered XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] @@ -126,7 +131,8 @@ def test_domain_is_unavailable_when_blocked XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] @@ -149,7 +155,8 @@ def test_domain_is_unavailable_when_zone_with_the_same_origin_exists XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '0', response_xml.at_xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd')['avail'] @@ -172,7 +179,8 @@ def test_multiple_domains XML - post epp_check_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal 3, response_xml.xpath('//domain:cd', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').size diff --git a/test/integration/epp/domain/create/auction_idn_test.rb b/test/integration/epp/domain/create/auction_idn_test.rb index c5e9f840c7..822253ee54 100644 --- a/test/integration/epp/domain/create/auction_idn_test.rb +++ b/test/integration/epp/domain/create/auction_idn_test.rb @@ -39,7 +39,8 @@ def test_domain_with_ascii_idn_cannot_be_registered_without_registration_code XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end refute Domain.where(name: @idn_auction.domain).exists? @@ -73,7 +74,8 @@ def test_domain_with_unicode_idn_cannot_be_registered_without_registration_code XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames'} end refute Domain.where(name: @idn_auction.domain).exists? @@ -106,7 +108,8 @@ def test_domain_with_ascii_idn_cannot_be_registered_without_winning_the_auction XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames'} end refute Domain.where(name: @idn_auction.domain).exists? @@ -139,7 +142,8 @@ def test_domain_with_unicode_idn_cannot_be_registered_without_winning_the_auctio XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames'} end refute Domain.where(name: @idn_auction.domain).exists? @@ -176,7 +180,8 @@ def test_registers_unicode_domain_with_correct_registration_code_when_payment_is XML assert_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames'} end @idn_auction.reload @@ -212,7 +217,8 @@ def test_registers_ascii_domain_with_correct_registration_code_when_payment_is_r XML assert_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames'} end @idn_auction.reload diff --git a/test/integration/epp/domain/create/auction_test.rb b/test/integration/epp/domain/create/auction_test.rb index 863f473a71..7e4c2ecb7a 100644 --- a/test/integration/epp/domain/create/auction_test.rb +++ b/test/integration/epp/domain/create/auction_test.rb @@ -31,7 +31,8 @@ def test_registers_domain_without_registration_code_when_not_at_auction XML assert_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :completed_successfully end @@ -68,7 +69,8 @@ def test_registers_domain_with_correct_registration_code_after_another_auction_w XML assert_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :completed_successfully end @@ -100,7 +102,8 @@ def test_registers_domain_with_correct_registration_code_when_payment_is_receive XML assert_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end @auction.reload @@ -132,7 +135,8 @@ def test_domain_cannot_be_registered_without_registration_code XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :required_parameter_missing end @@ -164,7 +168,8 @@ def test_domain_cannot_be_registered_with_wrong_registration_code XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :invalid_authorization_information end @@ -195,7 +200,8 @@ def test_domain_cannot_be_registered_when_payment_is_not_received XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :required_parameter_missing end @@ -222,7 +228,8 @@ def test_domain_cannot_be_registered_when_at_auction XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :parameter_value_policy_error end diff --git a/test/integration/epp/domain/create/base_test.rb b/test/integration/epp/domain/create/base_test.rb index 8e4d28d7a6..ff8da36964 100644 --- a/test/integration/epp/domain/create/base_test.rb +++ b/test/integration/epp/domain/create/base_test.rb @@ -28,7 +28,8 @@ def test_registers_new_domain_with_required_attributes XML assert_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :completed_successfully @@ -71,7 +72,8 @@ def test_registers_reserved_domain_with_registration_code XML assert_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :completed_successfully @@ -105,7 +107,8 @@ def test_respects_custom_transfer_code XML - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :completed_successfully assert_equal transfer_code, Domain.find_by(name: name).transfer_code @@ -135,7 +138,8 @@ def test_blocked_domain_cannot_be_registered XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :data_management_policy_violation end @@ -164,7 +168,8 @@ def test_reserved_domain_cannot_be_registered_with_wrong_registration_code XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :invalid_authorization_information end @@ -192,7 +197,8 @@ def test_reserved_domain_cannot_be_registered_without_registration_code XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :required_parameter_missing end @@ -220,7 +226,8 @@ def test_insufficient_funds XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => "session=#{session.session_id}" + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" } end assert_epp_response :billing_failure end @@ -248,7 +255,8 @@ def test_no_price XML assert_no_difference 'Domain.count' do - post epp_create_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_create_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :billing_failure end diff --git a/test/integration/epp/domain/delete/base_test.rb b/test/integration/epp/domain/delete/base_test.rb index 0a70afe2e6..59dfa4edb4 100644 --- a/test/integration/epp/domain/delete/base_test.rb +++ b/test/integration/epp/domain/delete/base_test.rb @@ -34,7 +34,7 @@ def test_bypasses_domain_and_registrant_and_contacts_validation XML - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_includes Domain.find_by(name: 'invalid.test').statuses, DomainStatus::PENDING_DELETE_CONFIRMATION assert_epp_response :completed_successfully_action_pending end @@ -62,7 +62,7 @@ def test_discarded_domain_cannot_be_deleted XML assert_no_difference 'Domain.count' do - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :object_status_prohibits_operation end @@ -89,7 +89,7 @@ def test_requests_registrant_confirmation_when_required XML - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert @domain.registrant_verification_asked? @@ -120,7 +120,7 @@ def test_skips_registrant_confirmation_when_not_required XML - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_not @domain.registrant_verification_asked? @@ -151,7 +151,7 @@ def test_skips_registrant_confirmation_when_required_but_already_verified_by_reg XML - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_not @domain.registrant_verification_asked? @@ -176,7 +176,7 @@ def test_legal_document_is_required XML - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :required_parameter_missing end @@ -203,7 +203,7 @@ def test_domain_cannot_be_deleted_when_explicitly_prohibited_by_registrar XML - post epp_delete_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_delete_path, params: { frame: request_xml }, headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_status_prohibits_operation end diff --git a/test/integration/epp/domain/info/base_test.rb b/test/integration/epp/domain/info/base_test.rb index 041c39cf32..26f0ecce1b 100644 --- a/test/integration/epp/domain/info/base_test.rb +++ b/test/integration/epp/domain/info/base_test.rb @@ -21,7 +21,8 @@ def test_returns_valid_response XML - post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully @@ -49,7 +50,8 @@ def test_reveals_transfer_code_when_domain_is_owned_by_current_user XML - post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } response_xml = Nokogiri::XML(response.body) assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text @@ -76,7 +78,8 @@ def test_reveals_transfer_code_when_domain_is_not_owned_by_current_user_and_tran XML - post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames' + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } response_xml = Nokogiri::XML(response.body) assert_equal '65078d5', response_xml.at_xpath('//domain:authInfo/domain:pw', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text @@ -99,7 +102,8 @@ def test_conceals_transfer_code_when_domain_is_not_owned_by_current_user XML - post epp_info_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_goodnames' + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } response_xml = Nokogiri::XML(response.body) assert_nil response_xml.at_xpath('//domain:authInfo/domain:pw', diff --git a/test/integration/epp/domain/renew/base_test.rb b/test/integration/epp/domain/renew/base_test.rb index 6c11f826e1..541aab2a83 100644 --- a/test/integration/epp/domain/renew/base_test.rb +++ b/test/integration/epp/domain/renew/base_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class EppDomainRenewBaseTest < EppTestCase - self.use_transactional_fixtures = false + self.use_transactional_tests = false def test_renews_domain travel_to Time.zone.parse('2010-07-05') @@ -24,7 +24,8 @@ def test_renews_domain XML - post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_renew_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } domain.reload assert_epp_response :completed_successfully @@ -50,7 +51,8 @@ def test_domain_cannot_be_renewed_when_invalid XML assert_no_changes -> { domain.valid_to } do - post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_renew_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } domain.reload end assert_epp_response :object_status_prohibits_operation @@ -77,8 +79,8 @@ def test_domain_cannot_be_renewed_when_belongs_to_another_registrar XML assert_no_changes -> { domain.valid_to } do - post epp_renew_path, { frame: request_xml }, - 'HTTP_COOKIE' => "session=#{session.session_id}" + post epp_renew_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" } domain.reload end assert_epp_response :authorization_error @@ -105,8 +107,8 @@ def test_insufficient_funds XML assert_no_difference -> { domain.valid_to } do - post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => - "session=#{session.session_id}" + post epp_renew_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => "session=#{session.session_id}" } domain.reload end assert_epp_response :billing_failure @@ -132,7 +134,8 @@ def test_no_price XML assert_no_changes -> { domain.valid_to } do - post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_renew_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } domain.reload end assert_epp_response :billing_failure @@ -158,7 +161,8 @@ def test_fails_when_provided_expiration_date_is_wrong XML assert_no_changes -> { domain.valid_to } do - post epp_renew_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_renew_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } domain.reload end assert_epp_response :parameter_value_policy_error diff --git a/test/integration/epp/domain/transfer/query_test.rb b/test/integration/epp/domain/transfer/query_test.rb index 11e59d5ba3..d6f62e2236 100644 --- a/test/integration/epp/domain/transfer/query_test.rb +++ b/test/integration/epp/domain/transfer/query_test.rb @@ -2,7 +2,8 @@ class EppDomainTransferQueryTest < EppTestCase def test_returns_domain_transfer_details - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } xml_doc = Nokogiri::XML(response.body) assert_epp_response :completed_successfully assert_equal 'shop.test', xml_doc.xpath('//domain:name', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text @@ -28,14 +29,16 @@ def test_wrong_transfer_code XML - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :invalid_authorization_information end def test_no_domain_transfer domains(:shop).transfers.delete_all - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_does_not_exist end diff --git a/test/integration/epp/domain/transfer/request_test.rb b/test/integration/epp/domain/transfer/request_test.rb index caa0689995..c7a838ca63 100644 --- a/test/integration/epp/domain/transfer/request_test.rb +++ b/test/integration/epp/domain/transfer/request_test.rb @@ -13,24 +13,28 @@ def teardown end def test_transfers_domain_at_once - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } assert_epp_response :completed_successfully end def test_creates_new_domain_transfer assert_difference -> { @domain.transfers.size } do - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } end end def test_approves_automatically_if_auto_approval_is_enabled - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } assert_equal 'serverApproved', Nokogiri::XML(response.body).xpath('//domain:trStatus', 'domain' => 'https://epp.tld.ee/schema/domain-eis-1.0.xsd').text end def test_assigns_new_registrar - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } @domain.reload assert_equal @new_registrar, @domain.registrar end @@ -38,7 +42,8 @@ def test_assigns_new_registrar def test_regenerates_transfer_code @old_transfer_code = @domain.transfer_code - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } @domain.reload refute_equal @domain.transfer_code, @old_transfer_code @@ -48,31 +53,36 @@ def test_notifies_old_registrar @old_registrar = @domain.registrar assert_difference -> { @old_registrar.notifications.count } do - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } end end def test_duplicates_registrant_admin_and_tech_contacts assert_difference -> { @new_registrar.contacts.size }, 3 do - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } end end def test_reuses_identical_contact - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } assert_equal 1, @new_registrar.contacts.where(name: 'William').size end def test_saves_legal_document - assert_difference -> { @domain.legal_documents(true).size } do - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + assert_difference -> { @domain.legal_documents.reload.size } do + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } end end def test_non_transferable_domain @domain.update!(statuses: [DomainStatus::SERVER_TRANSFER_PROHIBITED]) - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } domains(:shop).reload assert_equal registrars(:bestnames), domains(:shop).registrar @@ -82,7 +92,8 @@ def test_non_transferable_domain def test_discarded_domain_cannot_be_transferred @domain.update!(statuses: [DomainStatus::DELETE_CANDIDATE]) - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } @domain.reload assert_equal registrars(:bestnames), @domain.registrar @@ -91,7 +102,8 @@ def test_discarded_domain_cannot_be_transferred def test_same_registrar assert_no_difference -> { @domain.transfers.size } do - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } end assert_epp_response :use_error end @@ -113,7 +125,8 @@ def test_wrong_transfer_code XML - post epp_transfer_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' } + post epp_transfer_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_goodnames' } @domain.reload assert_epp_response :invalid_authorization_information diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index 29fc1b875b..41c4513736 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -34,7 +34,8 @@ def test_update_domain XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_equal 'f0ff7d17b0', @domain.transfer_code assert_epp_response :completed_successfully @@ -56,7 +57,8 @@ def test_discarded_domain_cannot_be_updated XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_status_prohibits_operation end @@ -76,7 +78,8 @@ def test_does_not_return_server_delete_prohibited_status_when_pending_update_sta XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_status_prohibits_operation response_xml = Nokogiri::XML(response.body) @@ -109,7 +112,8 @@ def test_requires_verification_from_current_registrant_when_provided_registrant_ XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_epp_response :completed_successfully_action_pending @@ -145,7 +149,8 @@ def test_requires_verification_from_current_registrant_when_not_yet_verified_by_ XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_epp_response :completed_successfully_action_pending @@ -179,7 +184,8 @@ def test_skips_verification_when_provided_registrant_is_the_same_as_current_one XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_epp_response :completed_successfully @@ -214,7 +220,8 @@ def test_skips_verification_when_disabled XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_epp_response :completed_successfully @@ -250,7 +257,8 @@ def test_skips_verification_from_current_registrant_when_already_verified_by_reg XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_epp_response :completed_successfully @@ -287,7 +295,8 @@ def test_deactivates_domain_when_all_name_servers_are_removed XML - post epp_update_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } @domain.reload assert_epp_response :completed_successfully diff --git a/test/integration/epp/hello_test.rb b/test/integration/epp/hello_test.rb index c7d5356c29..b2e03c20bd 100644 --- a/test/integration/epp/hello_test.rb +++ b/test/integration/epp/hello_test.rb @@ -9,7 +9,8 @@ def test_anonymous_user_is_able_to_access XML - get epp_hello_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=non-existent' + get epp_hello_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=non-existent' } response_xml = Nokogiri::XML(response.body) assert_equal 'EPP server (EIS)', response_xml.at_css('greeting > svID').text diff --git a/test/integration/epp/login/credentials_test.rb b/test/integration/epp/login/credentials_test.rb index e6cc7742b0..a625797664 100644 --- a/test/integration/epp/login/credentials_test.rb +++ b/test/integration/epp/login/credentials_test.rb @@ -23,7 +23,8 @@ def test_correct_credentials XML - post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' } + post epp_login_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=new_session_id' } assert EppSession.find_by(session_id: 'new_session_id') assert_equal users(:api_bestnames), EppSession.find_by(session_id: 'new_session_id').user assert_epp_response :completed_successfully @@ -55,7 +56,8 @@ def test_wrong_credentials XML - post epp_login_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=any_random_string' + post epp_login_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=any_random_string' } assert_epp_response :authentication_error_server_closing_connection end diff --git a/test/integration/epp/login/password_change_test.rb b/test/integration/epp/login/password_change_test.rb index 4466248a86..3b1834406f 100644 --- a/test/integration/epp/login/password_change_test.rb +++ b/test/integration/epp/login/password_change_test.rb @@ -24,7 +24,8 @@ def test_password_change XML - post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' } + post epp_login_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=new_session_id' } assert_equal 'new-password', users(:api_bestnames).plain_text_password assert_epp_response :completed_successfully end diff --git a/test/integration/epp/login/session_limit_test.rb b/test/integration/epp/login/session_limit_test.rb index f68aac4e4f..f1d83fe7ba 100644 --- a/test/integration/epp/login/session_limit_test.rb +++ b/test/integration/epp/login/session_limit_test.rb @@ -14,7 +14,8 @@ def test_not_reached end assert_difference 'EppSession.count' do - post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' } + post epp_login_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=new_session_id' } end assert_epp_response :completed_successfully end @@ -27,7 +28,8 @@ def test_reached end assert_no_difference 'EppSession.count' do - post epp_login_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=new_session_id' } + post epp_login_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=new_session_id' } end assert_epp_response :authentication_error_server_closing_connection end diff --git a/test/integration/epp/logout_test.rb b/test/integration/epp/logout_test.rb index a578246ae2..62fa06ca94 100644 --- a/test/integration/epp/logout_test.rb +++ b/test/integration/epp/logout_test.rb @@ -2,22 +2,26 @@ class EppLogoutTest < EppTestCase def test_success_response - post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' } + post epp_logout_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :completed_successfully_ending_session end def test_ends_current_session - post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' } + post epp_logout_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_nil EppSession.find_by(session_id: 'api_bestnames') end def test_keeps_other_sessions_intact - post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_bestnames' } + post epp_logout_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert EppSession.find_by(session_id: 'api_goodnames') end def test_anonymous_user - post epp_logout_path, { frame: request_xml }, { 'HTTP_COOKIE' => 'session=non-existent' } + post epp_logout_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=non-existent' } assert_epp_response :authorization_error end diff --git a/test/integration/epp/poll_test.rb b/test/integration/epp/poll_test.rb index 5ccd4258aa..c08b0fd9ac 100644 --- a/test/integration/epp/poll_test.rb +++ b/test/integration/epp/poll_test.rb @@ -15,7 +15,8 @@ def test_return_latest_notification_when_queue_is_not_empty XML - post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_poll_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } xml_doc = Nokogiri::XML(response.body) assert_epp_response :completed_successfully_ack_to_dequeue @@ -36,7 +37,8 @@ def test_return_action_data_when_present XML - post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_poll_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } xml_doc = Nokogiri::XML(response.body) namespace = 'https://epp.tld.ee/schema/changePoll-1.0.xsd' @@ -60,7 +62,8 @@ def test_no_notifications XML - post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_poll_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :completed_successfully_no_messages end @@ -77,7 +80,8 @@ def test_mark_as_read XML - post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_poll_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } notification.reload xml_doc = Nokogiri::XML(response.body) @@ -98,7 +102,8 @@ def test_notification_of_other_registrars_cannot_be_marked_as_read XML - post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_poll_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } notification.reload assert notification.unread? @@ -114,7 +119,8 @@ def test_notification_not_found XML - post epp_poll_path, { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames' + post epp_poll_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert_epp_response :object_does_not_exist end diff --git a/test/integration/registrant_area/sign_in/id_card_test.rb b/test/integration/registrant_area/sign_in/id_card_test.rb index 68f0d408e5..fe6c8a7efd 100644 --- a/test/integration/registrant_area/sign_in/id_card_test.rb +++ b/test/integration/registrant_area/sign_in/id_card_test.rb @@ -6,9 +6,9 @@ class RegistrantAreaIdCardSignInTest < ApplicationIntegrationTest end def test_succeeds - post_via_redirect registrant_id_card_sign_in_path, nil, - 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234', - 'SSL_CLIENT_I_DN_C' => 'US' + post registrant_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234', + 'SSL_CLIENT_I_DN_C' => 'US' } + follow_redirect! assert_response :ok assert_equal registrant_root_path, path @@ -16,7 +16,7 @@ def test_succeeds end def test_fails_when_certificate_is_absent - post_via_redirect registrant_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => '' + post registrant_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => '' } assert_response :ok assert_equal registrant_id_card_sign_in_path, path diff --git a/test/integration/registrar_area/invoices/payment_callback_test.rb b/test/integration/registrar_area/invoices/payment_callback_test.rb index 985b939147..2303158a7a 100644 --- a/test/integration/registrar_area/invoices/payment_callback_test.rb +++ b/test/integration/registrar_area/invoices/payment_callback_test.rb @@ -13,7 +13,7 @@ def test_every_pay_callback_returns_status_200 assert_matching_bank_transaction_exists(invoice) request_params = every_pay_request_params.merge(invoice_id: invoice.id) - post "/registrar/pay/callback/every_pay", request_params + post "/registrar/pay/callback/every_pay", params: request_params assert_response :ok end diff --git a/test/integration/registrar_area/invoices/payment_return_test.rb b/test/integration/registrar_area/invoices/payment_return_test.rb index b6317a0d05..de65cccb0b 100644 --- a/test/integration/registrar_area/invoices/payment_return_test.rb +++ b/test/integration/registrar_area/invoices/payment_return_test.rb @@ -60,7 +60,7 @@ def bank_link_request_params def test_every_pay_return_creates_activity_redirects_to_invoice_path request_params = every_pay_request_params.merge(invoice_id: @invoice.id) - post "/registrar/pay/return/every_pay", request_params + post "/registrar/pay/return/every_pay", params: request_params assert_equal(302, response.status) assert_redirected_to(registrar_invoice_path(@invoice)) end @@ -68,14 +68,14 @@ def test_every_pay_return_creates_activity_redirects_to_invoice_path def test_Every_Pay_return_raises_RecordNotFound request_params = every_pay_request_params.merge(invoice_id: "178907") assert_raises(ActiveRecord::RecordNotFound) do - post "/registrar/pay/return/every_pay", request_params + post "/registrar/pay/return/every_pay", params: request_params end end def test_bank_link_return_redirects_to_invoice_paths request_params = bank_link_request_params.merge(invoice_id: @invoice.id) - post "/registrar/pay/return/seb", request_params + post "/registrar/pay/return/seb", params: request_params assert_equal(302, response.status) assert_redirected_to(registrar_invoice_path(@invoice)) end @@ -83,7 +83,7 @@ def test_bank_link_return_redirects_to_invoice_paths def test_bank_link_return request_params = bank_link_request_params.merge(invoice_id: "178907") assert_raises(ActiveRecord::RecordNotFound) do - post "/registrar/pay/return/seb", request_params + post "/registrar/pay/return/seb", params: request_params end end end diff --git a/test/integration/registrar_area/settings/balance_auto_reload_test.rb b/test/integration/registrar_area/settings/balance_auto_reload_test.rb index 2c89630ea0..1a2c3f835b 100644 --- a/test/integration/registrar_area/settings/balance_auto_reload_test.rb +++ b/test/integration/registrar_area/settings/balance_auto_reload_test.rb @@ -13,8 +13,8 @@ def test_updates_balance_auto_reload_setting threshold = 10 assert_nil @registrar.settings['balance_auto_reload'] - patch registrar_settings_balance_auto_reload_path, { type: { amount: amount, - threshold: threshold } } + patch registrar_settings_balance_auto_reload_path, params: { type: { amount: amount, + threshold: threshold } } @registrar.reload assert_equal amount, @registrar.settings['balance_auto_reload']['type']['amount'] diff --git a/test/integration/registrar_area/sign_in/id_card_test.rb b/test/integration/registrar_area/sign_in/id_card_test.rb index 0a38e41055..1441c90cab 100644 --- a/test/integration/registrar_area/sign_in/id_card_test.rb +++ b/test/integration/registrar_area/sign_in/id_card_test.rb @@ -13,7 +13,8 @@ class RegistrarAreaIdCardSignInTest < ApplicationIntegrationTest def test_signs_in_a_user_when_id_card_owner_is_found assert_equal '1234', @user.identity_code - post_via_redirect registrar_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234' + post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234' } + follow_redirect! assert_response :ok assert_equal registrar_root_path, path @@ -21,8 +22,8 @@ def test_signs_in_a_user_when_id_card_owner_is_found end def test_does_not_sign_in_a_user_when_id_card_owner_is_not_found - post_via_redirect registrar_id_card_sign_in_path, nil, - 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,unacceptable-personal-code' + post registrar_id_card_sign_in_path, + headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,unacceptable-personal-code' } assert_nil controller.current_registrar_user assert_equal registrar_id_card_sign_in_path, path @@ -36,8 +37,8 @@ def test_does_not_sign_in_a_user_when_id_card_owner_is_found_but_ip_is_not_allow Setting.registrar_ip_whitelist_enabled = true - post registrar_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234', - 'REMOTE_ADDR' => '127.0.0.2' + post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => 'DOE,JOHN,1234', + 'REMOTE_ADDR' => '127.0.0.2' } assert_equal registrar_id_card_sign_in_path, path assert_equal 'Access denied from IP 127.0.0.2', response.body @@ -47,7 +48,7 @@ def test_does_not_sign_in_a_user_when_id_card_owner_is_found_but_ip_is_not_allow end def test_does_not_sign_in_a_user_when_certificate_is_absent - post_via_redirect registrar_id_card_sign_in_path, nil, 'SSL_CLIENT_S_DN_CN' => '' + post registrar_id_card_sign_in_path, headers: { 'SSL_CLIENT_S_DN_CN' => '' } assert_nil controller.current_registrar_user assert_equal registrar_id_card_sign_in_path, path diff --git a/test/learning/paper_trail_test.rb b/test/learning/paper_trail_test.rb index d4c76b026d..9396496b78 100644 --- a/test/learning/paper_trail_test.rb +++ b/test/learning/paper_trail_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class Post < ActiveRecord::Base +class Post < ApplicationRecord has_paper_trail end @@ -38,7 +38,7 @@ def test_creates_new_version_upon_update def test_touch_with_version @record = Post.create!(title: 'any') - + assert_difference -> { @record.versions.size } do @record.touch_with_version end diff --git a/test/models/contact/disclosable_test.rb b/test/models/contact/disclosable_test.rb index 4b944513d4..02adfbb083 100644 --- a/test/models/contact/disclosable_test.rb +++ b/test/models/contact/disclosable_test.rb @@ -28,7 +28,7 @@ def test_invalid_when_attribute_is_not_disclosable @contact.disclosed_attributes = %w[some undisclosable] assert @contact.invalid? - assert_includes @contact.errors.get(:disclosed_attributes), 'contain unsupported attribute(s)' + assert_includes @contact.errors[:disclosed_attributes], 'contain unsupported attribute(s)' end def test_valid_when_attribute_is_disclosable diff --git a/test/models/contact_test.rb b/test/models/contact_test.rb index 8a23013957..923a8d44e0 100644 --- a/test/models/contact_test.rb +++ b/test/models/contact_test.rb @@ -169,15 +169,15 @@ def test_contact_is_a_registrant end def test_linked_when_in_use_as_registrant - Domain.update_all(registrant_id: @contact) + Domain.update_all(registrant_id: @contact.id) DomainContact.delete_all assert @contact.linked? end def test_linked_when_in_use_as_domain_contact - Domain.update_all(registrant_id: contacts(:william)) - DomainContact.update_all(contact_id: @contact) + Domain.update_all(registrant_id: contacts(:william).id) + DomainContact.update_all(contact_id: @contact.id) assert @contact.linked? end @@ -253,11 +253,11 @@ def test_default_status def make_contact_free_of_domains_where_it_acts_as_a_registrant(contact) other_contact = contacts(:william) assert_not_equal other_contact, contact - Domain.update_all(registrant_id: other_contact) + Domain.update_all(registrant_id: other_contact.id) end def unlinked_contact - Domain.update_all(registrant_id: contacts(:william)) + Domain.update_all(registrant_id: contacts(:william).id) DomainContact.delete_all contacts(:john) end diff --git a/test/models/domain/releasable/auctionable_test.rb b/test/models/domain/releasable/auctionable_test.rb index c78a148bc4..de3ac0ff61 100644 --- a/test/models/domain/releasable/auctionable_test.rb +++ b/test/models/domain/releasable/auctionable_test.rb @@ -2,7 +2,7 @@ class DomainReleasableAuctionableTest < ActiveSupport::TestCase # Needed for `test_updates_whois` test because of `after_commit :update_whois_record` in Domain - self.use_transactional_fixtures = false + self.use_transactional_tests = false setup do @domain = domains(:shop) diff --git a/test/models/domain_test.rb b/test/models/domain_test.rb index 194a10d720..7e681e5603 100644 --- a/test/models/domain_test.rb +++ b/test/models/domain_test.rb @@ -247,7 +247,7 @@ def test_outzone_candidates_scope_returns_records_with_outzone_at_in_the_past domain3 = domains(:library) domain3.update!(outzone_at: Time.zone.parse('2010-07-05 08:00:01')) Domain.connection.disable_referential_integrity do - Domain.delete_all("id NOT IN (#{[domain1.id, domain2.id, domain3.id].join(',')})") + Domain.where("id NOT IN (#{[domain1.id, domain2.id, domain3.id].join(',')})").delete_all end assert_equal [domain1.id], Domain.outzone_candidates.ids @@ -262,7 +262,7 @@ def test_expired_scope_returns_records_with_valid_to_in_the_past domain3 = domains(:library) domain3.update!(valid_to: Time.zone.parse('2010-07-05 08:00:01')) Domain.connection.disable_referential_integrity do - Domain.delete_all("id NOT IN (#{[domain1.id, domain2.id, domain3.id].join(',')})") + Domain.where("id NOT IN (#{[domain1.id, domain2.id, domain3.id].join(',')})").delete_all end assert_equal [domain1.id, domain2.id].sort, Domain.expired.ids.sort diff --git a/test/support/rails5_assertions.rb b/test/support/rails5_assertions.rb index 55a2e8dc6d..a11bb3ef1c 100644 --- a/test/support/rails5_assertions.rb +++ b/test/support/rails5_assertions.rb @@ -1,3 +1,5 @@ +# Built-in since Rails 5.1 + module ActiveSupport module Testing module Assertions diff --git a/test/system/registrant_area/contacts/update_test.rb b/test/system/registrant_area/contacts/update_test.rb index a7cee049ef..95c4ad5c90 100644 --- a/test/system/registrant_area/contacts/update_test.rb +++ b/test/system/registrant_area/contacts/update_test.rb @@ -31,7 +31,7 @@ def test_update_contact stub_auth_request request_body = { name: 'new name', email: 'new@inbox.test', phone: '+666.6' }.to_json - headers = { 'Content-Type' => Mime::JSON, + headers = { 'Content-Type' => Mime[:json], 'Authorization' => 'Bearer test-access-token' } url = "https://api.test/api/v1/registrant/contacts/#{@contact.uuid}" update_request_stub = stub_request(:patch, url).with(body: request_body, headers: headers) @@ -115,7 +115,7 @@ def test_update_address_when_enabled country_code: 'AT', state: 'new state', } }.to_json - headers = { 'Content-type' => 'application/json', + headers = { 'Content-type' => Mime[:json], 'Authorization' => 'Bearer test-access-token' } url = "https://api.test/api/v1/registrant/contacts/#{@contact.uuid}" update_request_stub = stub_request(:patch, url).with(body: request_body, headers: headers) @@ -174,7 +174,7 @@ def stub_auth_request body = { ident: '1234', first_name: 'Registrant', last_name: 'User' } stub_request(:post, 'https://api.test/api/v1/registrant/auth/eid').with(body: body) .to_return(body: { access_token: 'test-access-token' }.to_json, - headers: { 'Content-type' => 'application/json' }, + headers: { 'Content-type' => Mime[:json] }, status: 200) end end diff --git a/test/system/registrar_area/bulk_change/bulk_transfer_test.rb b/test/system/registrar_area/bulk_change/bulk_transfer_test.rb index 944a1f91ff..69b755499c 100644 --- a/test/system/registrar_area/bulk_change/bulk_transfer_test.rb +++ b/test/system/registrar_area/bulk_change/bulk_transfer_test.rb @@ -7,7 +7,7 @@ class RegistrarAreaBulkTransferTest < ApplicationSystemTestCase def test_transfer_multiple_domains_in_bulk request_body = { data: { domainTransfers: [{ domainName: 'shop.test', transferCode: '65078d5' }] } } - headers = { 'Content-type' => 'application/json' } + headers = { 'Content-type' => Mime[:json] } request_stub = stub_request(:post, /domain_transfers/).with(body: request_body, headers: headers, basic_auth: ['test_goodnames', 'testtest']) @@ -28,7 +28,7 @@ def test_transfer_multiple_domains_in_bulk def test_fail_gracefully body = { errors: [{ title: 'epic fail' }] }.to_json - headers = { 'Content-type' => 'application/json' } + headers = { 'Content-type' => Mime[:json] } stub_request(:post, /domain_transfers/).to_return(status: 400, body: body, headers: headers) visit registrar_domains_url diff --git a/test/system/registrar_area/bulk_change/nameserver_test.rb b/test/system/registrar_area/bulk_change/nameserver_test.rb index b3f4e70c1a..d6b3170d5f 100644 --- a/test/system/registrar_area/bulk_change/nameserver_test.rb +++ b/test/system/registrar_area/bulk_change/nameserver_test.rb @@ -12,7 +12,7 @@ def test_replaces_current_registrar_nameservers ipv4: %w[192.0.2.55 192.0.2.56], ipv6: %w[2001:db8::55 2001:db8::56] } } } request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body, - headers: { 'Content-type' => 'application/json' }, + headers: { 'Content-type' => Mime[:json] }, basic_auth: ['test_goodnames', 'testtest']) .to_return(body: { data: [{ type: 'nameserver', @@ -38,7 +38,7 @@ def test_replaces_current_registrar_nameservers def test_fails_gracefully stub_request(:put, /registrar\/nameservers/).to_return(status: 400, body: { errors: [{ title: 'epic fail' }] }.to_json, - headers: { 'Content-type' => 'application/json' }) + headers: { 'Content-type' => Mime[:json] }) visit registrar_domains_url click_link 'Bulk change' diff --git a/test/system/registrar_area/bulk_change/tech_contact_test.rb b/test/system/registrar_area/bulk_change/tech_contact_test.rb index f14fc22089..c678e8f345 100644 --- a/test/system/registrar_area/bulk_change/tech_contact_test.rb +++ b/test/system/registrar_area/bulk_change/tech_contact_test.rb @@ -31,7 +31,7 @@ def test_fails_gracefully stub_request(:patch, /domains\/contacts/) .to_return(status: 400, body: { error: { message: 'epic fail' } }.to_json, - headers: { 'Content-type' => 'application/json' }) + headers: { 'Content-type' => Mime[:json] }) visit registrar_domains_url click_link 'Bulk change' diff --git a/test/tasks/data_migrations/convert_domain_delete_date_test.rb b/test/tasks/data_migrations/convert_domain_delete_date_test.rb index a17e1109bf..709334b524 100644 --- a/test/tasks/data_migrations/convert_domain_delete_date_test.rb +++ b/test/tasks/data_migrations/convert_domain_delete_date_test.rb @@ -51,7 +51,7 @@ def test_output def eliminate_effect_of_all_domains_except(domain) Domain.connection.disable_referential_integrity do - Domain.delete_all("id != #{domain.id}") + Domain.where("id != #{domain.id}").delete_all end end diff --git a/test/tasks/invoices/cancel_overdue_test.rb b/test/tasks/invoices/cancel_overdue_test.rb index 19ef8e0bf5..044997ae90 100644 --- a/test/tasks/invoices/cancel_overdue_test.rb +++ b/test/tasks/invoices/cancel_overdue_test.rb @@ -31,7 +31,7 @@ def test_output def eliminate_effect_of_other_invoices Invoice.connection.disable_referential_integrity do - Invoice.delete_all("id != #{@invoice.id}") + Invoice.where("id != #{@invoice.id}").delete_all end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 8af9a8cd67..ea821f7b6b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -16,9 +16,17 @@ require 'capybara/rails' require 'capybara/minitest' require 'webmock/minitest' -require 'support/rails5_assertions' # Remove once upgraded to Rails 5 +require 'support/rails5_assertions' # Remove once upgraded to Rails 5.1 require 'support/assertions/epp_assertions' + +# `bin/rails test` is not the same as `bin/rake test`. +# All tasks will be loaded (and executed) twice when using the former without `Rake::Task.clear`. +# https://github.com/rails/rails/issues/28786 +require 'rake' +Rake::Task.clear +Rails.application.load_tasks + Setting.address_processing = false Setting.registry_country_code = 'US' @@ -43,13 +51,6 @@ class ActiveSupport::TestCase end end -# Allows testing OPTIONS request just like GET or POST -module ActionDispatch::Integration::RequestHelpers - def options(path, parameters = nil, headers_or_env = nil) - process :options, path, parameters, headers_or_env - end -end - class ApplicationIntegrationTest < ActionDispatch::IntegrationTest include Capybara::DSL include Capybara::Minitest::Assertions