From 14d2332126da480c569a163931d79e4a6aa5d444 Mon Sep 17 00:00:00 2001 From: Andreas Zuber Date: Tue, 7 Jan 2020 11:12:09 +0100 Subject: [PATCH 1/4] Update to rails 6 and gem dependency updates --- Gemfile | 4 +- Gemfile.lock | 174 ++++++++++++++++++++++++++---------------------- README.markdown | 2 +- 3 files changed, 97 insertions(+), 83 deletions(-) diff --git a/Gemfile b/Gemfile index b21ac471d..d93004076 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' gem 'rake' gem 'rdoc' -gem 'rails', '~> 5.2.3' +gem 'rails', '~> 6.0.0' gem 'will_paginate' gem 'inherited_resources' gem 'i18n' @@ -35,7 +35,7 @@ gem 'ruby-progressbar' group :development, :test do gem 'mocha' gem 'sqlite3' - gem 'rspec-rails' + gem 'rspec-rails', '4.0.0.beta2' gem 'rspec-html-matchers' gem 'rspec-collection_matchers' gem 'shoulda-matchers', '~> 3' diff --git a/Gemfile.lock b/Gemfile.lock index 75005d09e..50d1f206c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,54 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.2.3) - actionpack (= 5.2.3) + actioncable (6.0.2.1) + actionpack (= 6.0.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) + actionmailbox (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + mail (>= 2.7.1) + actionmailer (6.0.2.1) + actionpack (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) - rack (~> 2.0) + actionpack (6.0.2.1) + actionview (= 6.0.2.1) + activesupport (= 6.0.2.1) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.1) + actionpack (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) + nokogiri (>= 1.8.5) + actionview (6.0.2.1) + activesupport (= 6.0.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.3) - activesupport (= 5.2.3) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.1) + activesupport (= 6.0.2.1) globalid (>= 0.3.6) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) - arel (>= 9.0) - activestorage (5.2.3) - actionpack (= 5.2.3) - activerecord (= 5.2.3) + activemodel (6.0.2.1) + activesupport (= 6.0.2.1) + activerecord (6.0.2.1) + activemodel (= 6.0.2.1) + activesupport (= 6.0.2.1) + activestorage (6.0.2.1) + actionpack (= 6.0.2.1) + activejob (= 6.0.2.1) + activerecord (= 6.0.2.1) marcel (~> 0.3.1) - activesupport (5.2.3) + activesupport (6.0.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2) ansi (1.5.0) - arel (9.0.0) ast (2.4.0) bindex (0.8.1) bootsnap (1.4.5) msgpack (~> 1.0) - builder (3.2.3) + builder (3.2.4) concurrent-ruby (1.1.5) crass (1.0.5) daemons (1.3.1) @@ -68,7 +81,7 @@ GEM factory_bot_rails (5.1.1) factory_bot (~> 5.1.0) railties (>= 4.2.0) - ffi (1.11.1) + ffi (1.11.3) globalid (0.4.2) activesupport (>= 4.2.0) haml (5.1.2) @@ -80,7 +93,7 @@ GEM haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) railties (>= 5.1) - haml_lint (0.34.0) + haml_lint (0.34.1) haml (>= 4.0, < 5.2) rainbow rubocop (>= 0.50.0) @@ -107,52 +120,52 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - json (2.2.0) + json (2.3.0) json_pure (2.2.0) libv8 (3.16.14.19) - listen (3.2.0) + listen (3.2.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.3.1) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) - metaclass (0.0.4) method_source (0.9.2) mimemagic (0.3.3) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.13.0) - mocha (1.9.0) - metaclass (~> 0.0.1) + mocha (1.11.2) msgpack (1.3.1) - mysql2 (0.5.2) + mysql2 (0.5.3) nio4r (2.5.2) - nokogiri (1.10.5) + nokogiri (1.10.7) mini_portile2 (~> 2.4.0) - parallel (1.18.0) - parser (2.6.5.0) + parallel (1.19.1) + parser (2.7.0.1) ast (~> 2.4.0) - pg (1.1.4) + pg (1.2.1) psych (3.1.0) rack (2.0.8) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.3) - actioncable (= 5.2.3) - actionmailer (= 5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - activemodel (= 5.2.3) - activerecord (= 5.2.3) - activestorage (= 5.2.3) - activesupport (= 5.2.3) + rails (6.0.2.1) + actioncable (= 6.0.2.1) + actionmailbox (= 6.0.2.1) + actionmailer (= 6.0.2.1) + actionpack (= 6.0.2.1) + actiontext (= 6.0.2.1) + actionview (= 6.0.2.1) + activejob (= 6.0.2.1) + activemodel (= 6.0.2.1) + activerecord (= 6.0.2.1) + activestorage (= 6.0.2.1) + activesupport (= 6.0.2.1) bundler (>= 1.3.0) - railties (= 5.2.3) + railties (= 6.0.2.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) @@ -163,18 +176,18 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) + railties (6.0.2.1) + actionpack (= 6.0.2.1) + activesupport (= 6.0.2.1) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.0.0) - rake (13.0.0) + rake (13.0.1) rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.2.0) + rdoc (6.2.1) ref (2.0.0) responders (3.0.0) actionpack (>= 5.0) @@ -185,26 +198,26 @@ GEM rspec-mocks (~> 3.9.0) rspec-collection_matchers (1.2.0) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) rspec-expectations (3.9.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-html-matchers (0.9.2) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-rails (3.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) + rspec-rails (4.0.0.beta2) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.8) + rspec-expectations (~> 3.8) + rspec-mocks (~> 3.8) + rspec-support (~> 3.8) + rspec-support (3.9.2) rubocop (0.67.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) @@ -250,7 +263,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.4.1) + sqlite3 (1.4.2) sysexits (1.2.0) temple (0.8.2) terminal-table (1.8.0) @@ -262,24 +275,25 @@ GEM daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) timeline_fu (0.3.0) - tzinfo (1.2.5) + tzinfo (1.2.6) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (1.5.0) - web-console (3.7.0) - actionview (>= 5.0) - activemodel (>= 5.0) + web-console (4.0.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) bindex (>= 0.4.0) - railties (>= 5.0) + railties (>= 6.0.0) websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.4) will_paginate (3.2.1) + zeitwerk (2.2.2) PLATFORMS ruby @@ -305,13 +319,13 @@ DEPENDENCIES nokogiri pg rack - rails (~> 5.2.3) + rails (~> 6.0.0) rails-controller-testing rake rdoc rspec-collection_matchers rspec-html-matchers - rspec-rails + rspec-rails (= 4.0.0.beta2) rubocop (~> 0.67.0) rubocop-rails_config ruby-progressbar diff --git a/README.markdown b/README.markdown index 9fac12e3a..6cd84ee3c 100644 --- a/README.markdown +++ b/README.markdown @@ -12,7 +12,7 @@ nodes, and view inventory data and backed-up file contents. Dependencies ------------ -* Ruby 2.4, 2.5, 2.6 +* Ruby 2.5, 2.6 * MySQL/MariaDB >= 5.5 or PostgreSQL >= 9.2 Puppet Report Format Support From fce43e39b13122b393a244c087ebf3afc1505ad9 Mon Sep 17 00:00:00 2001 From: Andreas Zuber Date: Tue, 7 Jan 2020 17:37:57 +0100 Subject: [PATCH 2/4] Update application files to Rails 6 --- bin/setup | 12 +++--- config/application.rb | 3 ++ config/cable.yml | 2 +- config/environments/development.rb | 5 ++- config/environments/production.rb | 38 ++++++++++++++----- config/environments/test.rb | 14 ++++--- .../initializers/content_security_policy.rb | 5 +++ config/locales/en.yml | 2 +- ..._attachments_for_blob_id.active_storage.rb | 10 +++++ db/schema.rb | 12 +++--- 10 files changed, 71 insertions(+), 32 deletions(-) create mode 100644 db/migrate/20190827064524_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb diff --git a/bin/setup b/bin/setup index 94fd4d797..5853b5ea8 100755 --- a/bin/setup +++ b/bin/setup @@ -1,6 +1,5 @@ #!/usr/bin/env ruby require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -9,24 +8,25 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do - # This script is a starting point to setup your application. +FileUtils.chdir APP_ROOT do + # This script is a way to setup or update your development environment automatically. + # This script is idempotent, so that you can run it at anytime and get an expectable outcome. # Add necessary setup steps to this file. puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') - # Install JavaScript dependencies if using Yarn + # Install JavaScript dependencies # system('bin/yarn') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' + # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! 'bin/rails db:prepare' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' diff --git a/config/application.rb b/config/application.rb index 6f2bc5a5f..4557ee203 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,6 +13,9 @@ class Application < Rails::Application # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 6.0 + # TODO: We will have to move to move this to app/lib eventually Rails.application.config.eager_load_paths << Rails.root.join('lib') end diff --git a/config/cable.yml b/config/cable.yml index e667ac4cc..77e77a71b 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -2,7 +2,7 @@ development: adapter: async test: - adapter: async + adapter: test production: adapter: redis diff --git a/config/environments/development.rb b/config/environments/development.rb index 1311e3e4e..66df51f6f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,7 @@ # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true config.cache_store = :memory_store config.public_file_server.headers = { @@ -27,7 +28,7 @@ config.cache_store = :null_store end - # Store uploaded files on the local file system (see config/storage.yml for options) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Don't care if the mailer can't send. @@ -52,7 +53,7 @@ # Suppress logger output for asset requests. config.assets.quiet = true - # Raises error for missing translations + # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, diff --git a/config/environments/production.rb b/config/environments/production.rb index cf672da8b..879ca182d 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,15 +22,12 @@ # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? - # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' @@ -38,10 +35,10 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX - # Store uploaded files on the local file system (see config/storage.yml for options) + # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local - # Mount Action Cable outside main process or domain + # 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.*/ ] @@ -51,7 +48,7 @@ # Use the lowest log level to ensure availability of diagnostic information # when problems arise. - config.log_level = :warn + config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] @@ -59,9 +56,9 @@ # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment) + # 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 = "puppet_dashboard_#{Rails.env}" + # config.active_job.queue_name_prefix = "puppet_dashboard_production" config.action_mailer.perform_caching = false @@ -71,7 +68,7 @@ # 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 = [I18n.default_locale] + config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify @@ -91,4 +88,25 @@ # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Inserts middleware to perform automatic connection switching. + # The `database_selector` hash is used to pass options to the DatabaseSelector + # middleware. The `delay` is used to determine how long to wait after a write + # to send a subsequent read to the primary. + # + # The `database_resolver` class is used by the middleware to determine which + # database is appropriate to use based on the time delay. + # + # The `database_resolver_context` class is used by the middleware to set + # timestamps for the last write to the primary. The resolver uses the context + # class timestamps to determine how long to wait before reading from the + # replica. + # + # By default Rails will store a last write timestamp in the session. The + # DatabaseSelector middleware is designed as such you can define your own + # strategy for connection switching and pass that into the middleware through + # these configuration options. + # config.active_record.database_selector = { delay: 2.seconds } + # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver + # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end diff --git a/config/environments/test.rb b/config/environments/test.rb index 0a38fd3ce..470dee4be 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,10 +1,11 @@ +# 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! + 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 # Do not eager load code on boot. This avoids loading your whole application @@ -21,6 +22,7 @@ # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false + config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false @@ -28,7 +30,7 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - # Store uploaded files on the local file system in a temporary directory + # Store uploaded files on the local file system in a temporary directory. config.active_storage.service = :test config.action_mailer.perform_caching = false @@ -41,6 +43,6 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - # Raises error for missing translations + # Raises error for missing translations. # config.action_view.raise_on_missing_translations = true end diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index d3bcaa5ec..35d0f26fc 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -11,6 +11,8 @@ # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https +# # If you are using webpack-dev-server then specify webpack-dev-server host +# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" @@ -19,6 +21,9 @@ # If you are using UJS then enable automatic nonce generation # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } +# Set the nonce only to specific directives +# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) + # Report CSP violations to a specified URI # For further information see the following documentation: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only diff --git a/config/locales/en.yml b/config/locales/en.yml index decc5a857..cf9b342d0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -27,7 +27,7 @@ # 'true': 'foo' # # To learn more, please read the Rails Internationalization guide -# available at http://guides.rubyonrails.org/i18n.html. +# available at https://guides.rubyonrails.org/i18n.html. en: hello: "Hello world" diff --git a/db/migrate/20190827064524_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb b/db/migrate/20190827064524_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb new file mode 100644 index 000000000..ff5d72c7e --- /dev/null +++ b/db/migrate/20190827064524_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb @@ -0,0 +1,10 @@ +# This migration comes from active_storage (originally 20180723000244) +class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord::Migration[6.0] + def up + return if foreign_key_exists?(:active_storage_attachments, column: :blob_id) + + if table_exists?(:active_storage_blobs) + add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 4d71079db..d4efc5d1a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,15 +2,15 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `rails +# db:schema:load`. When creating a new database, `rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2018_06_14_210435) do +ActiveRecord::Schema.define(version: 2019_08_27_064524) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" From 9c43c0d817d9a65ec78a978f191445e0a21d0763 Mon Sep 17 00:00:00 2001 From: Andreas Zuber Date: Tue, 7 Jan 2020 17:38:16 +0100 Subject: [PATCH 3/4] fix tests for Rails 6 update --- spec/factories.rb | 24 +++++++++++----------- spec/models/node_spec.rb | 2 +- spec/shared_behaviors/controller_mixins.rb | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/factories.rb b/spec/factories.rb index b3761112e..bb98ed9c3 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -34,44 +34,44 @@ factory :unresponsive_node do after(:create) do |node| - node.last_apply_report.update_attributes!(:time => 2.days.ago) - node.update_attributes!(:reported_at => 2.days.ago) + node.last_apply_report.update!(time: 2.days.ago) + node.update!(reported_at: 2.days.ago) end end factory :responsive_node do after(:create) do |node| - node.last_apply_report.update_attributes!(:time => 2.minutes.ago) - node.update_attributes!(:reported_at => 2.minutes.ago) + node.last_apply_report.update!(time: 2.minutes.ago) + node.update!(reported_at: 2.minutes.ago) end factory :failing_node do after(:create) do |node| - node.last_apply_report.update_attributes!(:status => 'failed') - node.update_attributes!(:status => 'failed') + node.last_apply_report.update!(status: 'failed') + node.update!(status: 'failed') end end factory :pending_node do after(:create) do |node| - node.last_apply_report.update_attributes!(:status => 'pending') - node.update_attributes!(:status => 'pending') + node.last_apply_report.update!(status: 'pending') + node.update!(status: 'pending') create(:pending_resource, report: node.last_apply_report) end end factory :changed_node do after(:create) do |node| - node.last_apply_report.update_attributes!(:status => 'changed') - node.update_attributes!(:status => 'changed') + node.last_apply_report.update!(status: 'changed') + node.update!(status: 'changed') create(:changed_resource, report: node.last_apply_report) end end factory :unchanged_node do after(:create) do |node| - node.last_apply_report.update_attributes!(:status => 'unchanged') - node.update_attributes!(:status => 'unchanged') + node.last_apply_report.update!(status: 'unchanged') + node.update!(status: 'unchanged') end end diff --git a/spec/models/node_spec.rb b/spec/models/node_spec.rb index bb3d6c64e..039ab9c71 100644 --- a/spec/models/node_spec.rb +++ b/spec/models/node_spec.rb @@ -361,7 +361,7 @@ end it "should not raise an error if there are two sibling parameters with the same key and value" do - @param_2.update_attributes(:key => @param_1.key, :value => @param_1.value) + @param_2.update(key: @param_1.key, value: @param_1.value) expect {@node.compiled_parameters}.to_not raise_error @node.errors[:parameters].should be_empty diff --git a/spec/shared_behaviors/controller_mixins.rb b/spec/shared_behaviors/controller_mixins.rb index d634d53ee..fd9514ba6 100644 --- a/spec/shared_behaviors/controller_mixins.rb +++ b/spec/shared_behaviors/controller_mixins.rb @@ -54,7 +54,7 @@ describe "as HTML" do before do SETTINGS.stubs(:use_external_node_classification).returns(true) - get :index, params: { format: 'html' } + get :index, as: :html end subject { assigns[model.name.tableize] } @@ -64,7 +64,7 @@ end describe "as JSON" do - before { get :index, params: { format: 'json' } } + before { get :index, as: :json } subject { assigns[model.name.tableize] } it "does not paginate" do @@ -73,7 +73,7 @@ end describe "as YAML" do - before { get :index, params: { format: 'yaml' } } + before { get :index, as: :yaml } subject { assigns[model.name.tableize] } it "does not paginate" do From 067f6c01097c1f3d0d424a767e4fc4ca91d11010 Mon Sep 17 00:00:00 2001 From: Andreas Zuber Date: Tue, 7 Jan 2020 17:40:15 +0100 Subject: [PATCH 4/4] drop ruby 2.4, add ruby 2.7 --- .travis.yml | 2 +- README.markdown | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9351e9bd7..c233df3e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,9 +10,9 @@ services: - mysql - postgresql rvm: - - 2.4 - 2.5 - 2.6 + - 2.7 before_install: gem install bundler --version '~> 1' before_script: - cp config/database.yml.travis config/database.yml diff --git a/README.markdown b/README.markdown index 6cd84ee3c..eecbc6ca2 100644 --- a/README.markdown +++ b/README.markdown @@ -12,7 +12,7 @@ nodes, and view inventory data and backed-up file contents. Dependencies ------------ -* Ruby 2.5, 2.6 +* Ruby 2.5, 2.6, 2.7 * MySQL/MariaDB >= 5.5 or PostgreSQL >= 9.2 Puppet Report Format Support