Update to Rails 6.1

This commit is contained in:
Marc Anguera Insa
2021-01-08 18:08:56 +01:00
parent 18bf549afe
commit f0c6a9e8f1
20 changed files with 153 additions and 156 deletions

16
Gemfile
View File

@ -2,7 +2,7 @@ source 'https://rubygems.org'
ruby File.read('.ruby-version').strip
gem 'rails', '~> 6.0.2'
gem 'rails', '~> 6.1.1'
gem 'rails-i18n', '~> 6.0.0'
gem 'rdiscount', '~> 2.2.0.1'
gem 'activeadmin', '~> 2.9.0'
@ -19,9 +19,9 @@ gem 'rollbar', '~> 2.22.1'
gem 'prawn', '~> 2.2.0'
gem 'prawn-table', '~> 0.2.2'
gem 'pg_search', '~> 2.3.5'
gem 'skylight', '~> 4.1.2'
gem 'sidekiq', '~> 6.0.0'
gem 'sidekiq-cron', '~> 1.1.0'
gem 'skylight', '~> 4.3.2'
gem 'sidekiq', '~> 6.1.2'
gem 'sidekiq-cron', '~> 1.2.0'
# Assets
gem 'jquery-rails', '~> 4.3.5'
@ -39,7 +39,7 @@ group :development do
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano-rbenv', '~> 2.1'
gem 'airbrussh', require: false
gem 'localeapp', '2.1.1', require: false
gem 'localeapp', '~> 3.1', require: false
gem 'letter_opener', '~> 1.7.0'
gem 'dotenv-rails', '~> 2.7.1'
end
@ -52,11 +52,11 @@ group :test do
gem 'rspec-rails', '~> 4.0.0'
gem 'rails-controller-testing'
gem 'database_cleaner', '~> 1.8.5'
gem 'shoulda-matchers', '~> 4.4.0'
gem 'shoulda-matchers', '~> 4.4'
gem 'fabrication', '~> 2.20'
gem 'faker', '~> 1.9'
gem 'faker', '~> 2.15'
gem 'capybara', '~> 3.29'
gem 'selenium-webdriver', '~> 3.142'
gem 'webdrivers', '~> 4.4.0'
gem 'webdrivers', '~> 4.4'
gem 'simplecov', '~> 0.17', require: false
end

View File

