Bump rails to 7 and get tests passing. Also modified rakefile so rake

command would continue to run rspec as the default command.  Added
stylesheets to assets.rb so they'll be included when precompiling
assets in production.
This commit is contained in:
Nelson Jovel 2022-01-15 12:43:01 +01:00 committed by rebuilt
parent 24f22d3c46
commit b111b2f106
16 changed files with 113 additions and 93 deletions

View file

@ -7,13 +7,15 @@ git_source(:github) do |repo_name|
end end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.4.4' gem 'rails', '~> 7.0.1'
gem 'sprockets-rails'
gem 'pg' gem 'pg'
# Use Puma as the app server # Use Puma as the app server
gem 'puma', '>= 5.5.2' gem 'puma', '>= 5.5.2'
# Use SCSS for stylesheets # Use SCSS for stylesheets
gem 'sassc-rails', require: false # gem 'sassc-rails', require: false
# Use Uglifier as compressor for JavaScript assets # Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes # See https://github.com/rails/execjs#readme for more supported runtimes
@ -70,7 +72,6 @@ group :development do
gem 'rubocop', require: false gem 'rubocop', require: false
gem 'seed_dump' gem 'seed_dump'
gem 'spring' gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end end
group 'test' do group 'test' do

View file

@ -10,74 +10,80 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (6.1.4.4) actioncable (7.0.1)
actionpack (= 6.1.4.4) actionpack (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailbox (6.1.4.4) actionmailbox (7.0.1)
actionpack (= 6.1.4.4) actionpack (= 7.0.1)
activejob (= 6.1.4.4) activejob (= 7.0.1)
activerecord (= 6.1.4.4) activerecord (= 7.0.1)
activestorage (= 6.1.4.4) activestorage (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
mail (>= 2.7.1) mail (>= 2.7.1)
actionmailer (6.1.4.4) net-imap
actionpack (= 6.1.4.4) net-pop
actionview (= 6.1.4.4) net-smtp
activejob (= 6.1.4.4) actionmailer (7.0.1)
activesupport (= 6.1.4.4) actionpack (= 7.0.1)
actionview (= 7.0.1)
activejob (= 7.0.1)
activesupport (= 7.0.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (6.1.4.4) actionpack (7.0.1)
actionview (= 6.1.4.4) actionview (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
rack (~> 2.0, >= 2.0.9) rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.4.4) actiontext (7.0.1)
actionpack (= 6.1.4.4) actionpack (= 7.0.1)
activerecord (= 6.1.4.4) activerecord (= 7.0.1)
activestorage (= 6.1.4.4) activestorage (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (6.1.4.4) actionview (7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.4.4) activejob (7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (6.1.4.4) activemodel (7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
activerecord (6.1.4.4) activerecord (7.0.1)
activemodel (= 6.1.4.4) activemodel (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
activerecord-import (1.3.0) activerecord-import (1.3.0)
activerecord (>= 4.2) activerecord (>= 4.2)
activestorage (6.1.4.4) activestorage (7.0.1)
actionpack (= 6.1.4.4) actionpack (= 7.0.1)
activejob (= 6.1.4.4) activejob (= 7.0.1)
activerecord (= 6.1.4.4) activerecord (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
marcel (~> 1.0.0) marcel (~> 1.0)
mini_mime (>= 1.1.0) mini_mime (>= 1.1.0)
activesupport (6.1.4.4) activesupport (7.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
minitest (>= 5.1) minitest (>= 5.1)
tzinfo (~> 2.0) tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0) addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2) ast (2.4.2)
bcrypt (3.1.16) bcrypt (3.1.16)
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.10.1) bootsnap (1.9.4)
msgpack (~> 1.2) msgpack (~> 1.0)
builder (3.2.4) builder (3.2.4)
bullet (7.0.1) bullet (7.0.1)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
@ -109,6 +115,7 @@ GEM
responders responders
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.5.0) diff-lcs (1.5.0)
digest (3.1.0)
erubi (1.10.0) erubi (1.10.0)
execjs (2.8.1) execjs (2.8.1)
factory_bot (6.2.0) factory_bot (6.2.0)
@ -127,6 +134,7 @@ GEM
hashie (5.0.0) hashie (5.0.0)
i18n (1.8.11) i18n (1.8.11)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
io-wait (0.2.1)
jbuilder (2.11.5) jbuilder (2.11.5)
actionview (>= 5.0.0) actionview (>= 5.0.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
@ -155,6 +163,21 @@ GEM
msgpack (1.4.2) msgpack (1.4.2)
multi_json (1.15.0) multi_json (1.15.0)
nested_scaffold (1.1.0) nested_scaffold (1.1.0)
net-imap (0.2.3)
digest
net-protocol
strscan
net-pop (0.1.1)
digest
net-protocol
timeout
net-protocol (0.1.2)
io-wait
timeout
net-smtp (0.3.1)
digest
net-protocol
timeout
newrelic_rpm (8.3.0) newrelic_rpm (8.3.0)
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.13.1-x86_64-darwin) nokogiri (1.13.1-x86_64-darwin)
@ -179,21 +202,20 @@ GEM
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (6.1.4.4) rails (7.0.1)
actioncable (= 6.1.4.4) actioncable (= 7.0.1)
actionmailbox (= 6.1.4.4) actionmailbox (= 7.0.1)
actionmailer (= 6.1.4.4) actionmailer (= 7.0.1)
actionpack (= 6.1.4.4) actionpack (= 7.0.1)
actiontext (= 6.1.4.4) actiontext (= 7.0.1)
actionview (= 6.1.4.4) actionview (= 7.0.1)
activejob (= 6.1.4.4) activejob (= 7.0.1)
activemodel (= 6.1.4.4) activemodel (= 7.0.1)
activerecord (= 6.1.4.4) activerecord (= 7.0.1)
activestorage (= 6.1.4.4) activestorage (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 6.1.4.4) railties (= 7.0.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5) rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1) actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1)
@ -203,12 +225,13 @@ GEM
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2) rails-html-sanitizer (1.4.2)
loofah (~> 2.3) loofah (~> 2.3)
railties (6.1.4.4) railties (7.0.1)
actionpack (= 6.1.4.4) actionpack (= 7.0.1)
activesupport (= 6.1.4.4) activesupport (= 7.0.1)
method_source method_source
rake (>= 0.13) rake (>= 12.2)
thor (~> 1.0) thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1) rainbow (3.1.1)
rake (13.0.6) rake (13.0.6)
rb-fsevent (0.11.0) rb-fsevent (0.11.0)
@ -248,21 +271,10 @@ GEM
rubocop-ast (1.15.1) rubocop-ast (1.15.1)
parser (>= 3.0.1.1) parser (>= 3.0.1.1)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
seed_dump (3.3.1) seed_dump (3.3.1)
activerecord (>= 4) activerecord (>= 4)
activesupport (>= 4) activesupport (>= 4)
spring (2.1.1) spring (4.0.0)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (4.0.2) sprockets (4.0.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
@ -270,10 +282,12 @@ GEM
actionpack (>= 5.2) actionpack (>= 5.2)
activesupport (>= 5.2) activesupport (>= 5.2)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
strscan (3.0.1)
temple (0.8.2) temple (0.8.2)
thor (1.2.1) thor (1.2.1)
tilt (2.0.10) tilt (2.0.10)
timecop (0.9.4) timecop (0.9.4)
timeout (0.2.0)
turbolinks (5.2.1) turbolinks (5.2.1)
turbolinks-source (~> 5.2) turbolinks-source (~> 5.2)
turbolinks-source (5.2.0) turbolinks-source (5.2.0)
@ -329,14 +343,13 @@ DEPENDENCIES
omniauth omniauth
pg pg
puma (>= 5.5.2) puma (>= 5.5.2)
rails (~> 6.1.4.4) rails (~> 7.0.1)
rails-controller-testing rails-controller-testing
rspec-rails (~> 4.1.2) rspec-rails (~> 4.1.2)
rubocop rubocop
sassc-rails
seed_dump seed_dump
spring spring
spring-watcher-listen (~> 2.0.0) sprockets-rails
timecop timecop
turbolinks (~> 5) turbolinks (~> 5)
twilio-ruby (~> 4.11.1) twilio-ruby (~> 4.11.1)

View file

@ -2,5 +2,14 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative 'config/application' require_relative 'config/application'
Rails.application.load_tasks Rails.application.load_tasks
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
# task(:default).clear
task default: :spec
rescue LoadError => e
raise e unless ENV['RAILS_ENV'] == 'production'
end

View file

@ -1,6 +1,3 @@
//= link_tree ../images //= link_tree ../images
//= link_directory ../javascripts .js
//= link sqm_application.css
//= link application.css
//= link welcome.css
//= link_tree ../builds //= link_tree ../builds
//= link_directory ../javascripts .js

View file

@ -46,7 +46,6 @@
// Utilities // Utilities
@import "bootstrap/scss/utilities/api"; @import "bootstrap/scss/utilities/api";
.popover { .popover {
box-shadow: 0 0 8px rgba($black, 0.25); box-shadow: 0 0 8px rgba($black, 0.25);
} }

View file

@ -1,6 +1,6 @@
@import "partials/colors"; @import "partials/colors";
@import "partials/sqm_bootstrap";
@import "partials/bootstrap-overrides"; @import "partials/bootstrap-overrides";
@import "partials/sqm_bootstrap";
@import "partials/clear-margin-padding"; @import "partials/clear-margin-padding";
@import "partials/fonts"; @import "partials/fonts";
@import "partials/borders"; @import "partials/borders";

View file

@ -7,7 +7,7 @@
<link href="https://fonts.googleapis.com/css?family=Cabin:400,600,700" rel="stylesheet" type="text/css"/> <link href="https://fonts.googleapis.com/css?family=Cabin:400,600,700" rel="stylesheet" type="text/css"/>
<title>MCIEA</title> <title>MCIEA</title>
<%= csp_meta_tag %> <%= csp_meta_tag %>
<%= stylesheet_link_tag 'sqm_application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'sqm', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %> <%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %>
<%= render partial: 'layouts/hotjar', locals: { hotjar_id: @hotjar_id } %> <%= render partial: 'layouts/hotjar', locals: { hotjar_id: @hotjar_id } %>

View file

@ -3,7 +3,7 @@
<title>MCIEA</title> <title>MCIEA</title>
<link href="https://fonts.googleapis.com/css?family=Bitter:400,600,700" rel="stylesheet" type="text/css"/> <link href="https://fonts.googleapis.com/css?family=Bitter:400,600,700" rel="stylesheet" type="text/css"/>
<link href="https://fonts.googleapis.com/css?family=Cabin:400,600,700" rel="stylesheet" type="text/css"/> <link href="https://fonts.googleapis.com/css?family=Cabin:400,600,700" rel="stylesheet" type="text/css"/>
<%= stylesheet_link_tag 'sqm_application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'sqm', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_link_tag 'welcome', media: 'all', 'data-turbolinks-track': 'reload' %> <%= stylesheet_link_tag 'welcome', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %> <%= render partial: 'layouts/google_analytics', locals: { google_analytics_id: @google_analytics_id } %>

View file

@ -11,5 +11,6 @@ module Edcontext
# Settings in config/environments/* take precedence over those specified here. # Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.
config.active_record.legacy_connection_handling = false
end end
end end

View file

@ -9,4 +9,4 @@ Rails.application.config.assets.version = '1.0'
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets # application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added. # folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css ) Rails.application.config.assets.precompile += %w( application.css sqm.css welcome.css)

View file

@ -18,8 +18,8 @@
"scripts": { "scripts": {
"build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds", "build": "esbuild app/javascript/*.* --bundle --outdir=app/assets/builds",
"test": "jest", "test": "jest",
"build:css": "sass ./app/assets/stylesheets/application.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules & sass ./app/assets/stylesheets/sqm_application.scss ./app/assets/builds/sqm_application.css --no-source-map --load-path=node_modules & sass ./app/assets/stylesheets/welcome.scss ./app/assets/builds/welcome.css --no-source-map --load-path=node_modules", "build:css": "sass ./app/assets/stylesheets/application.sass.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules ; sass ./app/assets/stylesheets/sqm.sass.scss ./app/assets/builds/sqm.css --no-source-map --load-path=node_modules ; sass ./app/assets/stylesheets/welcome.sass.scss ./app/assets/builds/welcome.css --no-source-map --load-path=node_modules",
"watch:css": "sass ./app/assets/stylesheets/application.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules --watch & sass ./app/assets/stylesheets/sqm_application.scss ./app/assets/builds/sqm_application.css --no-source-map --load-path=node_modules --watch & sass ./app/assets/stylesheets/welcome.scss ./app/assets/builds/welcome.css --no-source-map --load-path=node_modules --watch", "watch:css": "sass ./app/assets/stylesheets/application.sass.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules --watch & sass ./app/assets/stylesheets/sqm.sass.scss ./app/assets/builds/sqm.css --no-source-map --load-path=node_modules --watch & sass ./app/assets/stylesheets/welcome.sass.scss ./app/assets/builds/welcome.css --no-source-map --load-path=node_modules --watch",
"watch:all": "yarn watch:css & yarn build --watch" "watch:all": "yarn watch:css & yarn build --watch"
}, },
"devDependencies": { "devDependencies": {

View file

@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
describe 'categories/show.html.erb' do describe 'categories/show' do
before :each do before :each do
academic_year = create(:academic_year, range: '1989-90') academic_year = create(:academic_year, range: '1989-90')
school = create(:school, name: 'Best School') school = create(:school, name: 'Best School')

View file

@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
describe 'home/index.html.erb' do describe 'home/index' do
subject { Nokogiri::HTML(rendered) } subject { Nokogiri::HTML(rendered) }
before :each do before :each do

View file

@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
describe 'overview/index.html.erb' do describe 'overview/index' do
subject { Nokogiri::HTML(rendered) } subject { Nokogiri::HTML(rendered) }
let(:support_for_teaching) do let(:support_for_teaching) do