Merge pull request #5293 from betagouv/rails6-with-gems

Mise à jour de Rails vers la version 6
This commit is contained in:
Pierre de La Morinerie 2020-07-08 11:10:56 +02:00 committed by GitHub
commit b50a4947e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 411 additions and 287 deletions

View file

@ -340,9 +340,6 @@ Lint/EmptyInterpolation:
Lint/EmptyWhen: Lint/EmptyWhen:
Enabled: true Enabled: true
Lint/EndInMethod:
Enabled: true
Lint/EnsureReturn: Lint/EnsureReturn:
Enabled: false Enabled: false
@ -794,6 +791,9 @@ Rails/TimeZone:
Rails/UniqBeforePluck: Rails/UniqBeforePluck:
Enabled: true Enabled: true
Rails/UniqueValidationWithoutIndex:
Enabled: false
Rails/UnknownEnv: Rails/UnknownEnv:
Enabled: false Enabled: false

View file

@ -1,7 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'aasm' gem 'aasm'
gem 'actiontext', git: 'https://github.com/kobaltz/actiontext.git', branch: 'archive', require: 'action_text' # Port of ActionText to Rails 5
gem 'active_link_to' # Automatically set a class on active links gem 'active_link_to' # Automatically set a class on active links
gem 'active_model_serializers' gem 'active_model_serializers'
gem 'active_storage_validations' gem 'active_storage_validations'
@ -59,7 +58,7 @@ gem 'puma' # Use Puma as the app server
gem 'pundit' gem 'pundit'
gem 'rack-attack' gem 'rack-attack'
gem 'rack-mini-profiler' gem 'rack-mini-profiler'
gem 'rails', '= 5.2.4.3' gem 'rails', '6.0.3.2'
gem 'rails-i18n' # Locales par défaut gem 'rails-i18n' # Locales par défaut
gem 'rake-progressbar', require: false gem 'rake-progressbar', require: false
gem 'react-rails' gem 'react-rails'

View file

