diff --git a/.rubocop.yml b/.rubocop.yml index 73fad3b61..2dce69504 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -156,6 +156,7 @@ Layout/LineLength: - "config/initializers/devise.rb" - "config/initializers/backtrace_silencers.rb" - "db/migrate/*create_delayed_jobs.rb" + - "db/migrate/*create_active_storage_variant_records.active_storage.rb" - "app/models/budget/stats.rb" Layout/MultilineArrayBraceLayout: @@ -356,6 +357,7 @@ Rails/CreateTableWithTimestamps: Exclude: - "db/migrate/201[5-8]*" - "db/migrate/*install_audited.rb" + - "db/migrate/*create_active_storage_variant_records.active_storage.rb" Rails/Date: Enabled: true diff --git a/Gemfile b/Gemfile index fef161969..ef274bf2e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "rails", "6.0.6.1" +gem "rails", "6.1.7.4" gem "acts-as-taggable-on", "~> 9.0.1" gem "acts_as_votable", "~> 0.14.0" diff --git a/Gemfile.lock b/Gemfile.lock index d30d55ed3..ec7840abd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,61 +6,65 @@ GEM GEM remote: https://rubygems.org/ specs: - actioncable (6.0.6.1) - actionpack (= 6.0.6.1) + actioncable (6.1.7.4) + actionpack (= 6.1.7.4) + activesupport (= 6.1.7.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) + actionmailbox (6.1.7.4) + actionpack (= 6.1.7.4) + activejob (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) mail (>= 2.7.1) - actionmailer (6.0.6.1) - actionpack (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) + actionmailer (6.1.7.4) + actionpack (= 6.1.7.4) + actionview (= 6.1.7.4) + activejob (= 6.1.7.4) + activesupport (= 6.1.7.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.6.1) - actionview (= 6.0.6.1) - activesupport (= 6.0.6.1) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.7.4) + actionview (= 6.1.7.4) + activesupport (= 6.1.7.4) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.6.1) - actionpack (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) + actiontext (6.1.7.4) + actionpack (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) nokogiri (>= 1.8.5) - actionview (6.0.6.1) - activesupport (= 6.0.6.1) + actionview (6.1.7.4) + activesupport (= 6.1.7.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.6.1) - activesupport (= 6.0.6.1) + activejob (6.1.7.4) + activesupport (= 6.1.7.4) globalid (>= 0.3.6) - activemodel (6.0.6.1) - activesupport (= 6.0.6.1) - activerecord (6.0.6.1) - activemodel (= 6.0.6.1) - activesupport (= 6.0.6.1) - activestorage (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) + activemodel (6.1.7.4) + activesupport (= 6.1.7.4) + activerecord (6.1.7.4) + activemodel (= 6.1.7.4) + activesupport (= 6.1.7.4) + activestorage (6.1.7.4) + actionpack (= 6.1.7.4) + activejob (= 6.1.7.4) + activerecord (= 6.1.7.4) + activesupport (= 6.1.7.4) marcel (~> 1.0) - activesupport (6.0.6.1) + mini_mime (>= 1.1.0) + activesupport (6.1.7.4) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) acts-as-taggable-on (9.0.1) activerecord (>= 6.0, < 7.1) acts_as_votable (0.14.0) @@ -445,20 +449,20 @@ GEM rack rack-test (2.1.0) rack (>= 1.3) - rails (6.0.6.1) - actioncable (= 6.0.6.1) - actionmailbox (= 6.0.6.1) - actionmailer (= 6.0.6.1) - actionpack (= 6.0.6.1) - actiontext (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) - activemodel (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - bundler (>= 1.3.0) - railties (= 6.0.6.1) + rails (6.1.7.4) + actioncable (= 6.1.7.4) + actionmailbox (= 6.1.7.4) + actionmailer (= 6.1.7.4) + actionpack (= 6.1.7.4) + actiontext (= 6.1.7.4) + actionview (= 6.1.7.4) + activejob (= 6.1.7.4) + activemodel (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) + bundler (>= 1.15.0) + railties (= 6.1.7.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) @@ -470,12 +474,12 @@ GEM rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.6.1) - actionpack (= 6.0.6.1) - activesupport (= 6.0.6.1) + railties (6.1.7.4) + actionpack (= 6.1.7.4) + activesupport (= 6.1.7.4) method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + rake (>= 12.2) + thor (~> 1.0) rainbow (3.1.1) rake (13.0.6) rb-fsevent (0.11.2) @@ -623,7 +627,6 @@ GEM terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) thor (1.2.2) - thread_safe (0.3.6) tilt (2.0.10) timeout (0.4.0) tomlrb (2.0.3) @@ -635,8 +638,8 @@ GEM rack (>= 1.3, < 3) rack-accept (~> 0.4) tilt (>= 1.4, < 3) - tzinfo (1.2.11) - thread_safe (~> 0.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unicode-display_width (2.4.2) @@ -744,7 +747,7 @@ DEPENDENCIES pronto-rubocop (~> 0.11.5) pronto-scss (~> 0.11.0) puma (~> 4.3.12) - rails (= 6.0.6.1) + rails (= 6.1.7.4) rails-assets-markdown-it (~> 9.0.1)! recipient_interceptor (~> 0.3.1) redcarpet (~> 3.6.0) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index f67f1be0c..88ac41b0f 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -10,7 +10,7 @@ class AccountController < ApplicationController if @account.update(account_params) redirect_to account_path, notice: t("flash.actions.save_changes.notice") else - @account.errors.messages.delete(:organization) + @account.errors.delete(:organization) render :show end end diff --git a/app/controllers/organizations/registrations_controller.rb b/app/controllers/organizations/registrations_controller.rb index 7b37ee7c2..544432a84 100644 --- a/app/controllers/organizations/registrations_controller.rb +++ b/app/controllers/organizations/registrations_controller.rb @@ -13,7 +13,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController if resource.valid? super do |user| # Removes unuseful "organization is invalid" error message - user.errors.messages.delete(:organization) + user.errors.delete(:organization) end else render :new diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index d33854784..bc997297b 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -11,7 +11,7 @@ class PagesController < ApplicationController @cards = @custom_page.cards render action: :custom_page else - render action: params[:id] + render action: params[:id].split(".").first end rescue ActionView::MissingTemplate head :not_found, content_type: "text/html" diff --git a/bin/setup b/bin/setup index 5635f8ec1..50fe75198 100755 --- a/bin/setup +++ b/bin/setup @@ -9,8 +9,8 @@ def system!(*args) end 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. + # This script is a way to set up or update your development environment automatically. + # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. puts "== Installing dependencies ==" diff --git a/config.ru b/config.ru index 193e5fed8..4a3c09a68 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,6 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path("../config/environment", __FILE__) +require_relative "config/environment" + run Rails.application +Rails.application.load_server diff --git a/config/application.rb b/config/application.rb index 478276697..55ffae989 100644 --- a/config/application.rb +++ b/config/application.rb @@ -21,15 +21,12 @@ Bundler.require(*Rails.groups) module Consul class Application < Rails::Application - config.load_defaults 6.0 + config.load_defaults 6.1 # Keep belongs_to fields optional by default, because that's the way # Rails 4 models worked config.active_record.belongs_to_required_by_default = false - # Use local forms with `form_with`, so it works like `form_for` - config.action_view.form_with_generates_remote_forms = false - # Keep using AES-256-CBC for message encryption in case it's used # in any CONSUL DEMOCRACY installations config.active_support.use_authenticated_message_encryption = false @@ -38,10 +35,9 @@ module Consul # should work with zeitwerk config.autoloader = :classic - # Use the default queue for ActiveStorage like we were doing with Rails 5.2 - # because it will also be the default in Rails 6.1. - config.active_storage.queues.analysis = nil - config.active_storage.queues.purge = nil + # Don't enable has_many_inversing because it doesn't seem to currently + # work with the _count database columns we use for caching purposes + config.active_record.has_many_inversing = false # Keep reading existing data in the legislation_annotations ranges column config.active_record.yaml_column_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol] @@ -55,7 +51,7 @@ module Consul # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' + config.time_zone = "Madrid" # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] @@ -124,7 +120,6 @@ module Consul # Add lib to the autoload path config.autoload_paths << Rails.root.join("lib") - config.time_zone = "Madrid" config.active_job.queue_adapter = :delayed_job # CONSUL DEMOCRACY specific custom overrides diff --git a/config/environments/development.rb b/config/environments/development.rb index d3adf353f..704a1e63e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,10 +1,11 @@ Warning[:deprecated] = true +require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false @@ -45,6 +46,12 @@ Rails.application.configure do # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load @@ -60,7 +67,10 @@ Rails.application.configure do config.assets.quiet = true # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews" @@ -81,6 +91,9 @@ Rails.application.configure do # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. # config.file_watcher = ActiveSupport::EventedFileUpdateChecker + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true end require Rails.root.join("config", "environments", "custom", "development") diff --git a/config/environments/production.rb b/config/environments/production.rb index 450bbbeb8..1b200d1ab 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -35,7 +37,7 @@ Rails.application.configure do config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" + # config.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 @@ -50,8 +52,8 @@ Rails.application.configure do # Configure force_ssl in secrets.yml config.force_ssl = Rails.application.secrets.force_ssl - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. + # Include generic and useful information about system operation, but avoid logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). config.log_level = :warn # Prepend all log lines with the following tags. @@ -84,6 +86,12 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify + # Log disallowed deprecations. + config.active_support.disallowed_deprecation = :log + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new diff --git a/config/environments/staging.rb b/config/environments/staging.rb index f483267db..5c53afc8e 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,3 +1,5 @@ +require "active_support/core_ext/integer/time" + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -35,7 +37,7 @@ Rails.application.configure do config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" + # config.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 @@ -50,8 +52,8 @@ Rails.application.configure do # Configure force_ssl in secrets.yml config.force_ssl = Rails.application.secrets.force_ssl - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. + # Include generic and useful information about system operation, but avoid logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). config.log_level = :debug # Prepend all log lines with the following tags. @@ -63,6 +65,7 @@ Rails.application.configure do # 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 = "consul_#{Rails.env}" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. @@ -83,6 +86,12 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify + # Log disallowed deprecations. + config.active_support.disallowed_deprecation = :log + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new diff --git a/config/environments/test.rb b/config/environments/test.rb index 64c8b7519..5787afca2 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +require "active_support/core_ext/integer/time" + # 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 @@ -51,8 +53,17 @@ Rails.application.configure do # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raises error for missing translations. - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true # Limit size of local logs # TODO: replace with config.log_file_size after upgrading to Rails 7.1 diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index a3ebeb853..d661338bb 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -5,8 +5,7 @@ module ActsAsTaggableOn scope :public_for_api, -> do where( - # TODO: remove default_scoped after upgrading to Rails 6.1 - tag: Tag.default_scoped.where(kind: [nil, "category"]), + tag: Tag.where(kind: [nil, "category"]), taggable: [Debate.public_for_api, Proposal.public_for_api] ) end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cdf3..33699c309 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,7 +1,8 @@ # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } +# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code +# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". +Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1e7..4b34a0366 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,6 @@ # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb new file mode 100644 index 000000000..00f64d71b --- /dev/null +++ b/config/initializers/permissions_policy.rb @@ -0,0 +1,11 @@ +# Define an application-wide HTTP permissions policy. For further +# information see https://developers.google.com/web/updates/2018/06/feature-policy +# +# Rails.application.config.permissions_policy do |f| +# f.camera :none +# f.gyroscope :none +# f.microphone :none +# f.usb :none +# f.fullscreen :self +# f.payment :self, "https://secure.example.com" +# end diff --git a/config/initializers/wicked_pdf.rb b/config/initializers/wicked_pdf.rb index 6befcabeb..8a4ead8ee 100644 --- a/config/initializers/wicked_pdf.rb +++ b/config/initializers/wicked_pdf.rb @@ -1,27 +1,3 @@ -class WickedPdf - # Wicked Pdf magic breaks ViewComponent - # https://github.com/mileszs/wicked_pdf/pull/925 - module PdfHelper - def render(*args) - options = args.first - if options.is_a?(Hash) && options.key?(:pdf) - render_with_wicked_pdf(options) - else - super - end - end - - def render_to_string(*args) - options = args.first - if options.is_a?(Hash) && options.key?(:pdf) - render_to_string_with_wicked_pdf(options) - else - super - end - end - end -end - # WickedPDF Global Configuration # # Use this to set up shared configuration options for your entire application. diff --git a/db/migrate/20210924190647_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20210924190647_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 000000000..9967a1323 --- /dev/null +++ b/db/migrate/20210924190647_add_service_name_to_active_storage_blobs.active_storage.rb @@ -0,0 +1,18 @@ +# This migration comes from active_storage (originally 20190112182829) +class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] + def up + unless column_exists?(:active_storage_blobs, :service_name) + add_column :active_storage_blobs, :service_name, :string + + if configured_service = ActiveStorage::Blob.service.name + ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) + end + + change_column :active_storage_blobs, :service_name, :string, null: false + end + end + + def down + remove_column :active_storage_blobs, :service_name + end +end diff --git a/db/migrate/20210924190648_create_active_storage_variant_records.active_storage.rb b/db/migrate/20210924190648_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 000000000..fb6e2b017 --- /dev/null +++ b/db/migrate/20210924190648_create_active_storage_variant_records.active_storage.rb @@ -0,0 +1,12 @@ +# This migration comes from active_storage (originally 20191206030411) +class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] + def change + create_table :active_storage_variant_records do |t| + t.belongs_to :blob, null: false, index: false + t.string :variation_digest, null: false + + t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 165b1ffa7..11ebacaa9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,8 +2,8 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# 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 +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/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. @@ -50,9 +50,16 @@ ActiveRecord::Schema.define(version: 2023_05_23_090028) do t.bigint "byte_size", null: false t.string "checksum", null: false t.datetime "created_at", null: false + t.string "service_name", null: false t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end + create_table "active_storage_variant_records", force: :cascade do |t| + t.bigint "blob_id", null: false + t.string "variation_digest", null: false + t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true + end + create_table "activities", id: :serial, force: :cascade do |t| t.integer "user_id" t.string "action" @@ -1776,6 +1783,7 @@ ActiveRecord::Schema.define(version: 2023_05_23_090028) do end add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" + add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" add_foreign_key "administrators", "users" add_foreign_key "budget_administrators", "administrators" add_foreign_key "budget_administrators", "budgets" diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index fca08afc1..00577c207 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -67,6 +67,7 @@ end Capybara.exact = true Capybara.enable_aria_label = true Capybara.disable_animation = true +Capybara.app_host ||= "http://127.0.0.1" OmniAuth.config.test_mode = true diff --git a/spec/shared/system/relationable.rb b/spec/shared/system/relationable.rb index e6a4b31ca..32e657b9d 100644 --- a/spec/shared/system/relationable.rb +++ b/spec/shared/system/relationable.rb @@ -4,9 +4,7 @@ shared_examples "relationable" do |relationable_model_name| let(:related2) { create([:proposal, :debate, :budget_investment].sample) } let(:user) { create(:user) } - before do - integration_session.host = Capybara.app_host # TODO: remove after upgrading to Rails 6.1 - end + before { integration_session.host = Capybara.app_host } scenario "related contents are listed" do create(:related_content, diff --git a/spec/views/welcome/index.html.erb_spec.rb b/spec/views/welcome/index.html.erb_spec.rb index c0c2d4086..1583730d9 100644 --- a/spec/views/welcome/index.html.erb_spec.rb +++ b/spec/views/welcome/index.html.erb_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "welcome#index" do it "Display images on orbit carrousel when we have defined image_default" do debate = create(:debate) - render template: "welcome/_recommended_carousel.html.erb", + render template: "welcome/_recommended_carousel", locals: { key: "debates", recommendeds: [debate], image_field: nil, @@ -22,7 +22,7 @@ RSpec.describe "welcome#index" do it "Not display images on orbit carrousel when we have not defined image_default" do debate = create(:debate) - render template: "welcome/_recommended_carousel.html.erb", + render template: "welcome/_recommended_carousel", locals: { key: "debates", recommendeds: [debate], image_field: nil,