@ -1,38 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.4)
actionpack (= 6.0.3.4)
actioncable (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
actionmailbox (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
mail (>= 2.7.1)
actionmailer (6.0.3.4)
actionpack (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
actionmailer (6.1.1)
actionpack (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activesupport (= 6.1.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.4)
actionview (= 6.0.3.4)
activesupport (= 6.0.3.4)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.1)
actionview (= 6.1.1)
activesupport (= 6.1.1)
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.3.4)
actionpack (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
actiontext (6.1.1)
actionpack (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
nokogiri (>= 1.8.5)
actionview (6.0.3.4)
activesupport (= 6.0.3.4)
actionview (6.1.1)
activesupport (= 6.1.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@ -46,25 +48,27 @@ GEM
kaminari (~> 1.0, >= 1.2.1)
railties (>= 5.2, < 6.2)
ransack (~> 2.1, >= 2.1.1)
activejob (6.0.3.4)
activesupport (= 6.0.3.4)
activejob (6.1.1)
activesupport (= 6.1.1)
globalid (>= 0.3.6)
activemodel (6.0.3.4)
activesupport (= 6.0.3.4)
activerecord (6.0.3.4)
activemodel (= 6.0.3.4)
activesupport (= 6.0.3.4)
activestorage (6.0.3.4)
actionpack (= 6.0.3.4)
activejob (= 6.0.3.4)
activerecord (= 6.0.3.4)
activemodel (6.1.1)
activesupport (= 6.1.1)
activerecord (6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
activestorage (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activesupport (= 6.1.1)
marcel (~> 0.3.1)
activesupport (6.0.3.4)
mimemagic (~> 0.3.2)
activesupport (6.1.1)
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)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
airbrussh (1.4.0)
@ -73,7 +77,7 @@ GEM
activesupport (>= 3.0.0, < 6.2)
ruby2_keywords (>= 0.0.2, < 1.0)
ast (2.4.1)
autoprefixer-rails (10.1.0.0)
autoprefixer-rails (10.2.0.0)
execjs
bcrypt (3.1.16)
bindex (0.8.1)
@ -82,7 +86,7 @@ GEM
sassc (>= 2.0.0)
builder (3.2.4)
byebug (11.1.3)
capistrano (3.14.1)
capistrano (3.15.0)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
@ -115,7 +119,7 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.4.4)
docile (1.3.2)
docile (1.3.4)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
@ -127,9 +131,9 @@ GEM
tzinfo
execjs (2.7.0)
fabrication (2.21.1)
faker (1.9.6)
i18n (>= 0.7)
ffi (1.13.1)
faker (2.15.1)
i18n (>= 1.6, < 2)
ffi (1.14.2)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic_i18n (0.6.0)
@ -146,7 +150,7 @@ GEM
http-cookie (1.0.3)
domain_name (~> 0.5)
http_accept_language (2.1.1)
i18n (0.9.5)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
inherited_resources (1.12.0)
actionpack (>= 5.2, < 6.2)
@ -157,7 +161,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.4.0)
json (2.5.1)
json_translate (4.0.0)
activerecord (>= 4.2.0)
kaminari (1.2.1)
@ -180,11 +184,11 @@ GEM
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
localeapp (2.1.1)
localeapp (3.1.3)
gli
i18n (~> 0.4)
json
rest-client
i18n (>= 0.7, < 2)
json (>= 1.7.7)
rest-client (>= 1.8.0)
loofah (2.8.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
@ -199,18 +203,18 @@ GEM
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.5.0)
minitest (5.14.2)
minitest (5.14.3)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
netrc (0.11.0)
nio4r (2.5.4)
nokogiri (1.11.0)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.20.1)
parser (2.7.2.0)
parser (3.0.0.0)
ast (~> 2.4.1)
pdf-core (0.7.0)
pg (1.2.3)
@ -228,24 +232,22 @@ GEM
raabro (1.4.0)
racc (1.5.2)
rack (2.2.3)
rack-protection (2.1.0)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.4)
actioncable (= 6.0.3.4)
actionmailbox (= 6.0.3.4)
actionmailer (= 6.0.3.4)
actionpack (= 6.0.3.4)
actiontext (= 6.0.3.4)
actionview (= 6.0.3.4)
activejob (= 6.0.3.4)
activemodel (= 6.0.3.4)
activerecord (= 6.0.3.4)
activestorage (= 6.0.3.4)
activesupport (= 6.0.3.4)
bundler (>= 1.3.0)
railties (= 6.0.3.4)
rails (6.1.1)
actioncable (= 6.1.1)
actionmailbox (= 6.1.1)
actionmailer (= 6.1.1)
actionpack (= 6.1.1)
actiontext (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activemodel (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
bundler (>= 1.15.0)
railties (= 6.1.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
@ -259,16 +261,16 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.0.3.4)
actionpack (= 6.0.3.4)
activesupport (= 6.0.3.4)
railties (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
thor (~> 1.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.1)
ransack (2.4.0)
rake (13.0.3)
ransack (2.4.1)
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
i18n
@ -288,39 +290,39 @@ GEM
netrc (~> 0.8)
rexml (3.2.4)
rollbar (2.22.1)
rspec-core (3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.0)
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.0)
rspec-mocks (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (4.0.1)
rspec-rails (4.0.2)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.9)
rspec-expectations (~> 3.9)
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.10.0)
rubocop (1.6.1)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.1)
rubocop (1.8.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.3.0)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.0)
parser (>= 2.7.1.5)
rubocop-rails (2.9.0)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.90.0, < 2.0)
ruby-progressbar (1.10.1)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.2)
rubyzip (2.3.0)
sassc (2.4.0)
@ -337,26 +339,25 @@ GEM
rubyzip (>= 1.2.2)
shoulda-matchers (4.4.1)
activesupport (>= 4.2.0)
sidekiq (6.0.7)
sidekiq (6.1.2)
connection_pool (>= 2.2.2)
rack (~> 2.0)
rack-protection (>= 2.0.0)
redis (>= 4.1.0)
sidekiq-cron (1.1.0)
redis (>= 4.2.0)
sidekiq-cron (1.2.0)
fugit (~> 1.1)
sidekiq (>= 4.2.1)
simple_form (5.0.3)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.20.0)
simplecov (0.21.1)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.2)
skylight (4.1.2)
skylight-core (= 4.1.2)
skylight-core (4.1.2)
skylight (4.3.2)
skylight-core (= 4.3.2)
skylight-core (4.3.2)
activesupport (>= 4.2.0)
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
@ -369,17 +370,16 @@ GEM
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.10)
ttfunk (1.6.2.1)
tzinfo (1.2.8)
thread_safe (~> 0.1)
ttfunk (1.7.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
unicode-display_width (2.0.0)
unicorn (5.5.5)
kgio (~> 2.6)
raindrops (~> 0.7)
@ -390,7 +390,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (4.4.1)
webdrivers (4.4.2)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
@ -417,7 +417,7 @@ DEPENDENCIES
devise (~> 4.7.1)
dotenv-rails (~> 2.7.1)
fabrication (~> 2.20)
faker (~> 1.9)
faker (~> 2.15)
has_scope (~> 0.7.2)
http_accept_language (~> 2.1.1)
jquery-rails (~> 4.3.5)
@ -425,13 +425,13 @@ DEPENDENCIES
kaminari (~> 1.2.1)
letter_opener (~> 1.7.0)
listen (~> 3.2.0)
localeapp (= 2.1.1)
localeapp (~> 3.1)
pg (~> 1.2.1)
pg_search (~> 2.3.5)
prawn (~> 2.2.0)
prawn-table (~> 0.2.2)
pundit (~> 2.1.0)
rails (~> 6.0.2)
rails (~> 6.1.1)
rails-controller-testing
rails-i18n (~> 6.0.0)
rdiscount (~> 2.2.0.1)
@ -442,16 +442,16 @@ DEPENDENCIES
sassc-rails (~> 2.1.2)
select2-rails (~> 4.0.13)
selenium-webdriver (~> 3.142)
shoulda-matchers (~> 4.4.0)
sidekiq (~> 6.0.0)
sidekiq-cron (~> 1.1.0)
shoulda-matchers (~> 4.4)
sidekiq (~> 6.1.2)
sidekiq-cron (~> 1.2.0)
simple_form (~> 5.0.2)
simplecov (~> 0.17)
skylight (~> 4.1.2)
skylight (~> 4.3.2)
uglifier (~> 4.2.0)
unicorn (~> 5.5.1)
web-console (~> 4.0.1)
webdrivers (~> 4.4.0)
webdrivers (~> 4.4)
RUBY VERSION
ruby 2.6.3p62

View File

@ -1,13 +1,10 @@
$brand-primary: $palette-turkey;
$navbar-inverse-brand-hover-color: $palette-light-blue;
$navbar-inverse-brand-color: $white;
$navbar-inverse-link-color: $white;
$navbar-inverse-link-active-color: $palette-light-blue;
$navbar-inverse-link-active-bg: $palette-turkey;
$navbar-inverse-link-hover-color: $palette-light-blue;
$navbar-inverse-toggle-border-color: $white;
$navbar-inverse-toggle-hover-bg: $palette-dark-turkey;
$navbar-inverse-bg: $palette-turkey;

View File

@ -96,7 +96,7 @@ class ApplicationController < ActionController::Base
# read locale from params, the session or the Accept-Language header
I18n.locale =
if params[:locale]
current_user.update_attributes(locale: params[:locale]) if current_user
current_user.update(locale: params[:locale]) if current_user
params[:locale]
else
options_locale

View File

@ -37,6 +37,6 @@ class MembersController < ApplicationController
def toggle_active_posts
current_organization.posts.where(user_id: @member.user_id).
each { |post| post.update_attributes(active: false) }
each { |post| post.update(active: false) }
end
end

View File

@ -33,7 +33,7 @@ class OrganizationsController < ApplicationController
end
def update
if @organization.update_attributes(organization_params)
if @organization.update(organization_params)
redirect_to @organization
else
render action: :edit, status: :unprocessable_entity

View File

@ -65,7 +65,7 @@ class PostsController < ApplicationController
persister = ::Persister::PostPersister.new(post)
if persister.update_attributes(post_params)
if persister.update(post_params)
redirect_to post
else
render action: :edit, status: :unprocessable_entity

View File

@ -48,7 +48,7 @@ class UsersController < ApplicationController
@user = scoped_users.find(params[:id])
authorize @user
if @user.update_attributes(user_params)
if @user.update(user_params)
redirect_to @user
else
render action: :edit, status: :unprocessable_entity

View File

@ -16,9 +16,9 @@ module Persister
false
end
def update_attributes(params)
def update(params)
::ActiveRecord::Base.transaction do
member.update_attributes!(params)
member.update!(params)
create_update_event!
member
end

View File

@ -17,9 +17,9 @@ module Persister
false
end
def update_attributes(params)
def update(params)
::ActiveRecord::Base.transaction do
post.update_attributes!(params)
post.update!(params)
create_update_event!
enqueue_push_notification_job!
post

View File

@ -16,9 +16,9 @@ module Persister
false
end
def update_attributes(params)
def update(params)
::ActiveRecord::Base.transaction do
transfer.update_attributes!(params)
transfer.update!(params)
create_update_event!
transfer
end

View File

@ -1,5 +1,5 @@
# This file is used by Rack-based servers to start the application.
Encoding.default_internal = 'utf-8'
Encoding.default_external = 'utf-8'
require ::File.expand_path('../config/environment', __FILE__)
require_relative 'config/environment'
run Rails.application

View File

@ -9,7 +9,7 @@ Bundler.require(*Rails.groups)
module Timeoverflow
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
config.load_defaults 6.1
# 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]

View File

@ -1,5 +1,5 @@
# config valid only for current version of Capistrano
lock '3.14.1'
lock '3.15.0'
set :application, 'timeoverflow'
set :repo_url, 'git@github.com:coopdevs/timeoverflow.git'

View File

@ -124,7 +124,7 @@ RSpec.describe MultiTransfersController, type: :controller do
post :create
response.should redirect_to('/')
expect(response).to redirect_to('/')
end
end
end

View File

@ -54,7 +54,7 @@ RSpec.describe TransfersController do
context 'when the offer is not specified' do
it 'does not find any offer' do
get :new, params: params
expect(response.body).to include('<option value="">')
expect(response.body).to include('<option value="" label=" ">')
end
end

View File

@ -12,7 +12,7 @@ RSpec.describe MemberDecorator do
end
context 'inactive member' do
before { member.update_attributes(active: false) }
before { member.update(active: false) }
it { is_expected.to eq('bg-danger') }
end
end
@ -25,7 +25,7 @@ RSpec.describe MemberDecorator do
end
context 'inactive member' do
before { member.update_attributes(active: false) }
before { member.update(active: false) }
it { is_expected.to match('icon') }
end
end
@ -42,12 +42,12 @@ RSpec.describe MemberDecorator do
let(:email) { 'foobar@gmail.com' }
context 'unconfirmed' do
before { member.user.update_attributes(unconfirmed_email: email) }
before { member.user.update(unconfirmed_email: email) }
it { is_expected.to include('mailto:foobar@gmail.com') }
end
context 'confirmed' do
before { member.user.update_attributes(email: email) }
before { member.user.update(email: email) }
it { is_expected.to include('mailto:foobar@gmail.com') }
end
end
@ -56,12 +56,12 @@ RSpec.describe MemberDecorator do
let(:email) { 'foobar@example.com' }
context 'unconfirmed' do
before { member.user.update_attributes(unconfirmed_email: email) }
before { member.user.update(unconfirmed_email: email) }
it { is_expected.to be_nil }
end
context 'confirmed' do
before { member.user.update_attributes(email: email) }
before { member.user.update(email: email) }
it { is_expected.to be_nil }
end
end

View File

@ -17,8 +17,8 @@ RSpec.describe Persister::MemberPersister do
end
end
describe '#update_attributes' do
before { persister.update_attributes(member_uid: 666) }
describe '#update' do
before { persister.update(member_uid: 666) }
it 'updates the resource attributes' do
expect(member.member_uid).to eq(666)

View File

@ -40,9 +40,9 @@ RSpec.describe Persister::PostPersister do
end
end
describe '#update_attributes' do
describe '#update' do
it 'updates the resource attributes' do
persister.update_attributes(title: 'New title')
persister.update(title: 'New title')
expect(post.title).to eq('New title')
end
@ -50,7 +50,7 @@ RSpec.describe Persister::PostPersister do
it 'creates an event' do
expect(::Event).to receive(:create!).with(action: :updated, post: post).and_return(event)
persister.update_attributes(title: 'New title')
persister.update(title: 'New title')
end
context 'background job' do
@ -60,7 +60,7 @@ RSpec.describe Persister::PostPersister do
it 'enqueues a CreatePushNotificationsJob background job' do
expect {
persister.update_attributes(title: 'New title')
persister.update(title: 'New title')
}.to enqueue_job(CreatePushNotificationsJob).with(event_id: 27)
end
end

View File

@ -26,8 +26,8 @@ RSpec.describe Persister::TransferPersister do
end
end
describe '#update_attributes' do
before { persister.update_attributes(amount: 666) }
describe '#update' do
before { persister.update(amount: 666) }
it 'updates the resource attributes' do
expect(transfer.amount).to eq(666)