@ -1,15 +1,6 @@
GIT
remote: https://github.com/kobaltz/actiontext.git
revision: ef59c4ba99d1b7614dd47f5a294eef553224db88
branch: archive
specs:
actiontext (0.1.0)
nokogiri
rails (>= 5.2.0)
GIT GIT
remote: https://github.com/mina-deploy/mina.git remote: https://github.com/mina-deploy/mina.git
revision: 0dd5fdb8bb82a180d35e1fc033de2fac48257e30 revision: 84fa84c7f7f94f9518ef9b7099396ab6676b5881
specs: specs:
mina (1.2.3) mina (1.2.3)
open4 (~> 1.3.4) open4 (~> 1.3.4)
@ -18,31 +9,44 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
aasm (5.0.1) aasm (5.0.8)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
actioncable (5.2.4.3) actioncable (6.0.3.2)
actionpack (= 5.2.4.3) actionpack (= 6.0.3.2)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.4.3) actionmailbox (6.0.3.2)
actionpack (= 5.2.4.3) actionpack (= 6.0.3.2)
actionview (= 5.2.4.3) activejob (= 6.0.3.2)
activejob (= 5.2.4.3) activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
mail (>= 2.7.1)
actionmailer (6.0.3.2)
actionpack (= 6.0.3.2)
actionview (= 6.0.3.2)
activejob (= 6.0.3.2)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.4.3) actionpack (6.0.3.2)
actionview (= 5.2.4.3) actionview (= 6.0.3.2)
activesupport (= 5.2.4.3) activesupport (= 6.0.3.2)
rack (~> 2.0, >= 2.0.8) rack (~> 2.0, >= 2.0.8)
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.0.2) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (5.2.4.3) actiontext (6.0.3.2)
activesupport (= 5.2.4.3) actionpack (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
nokogiri (>= 1.8.5)
actionview (6.0.3.2)
activesupport (= 6.0.3.2)
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.0, >= 1.0.3) rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_link_to (1.0.5) active_link_to (1.0.5)
actionpack actionpack
addressable addressable
@ -51,31 +55,32 @@ GEM
activemodel (>= 4.1, < 6.1) activemodel (>= 4.1, < 6.1)
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
active_storage_validations (0.8.7) active_storage_validations (0.8.8)
rails (>= 5.2.0) rails (>= 5.2.0)
activejob (5.2.4.3) activejob (6.0.3.2)
activesupport (= 5.2.4.3) activesupport (= 6.0.3.2)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.4.3) activemodel (6.0.3.2)
activesupport (= 5.2.4.3) activesupport (= 6.0.3.2)
activerecord (5.2.4.3) activerecord (6.0.3.2)
activemodel (= 5.2.4.3) activemodel (= 6.0.3.2)
activesupport (= 5.2.4.3) activesupport (= 6.0.3.2)
arel (>= 9.0) activestorage (6.0.3.2)
activestorage (5.2.4.3) actionpack (= 6.0.3.2)
actionpack (= 5.2.4.3) activejob (= 6.0.3.2)
activerecord (= 5.2.4.3) activerecord (= 6.0.3.2)
marcel (~> 0.3.1) marcel (~> 0.3.1)
activestorage-openstack (1.4.1) activestorage-openstack (1.4.1)
fog-openstack (~> 1.0) fog-openstack (~> 1.0)
marcel marcel
mime-types mime-types
rails (>= 5.2.2) rails (>= 5.2.2)
activesupport (5.2.4.3) activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
administrate (0.13.0) administrate (0.13.0)
@ -90,12 +95,11 @@ GEM
sassc-rails (~> 2.1) sassc-rails (~> 2.1)
selectize-rails (~> 0.6) selectize-rails (~> 0.6)
aes_key_wrap (1.0.1) aes_key_wrap (1.0.1)
after_party (1.10.0) after_party (1.11.2)
anchored (1.1.0) anchored (1.1.0)
arel (9.0.0)
ast (2.4.0) ast (2.4.0)
attr_required (1.0.1) attr_required (1.0.1)
autoprefixer-rails (9.7.4) autoprefixer-rails (9.7.6)
execjs execjs
axe-matchers (2.6.1) axe-matchers (2.6.1)
dumb_delegator (~> 0.8) dumb_delegator (~> 0.8)
@ -111,19 +115,19 @@ GEM
babel-transpiler (0.7.0) babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6) babel-source (>= 4.0, < 6)
execjs (~> 2.0) execjs (~> 2.0)
bcrypt (3.1.12) bcrypt (3.1.13)
bindata (2.4.4) bindata (2.4.7)
bindex (0.5.0) bindex (0.8.1)
bootstrap-sass (3.4.1) bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1) autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0) sassc (>= 2.0.0)
bootstrap-wysihtml5-rails (0.3.3.8) bootstrap-wysihtml5-rails (0.3.3.8)
railties (>= 3.0) railties (>= 3.0)
brakeman (4.3.1) brakeman (4.8.1)
browser (4.0.0) browser (4.0.0)
builder (3.2.4) builder (3.2.4)
byebug (10.0.2) byebug (11.1.1)
capybara (3.29.0) capybara (3.32.1)
addressable addressable
mini_mime (>= 0.1.3) mini_mime (>= 0.1.3)
nokogiri (~> 1.8) nokogiri (~> 1.8)
@ -134,7 +138,7 @@ GEM
capybara-email (3.0.1) capybara-email (3.0.1)
capybara (>= 2.4, < 4.0) capybara (>= 2.4, < 4.0)
mail mail
capybara-screenshot (1.0.23) capybara-screenshot (1.0.24)
capybara (>= 1.0, < 4) capybara (>= 1.0, < 4)
launchy launchy
capybara-selenium (0.0.6) capybara-selenium (0.0.6)
@ -148,16 +152,15 @@ GEM
nokogiri (~> 1.10, >= 1.10.4) nokogiri (~> 1.10, >= 1.10.4)
rubyzip (>= 1.3.0, < 3) rubyzip (>= 1.3.0, < 3)
chartkick (3.3.1) chartkick (3.3.1)
childprocess (0.9.0) childprocess (3.0.0)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.11) chunky_png (1.3.11)
clamav-client (3.1.0) clamav-client (3.2.0)
coderay (1.1.2) coderay (1.1.2)
coercible (1.0.0) coercible (1.0.0)
descendants_tracker (~> 0.0.1) descendants_tracker (~> 0.0.1)
coffee-rails (4.2.2) coffee-rails (5.0.0)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0) railties (>= 5.2.0)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
@ -169,9 +172,8 @@ GEM
crass (1.0.6) crass (1.0.6)
css_parser (1.7.1) css_parser (1.7.1)
addressable addressable
curb (0.9.10)
daemons (1.3.1) daemons (1.3.1)
database_cleaner (1.7.0) database_cleaner (1.8.4)
datetime_picker_rails (0.0.7) datetime_picker_rails (0.0.7)
momentjs-rails (>= 2.8.1) momentjs-rails (>= 2.8.1)
deep_cloneable (3.0.0) deep_cloneable (3.0.0)
@ -202,7 +204,7 @@ GEM
diff-lcs (1.3) diff-lcs (1.3)
discard (1.2.0) discard (1.2.0)
activerecord (>= 4.2, < 7) activerecord (>= 4.2, < 7)
domain_name (0.5.20180417) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.5) dotenv (2.7.5)
dotenv-rails (2.7.5) dotenv-rails (2.7.5)
@ -218,14 +220,14 @@ GEM
erubis (2.7.0) erubis (2.7.0)
et-orbi (1.2.4) et-orbi (1.2.4)
tzinfo tzinfo
ethon (0.11.0) ethon (0.12.0)
ffi (>= 1.3.0) ffi (>= 1.3.0)
eventmachine (1.2.7) eventmachine (1.2.7)
excon (0.72.0) excon (0.73.0)
execjs (2.7.0) execjs (2.7.0)
factory_bot (4.11.1) factory_bot (5.1.2)
activesupport (>= 3.0.0) activesupport (>= 4.2.0)
faraday (0.15.4) faraday (1.0.1)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.13.1) ffi (1.13.1)
ffi-geos (2.1.0) ffi-geos (2.1.0)
@ -254,11 +256,11 @@ GEM
font-awesome-rails (4.7.0.5) font-awesome-rails (4.7.0.5)
railties (>= 3.2, < 6.1) railties (>= 3.2, < 6.1)
formatador (0.2.5) formatador (0.2.5)
fugit (1.3.3) fugit (1.3.4)
et-orbi (~> 1.1, >= 1.1.8) et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.1) raabro (~> 1.1)
geo_coord (0.1.0) geo_coord (0.1.0)
geocoder (1.6.1) geocoder (1.6.2)
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
gon (6.3.2) gon (6.3.2)
@ -283,7 +285,7 @@ GEM
rails (>= 5.1.0) rails (>= 5.1.0)
groupdate (5.0.0) groupdate (5.0.0)
activesupport (>= 5) activesupport (>= 5)
guard (2.15.0) guard (2.16.2)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0) lumberjack (>= 1.0.12, < 2.0)
@ -318,14 +320,15 @@ GEM
rainbow rainbow
rubocop (>= 0.50.0) rubocop (>= 0.50.0)
sysexits (~> 1.1) sysexits (~> 1.1)
hashdiff (0.3.8) hashdiff (1.0.1)
hashie (3.6.0) hashie (4.1.0)
html2haml (2.2.0) html2haml (2.2.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
haml (>= 4.0, < 6) haml (>= 4.0, < 6)
nokogiri (>= 1.6.0) nokogiri (>= 1.6.0)
ruby_parser (~> 3.5) ruby_parser (~> 3.5)
htmlentities (4.3.4) htmlentities (4.3.4)
http-accept (1.7.0)
http-cookie (1.0.3) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
@ -344,7 +347,7 @@ GEM
aes_key_wrap aes_key_wrap
bindata bindata
jsonapi-renderer (0.2.2) jsonapi-renderer (0.2.2)
jwt (2.1.0) jwt (2.2.1)
kaminari (1.2.1) kaminari (1.2.1)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1) kaminari-actionview (= 1.2.1)
@ -357,19 +360,18 @@ GEM
activerecord activerecord
kaminari-core (= 1.2.1) kaminari-core (= 1.2.1)
kaminari-core (1.2.1) kaminari-core (1.2.1)
launchy (2.4.3) launchy (2.5.0)
addressable (~> 2.3) addressable (~> 2.7)
letter_opener (1.7.0) letter_opener (1.7.0)
launchy (~> 2.2) launchy (~> 2.2)
letter_opener_web (1.4.0) letter_opener_web (1.4.0)
actionmailer (>= 3.2) actionmailer (>= 3.2)
letter_opener (~> 1.0) letter_opener (~> 1.0)
railties (>= 3.2) railties (>= 3.2)
listen (3.1.5) listen (3.2.1)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.10)
ruby_dep (~> 1.2) lograge (0.11.2)
lograge (0.10.0)
actionpack (>= 4) actionpack (>= 4)
activesupport (>= 4) activesupport (>= 4)
railties (>= 4) railties (>= 4)
@ -378,7 +380,7 @@ GEM
loofah (2.6.0) loofah (2.6.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.13) lumberjack (1.2.4)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
mailjet (1.5.4) mailjet (1.5.4)
@ -387,7 +389,7 @@ GEM
rest-client rest-client
marcel (0.3.3) marcel (0.3.3)
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
method_source (0.9.2) method_source (1.0.0)
mime-types (3.3.1) mime-types (3.3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009) mime-types-data (3.2019.1009)
@ -399,26 +401,27 @@ GEM
railties (>= 3.1) railties (>= 3.1)
multi_json (1.14.1) multi_json (1.14.1)
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.0.0) multipart-post (2.1.1)
mustermann (1.0.3) mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
nenv (0.3.0) nenv (0.3.0)
netrc (0.11.0) netrc (0.11.0)
nio4r (2.5.2) nio4r (2.5.2)
nokogiri (1.10.9) nokogiri (1.10.9)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
notiffany (0.1.1) notiffany (0.1.3)
nenv (~> 0.1) nenv (~> 0.1)
shellany (~> 0.0) shellany (~> 0.0)
oauth2 (1.4.1) oauth2 (1.4.4)
faraday (>= 0.8, < 0.16.0) faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0) jwt (>= 1.0, < 3.0)
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (>= 1.2, < 3) rack (>= 1.2, < 3)
omniauth (1.9.0) omniauth (1.9.1)
hashie (>= 3.4.6, < 3.7.0) hashie (>= 3.4.6)
rack (>= 1.6.2, < 3) rack (>= 1.6.2, < 3)
omniauth-github (1.3.0) omniauth-github (1.4.0)
omniauth (~> 1.5) omniauth (~> 1.5)
omniauth-oauth2 (>= 1.4.0, < 2.0) omniauth-oauth2 (>= 1.4.0, < 2.0)
omniauth-oauth2 (1.6.0) omniauth-oauth2 (1.6.0)
@ -428,7 +431,7 @@ GEM
actionpack (>= 4.2) actionpack (>= 4.2)
omniauth (>= 1.3.1) omniauth (>= 1.3.1)
open4 (1.3.4) open4 (1.3.4)
openid_connect (1.1.6) openid_connect (1.1.8)
activemodel activemodel
attr_required (>= 1.0.0) attr_required (>= 1.0.0)
json-jwt (>= 1.5.0) json-jwt (>= 1.5.0)
@ -440,11 +443,11 @@ GEM
webfinger (>= 1.0.1) webfinger (>= 1.0.1)
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.19.1) parallel (1.19.1)
parser (2.7.0.4) parser (2.7.1.0)
ast (~> 2.4.0) ast (~> 2.4.0)
pdf-core (0.7.0) pdf-core (0.7.0)
pg (1.1.3) pg (1.2.3)
phonelib (0.6.39) phonelib (0.6.43)
prawn (2.2.2) prawn (2.2.2)
pdf-core (~> 0.7.0) pdf-core (~> 0.7.0)
ttfunk (~> 1.5) ttfunk (~> 1.5)
@ -452,7 +455,7 @@ GEM
prawn prawn
prawn-table prawn-table
rails (>= 3.1.0) rails (>= 3.1.0)
prawn-svg (0.29.1) prawn-svg (0.30.0)
css_parser (~> 1.6) css_parser (~> 1.6)
prawn (>= 0.11.1, < 3) prawn (>= 0.11.1, < 3)
prawn-table (0.2.2) prawn-table (0.2.2)
@ -461,50 +464,53 @@ GEM
addressable addressable
css_parser (>= 1.6.0) css_parser (>= 1.6.0)
htmlentities (>= 4.0.0) htmlentities (>= 4.0.0)
premailer-rails (1.10.3) premailer-rails (1.11.1)
actionmailer (>= 3) actionmailer (>= 3)
premailer (~> 1.7, >= 1.7.9) premailer (~> 1.7, >= 1.7.9)
promise.rb (0.7.4) promise.rb (0.7.4)
pry (0.12.2) pry (0.13.1)
coderay (~> 1.1.0) coderay (~> 1.1)
method_source (~> 0.9.0) method_source (~> 1.0)
pry-byebug (3.6.0) pry-byebug (3.9.0)
byebug (~> 10.0) byebug (~> 11.0)
pry (~> 0.10) pry (~> 0.13.0)
public_suffix (4.0.3) public_suffix (4.0.4)
puma (3.12.6) puma (4.3.3)
pundit (2.0.1) nio4r (~> 2.0)
pundit (2.1.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
raabro (1.1.6) raabro (1.1.6)
rack (2.2.3) rack (2.0.9)
rack-attack (6.0.0) rack-attack (6.2.2)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rack-mini-profiler (1.0.1) rack-mini-profiler (2.0.1)
rack (>= 1.2.0) rack (>= 1.2.0)
rack-oauth2 (1.9.3) rack-oauth2 (1.12.0)
activesupport activesupport
attr_required attr_required
httpclient httpclient
json-jwt (>= 1.9.0) json-jwt (>= 1.11.0)
rack rack (< 2.1)
rack-protection (2.0.5) rack-protection (2.0.8.1)
rack rack
rack-proxy (0.6.5) rack-proxy (0.6.5)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.4.3) rails (6.0.3.2)
actioncable (= 5.2.4.3) actioncable (= 6.0.3.2)
actionmailer (= 5.2.4.3) actionmailbox (= 6.0.3.2)
actionpack (= 5.2.4.3) actionmailer (= 6.0.3.2)
actionview (= 5.2.4.3) actionpack (= 6.0.3.2)
activejob (= 5.2.4.3) actiontext (= 6.0.3.2)
activemodel (= 5.2.4.3) actionview (= 6.0.3.2)
activerecord (= 5.2.4.3) activejob (= 6.0.3.2)
activestorage (= 5.2.4.3) activemodel (= 6.0.3.2)
activesupport (= 5.2.4.3) activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.2.4.3) railties (= 6.0.3.2)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4) rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x) actionpack (>= 5.0.1.x)
@ -515,59 +521,60 @@ GEM
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0) rails-html-sanitizer (1.3.0)
loofah (~> 2.3) loofah (~> 2.3)
rails-i18n (5.1.2) rails-i18n (6.0.0)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 5.0, < 6) railties (>= 6.0.0, < 7)
railties (5.2.4.3) railties (6.0.3.2)
actionpack (= 5.2.4.3) actionpack (= 6.0.3.2)
activesupport (= 5.2.4.3) activesupport (= 6.0.3.2)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0) thor (>= 0.20.3, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (13.0.1) rake (13.0.1)
rake-progressbar (0.0.5) rake-progressbar (0.0.5)
rb-fsevent (0.10.4) rb-fsevent (0.10.4)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
react-rails (2.4.7) react-rails (2.6.1)
babel-transpiler (>= 0.7.0) babel-transpiler (>= 0.7.0)
connection_pool connection_pool
execjs execjs
railties (>= 3.2) railties (>= 3.2)
tilt tilt
regexp_parser (1.6.0) regexp_parser (1.7.0)
request_store (1.5.0) request_store (1.5.0)
rack (>= 1.4) rack (>= 1.4)
responders (3.0.0) responders (3.0.0)
actionpack (>= 5.0) actionpack (>= 5.0)
railties (>= 5.0) railties (>= 5.0)
rest-client (2.0.2) rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 4.0)
netrc (~> 0.8) netrc (~> 0.8)
rexml (3.2.4) rexml (3.2.4)
rgeo (2.0.0) rgeo (2.1.1)
rgeo-geojson (2.1.1) rgeo-geojson (2.1.1)
rgeo (>= 1.0.0) rgeo (>= 1.0.0)
rodf (1.1.1) rodf (1.1.1)
builder (>= 3.0) builder (>= 3.0)
dry-inflector (~> 0.1) dry-inflector (~> 0.1)
rubyzip (>= 1.0) rubyzip (>= 1.0)
rouge (3.16.0) rouge (3.17.0)
rspec (3.9.0) rspec (3.9.0)
rspec-core (~> 3.9.0) rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0) rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0) rspec-mocks (~> 3.9.0)
rspec-core (3.9.1) rspec-core (3.9.1)
rspec-support (~> 3.9.1) rspec-support (~> 3.9.1)
rspec-expectations (3.9.0) rspec-expectations (3.9.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0) rspec-support (~> 3.9.0)
rspec-mocks (3.9.1) rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0) rspec-support (~> 3.9.0)
rspec-rails (4.0.0.beta4) rspec-rails (4.0.0)
actionpack (>= 4.2) actionpack (>= 4.2)
activesupport (>= 4.2) activesupport (>= 4.2)
railties (>= 4.2) railties (>= 4.2)
@ -578,17 +585,18 @@ GEM
rspec-support (3.9.2) rspec-support (3.9.2)
rspec_junit_formatter (0.4.1) rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0) rspec-core (>= 2, < 4, != 2.12.0)
rubocop (0.80.1) rubocop (0.81.0)
jaro_winkler (~> 1.5.1) jaro_winkler (~> 1.5.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.7.0.1) parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
rexml rexml
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7) unicode-display_width (>= 1.4.0, < 2.0)
rubocop-performance (1.5.2) rubocop-performance (1.5.2)
rubocop (>= 0.71.0) rubocop (>= 0.71.0)
rubocop-rails (2.4.2) rubocop-rails (2.5.2)
activesupport
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 0.72.0) rubocop (>= 0.72.0)
rubocop-rails_config (0.10.0) rubocop-rails_config (0.10.0)
@ -598,14 +606,14 @@ GEM
rubocop-rails (~> 2.0) rubocop-rails (~> 2.0)
rubocop-rspec-focused (1.0.0) rubocop-rspec-focused (1.0.0)
rubocop (>= 0.51) rubocop (>= 0.51)
ruby-debug-ide (0.6.1) ruby-debug-ide (0.7.2)
rake (>= 0.8.1) rake (>= 0.8.1)
ruby-progressbar (1.10.1) ruby-progressbar (1.10.1)
ruby_dep (1.5.0) ruby2_keywords (0.0.2)
ruby_parser (3.14.2) ruby_parser (3.14.2)
sexp_processor (~> 4.9) sexp_processor (~> 4.9)
rubyzip (1.3.0) rubyzip (2.3.0)
safe_yaml (1.0.4) safe_yaml (1.0.5)
sanitize-url (0.1.4) sanitize-url (0.1.4)
sass (3.7.4) sass (3.7.4)
sass-listen (~> 4.0.0) sass-listen (~> 4.0.0)
@ -623,29 +631,29 @@ GEM
scss_lint (0.59.0) scss_lint (0.59.0)
sass (~> 3.5, >= 3.5.5) sass (~> 3.5, >= 3.5.5)
selectize-rails (0.12.6) selectize-rails (0.12.6)
selenium-webdriver (3.141.0) selenium-webdriver (3.142.7)
childprocess (~> 0.5) childprocess (>= 0.5, < 4.0)
rubyzip (~> 1.2, >= 1.2.2) rubyzip (>= 1.2.2)
semantic_range (2.3.0) semantic_range (2.3.0)
sentry-raven (2.7.4) sentry-raven (3.0.0)
faraday (>= 0.7.6, < 1.0) faraday (>= 1.0)
sexp_processor (4.14.1) sexp_processor (4.14.1)
shellany (0.0.1) shellany (0.0.1)
shoulda-matchers (4.0.1) shoulda-matchers (4.3.0)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
simple_xlsx_reader (1.0.4) simple_xlsx_reader (1.0.4)
nokogiri nokogiri
rubyzip rubyzip
sinatra (2.0.5) sinatra (2.0.8.1)
mustermann (~> 1.0) mustermann (~> 1.0)
rack (~> 2.0) rack (~> 2.0)
rack-protection (= 2.0.5) rack-protection (= 2.0.8.1)
tilt (~> 2.0) tilt (~> 2.0)
skylight (4.2.1) skylight (4.2.3)
skylight-core (= 4.2.1) skylight-core (= 4.2.3)
skylight-core (4.2.1) skylight-core (4.2.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
smart_listing (1.2.2) smart_listing (1.2.3)
coffee-rails coffee-rails
jquery-rails jquery-rails
kaminari (>= 0.17) kaminari (>= 0.17)
@ -654,8 +662,7 @@ GEM
axlsx_styler (>= 1.0.0, < 2) axlsx_styler (>= 1.0.0, < 2)
caxlsx (>= 2.0.2, < 4) caxlsx (>= 2.0.2, < 4)
rodf (>= 1.0.0, < 2) rodf (>= 1.0.0, < 2)
spring (2.0.2) spring (2.1.0)
activesupport (>= 4.2)
spring-commands-rspec (1.0.4) spring-commands-rspec (1.0.4)
spring (>= 0.9.1) spring (>= 0.9.1)
sprockets (3.7.2) sprockets (3.7.2)
@ -675,22 +682,22 @@ GEM
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
timecop (0.9.1) timecop (0.9.1)
ttfunk (1.5.1) ttfunk (1.6.2.1)
typhoeus (1.3.1) typhoeus (1.3.1)
ethon (>= 0.9.0) ethon (>= 0.9.0)
tzinfo (1.2.7) tzinfo (1.2.7)
thread_safe (~> 0.1) thread_safe (~> 0.1)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.5) unf_ext (0.0.7.7)
unicode-display_width (1.6.1) unicode-display_width (1.7.0)
validate_email (0.1.6) validate_email (0.1.6)
activemodel (>= 3.0) activemodel (>= 3.0)
mail (>= 2.2.5) mail (>= 2.2.5)
validate_url (1.0.2) validate_url (1.0.8)
activemodel (>= 3.0.0) activemodel (>= 3.0.0)
addressable public_suffix
vcr (4.0.0) vcr (5.1.0)
virtus (1.0.5) virtus (1.0.5)
axiom-types (~> 0.1) axiom-types (~> 0.1)
coercible (~> 1.0) coercible (~> 1.0)
@ -698,22 +705,22 @@ GEM
equalizer (~> 0.0, >= 0.0.9) equalizer (~> 0.0, >= 0.0.9)
warden (1.2.8) warden (1.2.8)
rack (>= 2.0.6) rack (>= 2.0.6)
web-console (3.7.0) web-console (4.0.1)
actionview (>= 5.0) actionview (>= 6.0.0)
activemodel (>= 5.0) activemodel (>= 6.0.0)
bindex (>= 0.4.0) bindex (>= 0.4.0)
railties (>= 5.0) railties (>= 6.0.0)
webdrivers (4.1.3) webdrivers (4.2.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
rubyzip (>= 1.3.0) rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0) selenium-webdriver (>= 3.0, < 4.0)
webfinger (1.1.0) webfinger (1.1.0)
activesupport activesupport
httpclient (>= 2.4) httpclient (>= 2.4)
webmock (3.5.1) webmock (3.8.3)
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.1.1) webpacker (5.1.1)
activesupport (>= 5.2) activesupport (>= 5.2)
rack-proxy (>= 0.6.1) rack-proxy (>= 0.6.1)
@ -724,21 +731,20 @@ GEM
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
xray-rails (0.3.1) xray-rails (0.3.2)
rails (>= 3.1.0) rails (>= 3.1.0)
zip_tricks (4.7.4) zeitwerk (2.3.1)
zipline (1.1.0) zip_tricks (5.0.0)
curb (>= 0.8.0, < 0.10) zipline (1.1.1)
rails (>= 3.2.1, < 6.1) rails (>= 3.2.1, < 6.1)
zip_tricks (>= 4.2.1, <= 5.0.0) zip_tricks (>= 4.2.1, <= 5.0.0)
zxcvbn-ruby (0.1.2) zxcvbn-ruby (1.0.0)
PLATFORMS PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
aasm aasm
actiontext!
active_link_to active_link_to
active_model_serializers active_model_serializers
active_storage_validations active_storage_validations
@ -814,7 +820,7 @@ DEPENDENCIES
pundit pundit
rack-attack rack-attack
rack-mini-profiler rack-mini-profiler
rails (= 5.2.4.3) rails (= 6.0.3.2)
rails-controller-testing rails-controller-testing
rails-i18n rails-i18n
rake-progressbar rake-progressbar

View file

@ -74,21 +74,25 @@ class Admin::ProceduresController < AdminController
flash.notice = "Démarche publiée" flash.notice = "Démarche publiée"
render js: "window.location='#{admin_procedures_path}'" render js: "window.location='#{admin_procedures_path}'"
rescue ActiveRecord::RecordInvalid rescue ActiveRecord::RecordInvalid
render 'publish_validate', formats: :js respond_to do |format|
format.js { render :publish_validate }
end
end end
def transfer def transfer
admin = Administrateur.by_email(params[:email_admin].downcase) admin = Administrateur.by_email(params[:email_admin].downcase)
if admin.nil? if admin.nil?
render '/admin/procedures/transfer', formats: 'js', status: 404 respond_to do |format|
format.js { render :transfer, status: :not_found }
end
else else
procedure = current_administrateur.procedures.find(params[:procedure_id]) procedure = current_administrateur.procedures.find(params[:procedure_id])
procedure.clone(admin, false) procedure.clone(admin, false)
flash.now.notice = "La démarche a correctement été clonée vers le nouvel administrateur." flash.now.notice = "La démarche a correctement été clonée vers le nouvel administrateur."
render '/admin/procedures/transfer', formats: 'js', status: 200 respond_to(&:js)
end end
end end

View file

@ -9,12 +9,6 @@ class Champs::PieceJustificativeController < ApplicationController
render :show render :show
else else
errors = @champ.errors.full_messages errors = @champ.errors.full_messages
# Before Rails 6, the attachment was persisted to database
# by 'attach', even before calling save.
# So until we're on Rails 6, we need to purge the file explicitely.
@champ.piece_justificative_file.purge_later
render :json => { errors: errors }, :status => 422 render :json => { errors: errors }, :status => 422
end end
end end

View file

@ -1,6 +1,4 @@
class ActiveStorage::VirusScanner class ActiveStorage::VirusScanner
include ActiveStorage::Downloading
def initialize(blob) def initialize(blob)
@blob = blob @blob = blob
end end
@ -32,7 +30,7 @@ class ActiveStorage::VirusScanner
end end
def metadata def metadata
download_blob_to_tempfile do |file| blob.open do |file|
if ClamavService.safe_file?(file.path) if ClamavService.safe_file?(file.path)
{ virus_scan_result: SAFE, scanned_at: Time.zone.now } { virus_scan_result: SAFE, scanned_at: Time.zone.now }
else else

View file

@ -110,7 +110,7 @@ class AttestationTemplate < ApplicationRecord
def build_pdf(dossier) def build_pdf(dossier)
attestation = render_attributes_for(dossier: dossier) attestation = render_attributes_for(dossier: dossier)
action_view = ActionView::Base.new(ActionController::Base.view_paths, attestation: attestation) action_view = ActionView::Base.new(ActionController::Base.view_paths, attestation: attestation)
attestation_view = action_view.render(file: 'admin/attestation_templates/show', formats: [:pdf]) attestation_view = action_view.render(file: 'admin/attestation_templates/show.pdf.prawn')
StringIO.new(attestation_view) StringIO.new(attestation_view)
end end

View file

@ -17,7 +17,7 @@ class BillSignature < ApplicationRecord
end end
def serialize_operations(day) def serialize_operations(day)
self.serialized.attach( serialized.attach(
io: StringIO.new(operations_bill_json), io: StringIO.new(operations_bill_json),
filename: "demarches-simplifiees-operations-#{day.to_date.iso8601}.json", filename: "demarches-simplifiees-operations-#{day.to_date.iso8601}.json",
content_type: 'application/json', content_type: 'application/json',
@ -40,7 +40,7 @@ class BillSignature < ApplicationRecord
end end
def set_signature(signature, day) def set_signature(signature, day)
self.signature.attach( signature.attach(
io: StringIO.new(signature), io: StringIO.new(signature),
filename: "demarches-simplifiees-signature-#{day.to_date.iso8601}.der", filename: "demarches-simplifiees-signature-#{day.to_date.iso8601}.der",
content_type: 'application/x-x509-ca-cert' content_type: 'application/x-x509-ca-cert'
@ -49,36 +49,66 @@ class BillSignature < ApplicationRecord
# Validations # Validations
def check_bill_digest def check_bill_digest
if self.digest != self.operations_bill_digest if digest != operations_bill_digest
errors.add(:digest) errors.add(:digest)
end end
end end
def check_serialized_bill_contents def check_serialized_bill_contents
if !self.serialized.attached? if !serialized.attached?
errors.add(:serialized, :blank) errors.add(:serialized, :blank)
return return
end end
if JSON.parse(self.serialized.download) != self.operations_bill if JSON.parse(read_serialized) != operations_bill
errors.add(:serialized) errors.add(:serialized)
end end
end end
def check_signature_contents def check_signature_contents
if !self.signature.attached? if !signature.attached?
errors.add(:signature, :blank) errors.add(:signature, :blank)
return return
end end
timestamp_signature_date = ASN1::Timestamp.signature_time(self.signature.download) timestamp_signature_date = ASN1::Timestamp.signature_time(read_signature)
if timestamp_signature_date > Time.zone.now if timestamp_signature_date > Time.zone.now
errors.add(:signature, :invalid_date) errors.add(:signature, :invalid_date)
end end
timestamp_signed_digest = ASN1::Timestamp.signed_digest(self.signature.download) timestamp_signed_digest = ASN1::Timestamp.signed_digest(read_signature)
if timestamp_signed_digest != self.digest if timestamp_signed_digest != digest
errors.add(:signature) errors.add(:signature)
end end
end end
def read_signature
if attachment_changes['signature']
io = io_for_changes(attachment_changes['signature'])
io.read if io.present?
elsif signature.attached?
signature.download
end
end
def read_serialized
if attachment_changes['serialized']
io = io_for_changes(attachment_changes['serialized'])
io.read if io.present?
elsif serialized.attached?
serialized.download
end
end
private
def io_for_changes(attachment_changes)
attachable = attachment_changes.attachable
case attachable
when ActionDispatch::Http::UploadedFile, Rack::Test::UploadedFile
attachable.open
when Hash
attachable.fetch(:io)
end
end
end end

View file

@ -6,7 +6,7 @@ module BlobSignedIdConcern
# This is a measure to ensure that we never under any circumstance # This is a measure to ensure that we never under any circumstance
# expose permanent attachment url # expose permanent attachment url
def signed_id def signed_id
ActiveStorage.verifier.generate(id, purpose: :blob_id, expires_in: ActiveStorage::Service.url_expires_in) ActiveStorage.verifier.generate(id, purpose: :blob_id, expires_in: Rails.application.config.active_storage.service_urls_expire_in)
end end
end end
end end

View file

@ -79,7 +79,7 @@ class ProcedurePresentation < ApplicationRecord
case table case table
when 'notifications' when 'notifications'
dossiers_id_with_notification = dossiers.with_notifications.merge(instructeur.followed_dossiers).ids dossiers_id_with_notification = dossiers.merge(instructeur.followed_dossiers).with_notifications.ids
if order == 'desc' if order == 'desc'
return dossiers_id_with_notification + return dossiers_id_with_notification +
(dossiers.order('dossiers.updated_at desc').ids - dossiers_id_with_notification) (dossiers.order('dossiers.updated_at desc').ids - dossiers_id_with_notification)

View file

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__) APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot' require_relative '../config/boot'
require 'rails/commands' require 'rails/commands'

View file

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot' require_relative '../config/boot'
require 'rake' require 'rake'
Rake.application.run Rake.application.run

View file

@ -4,8 +4,8 @@ Dir.chdir(APP_ROOT) do
begin begin
exec "yarnpkg", *ARGV exec "yarnpkg", *ARGV
rescue Errno::ENOENT rescue Errno::ENOENT
warn "Yarn executable was not detected in the system." $stderr.puts "Yarn executable was not detected in the system."
warn "Download Yarn at https://yarnpkg.com/en/docs/install" $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1 exit 1
end end
end end

View file

@ -10,6 +10,7 @@ Dotenv::Railtie.load
module TPS module TPS
class Application < Rails::Application class Application < Rails::Application
config.load_defaults 5.0
# 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.
@ -33,7 +34,19 @@ module TPS
config.active_job.queue_adapter = :delayed_job config.active_job.queue_adapter = :delayed_job
config.action_view.sanitized_allowed_tags = ActionView::Base.sanitized_allowed_tags + ['u'] # The default list used to be accessible through `ActionView::Base.sanitized_allowed_tags`,
# but a regression in Rails 6.0 makes it unavailable.
# It should be fixed in Rails 6.1.
# See https://github.com/rails/rails/issues/39586
# default_allowed_tags = ActionView::Base.sanitized_allowed_tags
default_allowed_tags = ['strong', 'em', 'b', 'i', 'p', 'code', 'pre', 'tt', 'samp', 'kbd', 'var', 'sub', 'sup', 'dfn', 'cite', 'big', 'small', 'address', 'hr', 'br', 'div', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'abbr', 'acronym', 'a', 'img', 'blockquote', 'del', 'ins']
config.action_view.sanitized_allowed_tags = default_allowed_tags + ['u']
config.action_controller.per_form_csrf_tokens = nil
config.action_controller.forgery_protection_origin_check = nil
ActiveSupport.to_time_preserves_timezone = false
config.active_record.belongs_to_required_by_default = false
config.ssl_options = {}
# Some mobile browsers have a behaviour where, although they will delete the session # Some mobile browsers have a behaviour where, although they will delete the session
# cookie when the browser shutdowns, they will still serve a cached version # cookie when the browser shutdowns, they will still serve a cached version

View file

@ -1,5 +1,5 @@
# Load the Rails application. # Load the Rails application.
require File.expand_path('application', __dir__) require_relative 'application'
# Initialize the Rails application. # Initialize the Rails application.
Rails.application.initialize! Rails.application.initialize!

View file

@ -30,6 +30,9 @@ Rails.application.configure do
# Raise an error on page load if there are pending migrations. # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets. # Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large # This option may cause significant delays in view rendering with a large
# number of complex assets. # number of complex assets.
@ -84,4 +87,6 @@ Rails.application.configure do
if ENV['RAILS_QUEUE_ADAPTER'] if ENV['RAILS_QUEUE_ADAPTER']
config.active_job.queue_adapter = ENV['RAILS_QUEUE_ADAPTER'].to_sym config.active_job.queue_adapter = ENV['RAILS_QUEUE_ADAPTER'].to_sym
end end
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end end

View file

@ -31,7 +31,7 @@ Rails.application.configure do
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
config.active_storage.service = :local config.active_storage.service = :test
# Randomize the order test cases are executed. # Randomize the order test cases are executed.
config.active_support.test_order = :random config.active_support.test_order = :random

View file

@ -1,4 +1,4 @@
ActiveStorage::Service.url_expires_in = 1.hour Rails.application.config.active_storage.service_urls_expire_in = 1.hour
# In Rails 5.2, we have to hook at `on_load` on the blob themeselves, which is # In Rails 5.2, we have to hook at `on_load` on the blob themeselves, which is
# not ideal. # not ideal.

View file

@ -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

View file

@ -1,3 +1,5 @@
# Be sure to restart your server when you modify this file. # 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 Rails.application.config.action_dispatch.cookies_serializer = :json

View file

@ -0,0 +1,45 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.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.
# Don't force requests from old versions of IE to be UTF-8 encoded.
# Rails.application.config.action_view.default_enforce_utf8 = false
# Embed purpose and expiry metadata inside signed and encrypted
# cookies for increased security.
#
# This option is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.0.
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
# Return false instead of self when enqueuing is aborted from a callback.
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
# Send Active Storage analysis and purge jobs to dedicated queues.
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
# Rails.application.config.active_storage.replace_on_assign_to_many = true
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
#
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.
# If you send mail in the background, job workers need to have a copy of
# MailDeliveryJob to ensure all delivery jobs are processed properly.
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
# Enable the same cache key to be reused when the object being cached of type
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
# of the relation's cache key into the cache version to support recycling cache key.
# Rails.application.config.active_record.collection_cache_versioning = true

6
config/spring.rb Normal file
View file

@ -0,0 +1,6 @@
Spring.watch(
".ruby-version",
".rbenv-vars",
"tmp/restart.txt",
"tmp/caching-dev.txt"
)

View file

@ -2,11 +2,11 @@
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your # This file is the source Rails uses to define your schema when running `rails
# database schema. If you need to create the application database on another # db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# system, you should be using db:schema:load, not running all the migrations # be faster and is potentially less error prone than running all of your
# from scratch. The latter is a flawed and unsustainable approach (the more migrations # migrations from scratch. Old migrations may fail to apply correctly if those
# you'll amass, the slower it'll run and the greater likelihood for issues). # migrations use external dependencies or application code.
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.

View file

@ -10,6 +10,7 @@ describe Admin::AttestationTemplatesController, type: :controller do
let(:signature2) { fixture_file_upload('spec/fixtures/files/black.png', 'image/png') } let(:signature2) { fixture_file_upload('spec/fixtures/files/black.png', 'image/png') }
let(:interlaced_logo) { fixture_file_upload('spec/fixtures/files/interlaced-black.png', 'image/png') } let(:interlaced_logo) { fixture_file_upload('spec/fixtures/files/interlaced-black.png', 'image/png') }
let(:uninterlaced_logo) { fixture_file_upload('spec/fixtures/files/uninterlaced-black.png', 'image/png') } let(:uninterlaced_logo) { fixture_file_upload('spec/fixtures/files/uninterlaced-black.png', 'image/png') }
let(:invalid_logo) { fixture_file_upload('spec/fixtures/files/invalid_file_format.json', 'application/json') }
before do before do
sign_in(admin.user) sign_in(admin.user)
@ -40,7 +41,20 @@ describe Admin::AttestationTemplatesController, type: :controller do
context 'with an interlaced png' do context 'with an interlaced png' do
let(:upload_params) { { logo: interlaced_logo } } let(:upload_params) { { logo: interlaced_logo } }
it { expect(procedure.attestation_template.logo.download).to eq(uninterlaced_logo.read) }
it 'displays the logo' do
expect(assigns(:attestation)[:logo].read).to eq(uninterlaced_logo.read)
end
it 'doesnt save the logo permanently yet' do
expect(procedure.attestation_template.logo.attached?).to be(false)
end
end
context 'with an invalid logo' do
let(:upload_params) { { logo: invalid_logo } }
it { expect(procedure.attestation_template.logo.attached?).to be false }
it { expect(flash.alert).to be_present }
end end
context 'if an attestation template does not exist on the procedure' do context 'if an attestation template does not exist on the procedure' do

View file

@ -167,7 +167,7 @@ describe Admin::ProceduresController, type: :controller do
context 'when admin is the owner of the procedure' do context 'when admin is the owner of the procedure' do
before do before do
put :publish, format: :js, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web } put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web }, format: 'js'
procedure.reload procedure.reload
procedure2.reload procedure2.reload
end end
@ -246,7 +246,7 @@ describe Admin::ProceduresController, type: :controller do
sign_out(admin.user) sign_out(admin.user)
sign_in(admin_2.user) sign_in(admin_2.user)
put :publish, params: { procedure_id: procedure.id, path: 'fake_path' } put :publish, params: { procedure_id: procedure.id, path: 'fake_path' }, format: 'js'
procedure.reload procedure.reload
end end
@ -257,7 +257,7 @@ describe Admin::ProceduresController, type: :controller do
context 'when the admin does not provide a lien_site_web' do context 'when the admin does not provide a lien_site_web' do
before do before do
put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web } put :publish, params: { procedure_id: procedure.id, path: path, lien_site_web: lien_site_web }, format: 'js'
procedure.reload procedure.reload
end end
context 'procedure path is valid but lien_site_web is missing' do context 'procedure path is valid but lien_site_web is missing' do
@ -411,7 +411,9 @@ describe Admin::ProceduresController, type: :controller do
describe 'POST #transfer' do describe 'POST #transfer' do
let!(:procedure) { create :procedure, :with_service, administrateur: admin } let!(:procedure) { create :procedure, :with_service, administrateur: admin }
subject { post :transfer, params: { email_admin: email_admin, procedure_id: procedure.id } } subject do
post :transfer, params: { email_admin: email_admin, procedure_id: procedure.id }, format: 'js'
end
context 'when admin is unknow' do context 'when admin is unknow' do
let(:email_admin) { 'plop' } let(:email_admin) { 'plop' }

View file

@ -19,7 +19,7 @@ describe ApplicationController, type: :controller do
let(:payload) { {} } let(:payload) { {} }
before do before do
allow(@controller).to receive(:content_type).and_return('') allow(@controller).to receive(:media_type).and_return('text/plain')
allow(@controller).to receive(:current_user).and_return(current_user) allow(@controller).to receive(:current_user).and_return(current_user)
expect(@controller).to receive(:current_instructeur).and_return(current_instructeur) expect(@controller).to receive(:current_instructeur).and_return(current_instructeur)
expect(@controller).to receive(:current_administrateur).and_return(current_administrateur) expect(@controller).to receive(:current_administrateur).and_return(current_administrateur)
@ -41,7 +41,7 @@ describe ApplicationController, type: :controller do
payload.delete(key) payload.delete(key)
end end
expect(payload).to eq({ expect(payload).to eq({
sk_rendered_format: nil, sk_rendered_format: :text,
sk_variant: [], sk_variant: [],
user_agent: 'Rails Testing', user_agent: 'Rails Testing',
user_roles: 'Guest' user_roles: 'Guest'
@ -62,7 +62,7 @@ describe ApplicationController, type: :controller do
payload.delete(key) payload.delete(key)
end end
expect(payload).to eq({ expect(payload).to eq({
sk_rendered_format: nil, sk_rendered_format: :text,
sk_variant: [], sk_variant: [],
user_agent: 'Rails Testing', user_agent: 'Rails Testing',
user_id: current_user.id, user_id: current_user.id,
@ -88,7 +88,7 @@ describe ApplicationController, type: :controller do
payload.delete(key) payload.delete(key)
end end
expect(payload).to eq({ expect(payload).to eq({
sk_rendered_format: nil, sk_rendered_format: :text,
sk_variant: [], sk_variant: [],
user_agent: 'Rails Testing', user_agent: 'Rails Testing',
user_id: current_user.id, user_id: current_user.id,

View file

@ -44,7 +44,7 @@ describe Champs::PieceJustificativeController, type: :controller do
# See https://github.com/betagouv/demarches-simplifiees.fr/issues/4926 # See https://github.com/betagouv/demarches-simplifiees.fr/issues/4926
before do before do
champ champ
expect_any_instance_of(Champs::PieceJustificativeChamp).to receive(:save).and_return(false) expect_any_instance_of(Champs::PieceJustificativeChamp).to receive(:save).twice.and_return(false)
expect_any_instance_of(Champs::PieceJustificativeChamp).to receive(:errors) expect_any_instance_of(Champs::PieceJustificativeChamp).to receive(:errors)
.and_return(double(full_messages: ['La pièce justificative nest pas dun type accepté'])) .and_return(double(full_messages: ['La pièce justificative nest pas dun type accepté']))
end end

View file

@ -20,7 +20,7 @@ describe Manager::AdministrateursController, type: :controller do
render_views render_views
it 'displays form to create a new admin' do it 'displays form to create a new admin' do
get :new get :new
expect(response).to be_success expect(response).to have_http_status(:success)
end end
end end
@ -64,7 +64,7 @@ describe Manager::AdministrateursController, type: :controller do
it 'searches admin by email' do it 'searches admin by email' do
get :index, params: { search: administrateur.email } get :index, params: { search: administrateur.email }
expect(response).to be_success expect(response).to have_http_status(:success)
end end
end end
end end

View file

@ -4,7 +4,7 @@ describe Manager::ApplicationController, type: :controller do
let(:payload) { {} } let(:payload) { {} }
before do before do
allow(@controller).to receive(:content_type).and_return('') allow(@controller).to receive(:media_type).and_return('text/plain')
allow(@controller).to receive(:current_user).and_return(current_user) allow(@controller).to receive(:current_user).and_return(current_user)
@controller.send(:append_info_to_payload, payload) @controller.send(:append_info_to_payload, payload)
end end
@ -14,7 +14,7 @@ describe Manager::ApplicationController, type: :controller do
payload.delete(key) payload.delete(key)
end end
expect(payload).to eq({ expect(payload).to eq({
sk_rendered_format: nil, sk_rendered_format: :text,
sk_variant: [], sk_variant: [],
user_agent: 'Rails Testing', user_agent: 'Rails Testing',
user_id: current_user.id, user_id: current_user.id,

View file

@ -541,10 +541,16 @@ describe Users::DossiersController, type: :controller do
{ {
id: dossier.id, id: dossier.id,
dossier: { dossier: {
champs_attributes: { champs_attributes: [
{
id: first_champ.id, id: first_champ.id,
value: value value: value
},
{
id: piece_justificative_champ.id,
piece_justificative_file: file
} }
]
} }
} }
end end
@ -561,7 +567,6 @@ describe Users::DossiersController, type: :controller do
it 'redirects to the dossiers list' do it 'redirects to the dossiers list' do
subject subject
expect(response).to redirect_to(dossiers_path) expect(response).to redirect_to(dossiers_path)
expect(flash.alert).to eq('Votre dossier ne peut plus être modifié') expect(flash.alert).to eq('Votre dossier ne peut plus être modifié')
end end
@ -570,13 +575,22 @@ describe Users::DossiersController, type: :controller do
context 'when dossier can be updated by the owner' do context 'when dossier can be updated by the owner' do
it 'updates the champs' do it 'updates the champs' do
subject subject
expect(response).to redirect_to(demande_dossier_path(dossier))
expect(first_champ.reload.value).to eq('beautiful value') expect(first_champ.reload.value).to eq('beautiful value')
expect(piece_justificative_champ.reload.piece_justificative_file).to be_attached
end
it 'updates the dossier modification date' do
subject
expect(dossier.reload.updated_at.year).to eq(2100) expect(dossier.reload.updated_at.year).to eq(2100)
end
it 'updates the dossier state' do
subject
expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction)) expect(dossier.reload.state).to eq(Dossier.states.fetch(:en_construction))
end end
it { is_expected.to redirect_to(demande_dossier_path(dossier)) }
context 'when only files champs are modified' do context 'when only files champs are modified' do
let(:submit_payload) do let(:submit_payload) do
{ {

View file

@ -10,4 +10,9 @@ FactoryBot.define do
logo { Rack::Test::UploadedFile.new('spec/fixtures/files/logo_test_procedure.png', 'image/png') } logo { Rack::Test::UploadedFile.new('spec/fixtures/files/logo_test_procedure.png', 'image/png') }
signature { Rack::Test::UploadedFile.new('spec/fixtures/files/logo_test_procedure.png', 'image/png') } signature { Rack::Test::UploadedFile.new('spec/fixtures/files/logo_test_procedure.png', 'image/png') }
end end
trait :with_gif_files do
logo { Rack::Test::UploadedFile.new('./spec/fixtures/files/french-flag.gif', 'image/gif') }
signature { Rack::Test::UploadedFile.new('./spec/fixtures/files/beta-gouv.gif', 'image/gif') }
end
end end

View file

@ -1,6 +1,10 @@
FactoryBot.define do FactoryBot.define do
factory :bill_signature do factory :bill_signature do
trait :with_serialized do
serialized { Rack::Test::UploadedFile.new('spec/fixtures/files/bill_signature/serialized.json', 'application/json') } serialized { Rack::Test::UploadedFile.new('spec/fixtures/files/bill_signature/serialized.json', 'application/json') }
end
trait :with_signature do
signature { Rack::Test::UploadedFile.new('spec/fixtures/files/bill_signature/signature.der', 'application/x-x509-ca-cert') } signature { Rack::Test::UploadedFile.new('spec/fixtures/files/bill_signature/signature.der', 'application/x-x509-ca-cert') }
end end
end
end end

View file

@ -41,7 +41,7 @@ describe AttestationTemplate, type: :model do
# end # end
describe 'validates footer length' do describe 'validates footer length' do
let(:attestation_template) { AttestationTemplate.new(footer: footer) } let(:attestation_template) { build(:attestation_template, footer: footer) }
subject do subject do
attestation_template.validate attestation_template.validate
@ -56,20 +56,11 @@ describe AttestationTemplate, type: :model do
end end
describe 'dup' do describe 'dup' do
before do let(:attestation_template) { create(:attestation_template, attributes) }
@logo = fixture_file_upload('spec/fixtures/files/white.png', 'image/png')
@signature = fixture_file_upload('spec/fixtures/files/black.png', 'image/png')
end
after do
subject.destroy
end
let(:attestation_template) { AttestationTemplate.create(attributes) }
subject { attestation_template.dup } subject { attestation_template.dup }
context 'with an attestation without images' do context 'with an attestation without images' do
let(:attributes) { { title: 't', body: 'b', footer: 'f', activated: true } } let(:attributes) { attributes_for(:attestation_template) }
it { is_expected.to have_attributes(attributes) } it { is_expected.to have_attributes(attributes) }
it { is_expected.to have_attributes(id: nil) } it { is_expected.to have_attributes(id: nil) }
@ -77,31 +68,24 @@ describe AttestationTemplate, type: :model do
end end
context 'with an attestation with images' do context 'with an attestation with images' do
let(:attributes) { { logo: @logo, signature: @signature } } let(:attestation_template) { create(:attestation_template, :with_files) }
it { expect(subject.logo.blob).not_to eq(attestation_template.logo.blob) } it do
it { expect(subject.logo.download).to eq(attestation_template.logo.download) } expect(subject.logo.blob).not_to eq(attestation_template.logo.blob)
expect(subject.logo.attached?).to be_truthy
end
it { expect(subject.signature.blob).not_to eq(attestation_template.signature.blob) } it do
it { expect(subject.signature.download).to eq(attestation_template.signature.download) } expect(subject.signature.blob).not_to eq(attestation_template.signature.blob)
expect(subject.signature.attached?).to be_truthy
end
end end
end end
describe 'invalidate attestation if images attachments are not valid' do describe 'invalidate attestation if images attachments are not valid' do
before do subject { build(:attestation_template, :with_gif_files) }
@logo = fixture_file_upload('spec/fixtures/files/french-flag.gif', 'image/gif')
@signature = fixture_file_upload('spec/fixtures/files/beta-gouv.gif', 'image/gif')
end
after do
subject.destroy
end
let(:attestation_template) { AttestationTemplate.create(attributes) }
subject { attestation_template.dup }
context 'with an attestation which has gif files' do context 'with an attestation which has gif files' do
let(:attributes) { { title: 't', body: 'b', footer: 'f', activated: true, logo: @logo, signature: @signature } }
it { is_expected.not_to be_valid } it { is_expected.not_to be_valid }
end end
end end
@ -122,7 +106,7 @@ describe AttestationTemplate, type: :model do
let(:template_title) { 'title' } let(:template_title) { 'title' }
let(:template_body) { 'body' } let(:template_body) { 'body' }
let(:attestation_template) do let(:attestation_template) do
AttestationTemplate.new(procedure: procedure, build(:attestation_template, procedure: procedure,
title: template_title, title: template_title,
body: template_body, body: template_body,
logo: @logo, logo: @logo,

View file

@ -1,6 +1,6 @@
RSpec.describe BillSignature, type: :model do RSpec.describe BillSignature, type: :model do
describe 'validations' do describe 'validations' do
subject(:bill_signature) { BillSignature.new } subject(:bill_signature) { build(:bill_signature) }
describe 'check_bill_digest' do describe 'check_bill_digest' do
before do before do
@ -119,14 +119,20 @@ RSpec.describe BillSignature, type: :model do
end end
describe '.build_with_operations' do describe '.build_with_operations' do
subject(:bill_signature) { described_class.build_with_operations(dossier_operation_logs, Date.new(1871, 03, 18)) } let(:day) { Date.new(1871, 03, 18) }
subject(:bill_signature) { build(:bill_signature, :with_signature) }
before do
bill_signature.dossier_operation_logs = dossier_operation_logs
bill_signature.serialize_operations(day)
end
context 'when there are no operations' do context 'when there are no operations' do
let(:dossier_operation_logs) { [] } let(:dossier_operation_logs) { [] }
it { expect(bill_signature.operations_bill).to eq({}) } it { expect(bill_signature.operations_bill).to eq({}) }
it { expect(bill_signature.digest).to eq(Digest::SHA256.hexdigest('{}')) } it { expect(bill_signature.digest).to eq(Digest::SHA256.hexdigest('{}')) }
it { expect(bill_signature.serialized.download).to eq('{}') } it { expect(bill_signature.read_serialized).to eq('{}') }
it { expect(bill_signature.serialized.filename).to eq('demarches-simplifiees-operations-1871-03-18.json') } it { expect(bill_signature.serialized.filename).to eq('demarches-simplifiees-operations-1871-03-18.json') }
end end
@ -137,7 +143,7 @@ RSpec.describe BillSignature, type: :model do
it { expect(bill_signature.operations_bill).to eq({ '1234' => 'abcd' }) } it { expect(bill_signature.operations_bill).to eq({ '1234' => 'abcd' }) }
it { expect(bill_signature.digest).to eq(Digest::SHA256.hexdigest('{"1234":"abcd"}')) } it { expect(bill_signature.digest).to eq(Digest::SHA256.hexdigest('{"1234":"abcd"}')) }
it { expect(bill_signature.serialized.download).to eq('{"1234":"abcd"}') } it { expect(bill_signature.read_serialized).to eq('{"1234":"abcd"}') }
it { expect(bill_signature.serialized.filename).to eq('demarches-simplifiees-operations-1871-03-18.json') } it { expect(bill_signature.serialized.filename).to eq('demarches-simplifiees-operations-1871-03-18.json') }
end end
@ -151,7 +157,7 @@ RSpec.describe BillSignature, type: :model do
it { expect(bill_signature.operations_bill).to eq({ '1234' => 'abcd', '5678' => 'dcba' }) } it { expect(bill_signature.operations_bill).to eq({ '1234' => 'abcd', '5678' => 'dcba' }) }
it { expect(bill_signature.digest).to eq(Digest::SHA256.hexdigest('{"1234":"abcd","5678":"dcba"}')) } it { expect(bill_signature.digest).to eq(Digest::SHA256.hexdigest('{"1234":"abcd","5678":"dcba"}')) }
it { expect(bill_signature.serialized.download).to eq('{"1234":"abcd","5678":"dcba"}') } it { expect(bill_signature.read_serialized).to eq('{"1234":"abcd","5678":"dcba"}') }
it { expect(bill_signature.serialized.filename).to eq('demarches-simplifiees-operations-1871-03-18.json') } it { expect(bill_signature.serialized.filename).to eq('demarches-simplifiees-operations-1871-03-18.json') }
end end
end end

View file

@ -380,18 +380,13 @@ describe Procedure do
let!(:assign_to_2) { create(:assign_to, procedure: procedure, groupe_instructeur: groupe_instructeur_1, instructeur: instructeur_2) } let!(:assign_to_2) { create(:assign_to, procedure: procedure, groupe_instructeur: groupe_instructeur_1, instructeur: instructeur_2) }
before do before do
@logo = File.open('spec/fixtures/files/white.png') @logo = Rack::Test::UploadedFile.new('spec/fixtures/files/white.png', 'image/png')
@signature = File.open('spec/fixtures/files/black.png') @signature = Rack::Test::UploadedFile.new('spec/fixtures/files/black.png', 'image/png')
@attestation_template = create(:attestation_template, procedure: procedure, logo: @logo, signature: @signature) @attestation_template = create(:attestation_template, procedure: procedure, logo: @logo, signature: @signature)
@procedure = procedure.clone(administrateur, from_library) @procedure = procedure.clone(administrateur, from_library)
@procedure.save @procedure.save
end end
after do
@logo.close
@signature.close
end
subject { @procedure } subject { @procedure }
it { expect(subject.parent_procedure).to eq(procedure) } it { expect(subject.parent_procedure).to eq(procedure) }

View file

@ -25,7 +25,7 @@ describe BillSignatureService do
context "when there are no operations to be signed" do context "when there are no operations to be signed" do
before do before do
create :dossier_operation_log, created_at: 1.day.ago, bill_signature: build(:bill_signature) create :dossier_operation_log, created_at: 1.day.ago, bill_signature: build(:bill_signature, :with_signature, :with_serialized)
create :dossier_operation_log, created_at: 1.day.from_now create :dossier_operation_log, created_at: 1.day.from_now
end end

View file

@ -16,7 +16,7 @@ describe 'shared/attachment/_update.html.haml', type: :view do
context 'when there is no attached file' do context 'when there is no attached file' do
before do before do
champ.piece_justificative_file.purge champ.piece_justificative_file = nil
end end
it 'renders a form field for uploading a file' do it 'renders a form field for uploading a file' do