From 75fb42c7a2a793a9c15e900bd407b329e32bb1f0 Mon Sep 17 00:00:00 2001 From: David Wessman Date: Sat, 9 Oct 2021 16:32:51 +0200 Subject: [PATCH 1/4] Prepare Gemfiles for dual-booting - This allows to try the next Rails version with existing dependencies. --- Gemfile | 16 +- Gemfile.lock | 65 +++-- Gemfile.next | 1 + Gemfile.next.lock | 587 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 632 insertions(+), 37 deletions(-) create mode 120000 Gemfile.next create mode 100644 Gemfile.next.lock diff --git a/Gemfile b/Gemfile index d57fc366f..67239087a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,19 @@ +def next? + File.basename(__FILE__) == "Gemfile.next" +end + source 'https://rubygems.org' # Do not forget to update in .ruby-version, Capfile and circle.yml ruby '2.5.0' -gem 'rails', '5.1.6.2' +if next? + gem 'rails', '~> 5.2' +else + gem 'rails', '5.1.6.2' +end +gem 'sprockets', '~> 3.7' gem 'active_model_serializers', '~> 0.10.0' gem 'bcrypt_pbkdf', '~> 1.1.0.rc1' gem 'bootstrap-sass' @@ -30,7 +39,7 @@ gem 'icalendar' gem 'jquery-rails' gem 'jquery-turbolinks' gem 'jquery-ui-rails' -gem 'kaminari' +gem 'kaminari', '~>1.1' gem 'meta-tags' gem 'mail', '>= 2.6.6.rc1' gem 'mini_magick' @@ -57,7 +66,7 @@ gem 'simple_form' gem 'sitemap_generator' gem 'turbolinks' gem 'uglifier' -gem 'wice_grid', git: 'https://github.com/navro/wice_grid', branch: 'rails51' +gem 'wice_grid', git: 'https://github.com/patricklindsay/wice_grid' # To have a working JVM on server group :staging, :production do @@ -65,7 +74,6 @@ group :staging, :production do end group :development, :test do - gem 'better_errors', git: 'https://github.com/charliesome/better_errors' # For rails 5 support gem 'capistrano', require: false # Need 1.1.3 to load sprockets manifest file gem 'capistrano-rails', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 893adcc2c..b4d618da3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,3 @@ -GIT - remote: https://github.com/charliesome/better_errors - revision: 946281d441523c9a009657a1c658f5134c17b482 - specs: - better_errors (2.4.0) - coderay (>= 1.0.0) - erubi (>= 1.0.0) - rack (>= 0.9.0) - GIT remote: https://github.com/globalize/globalize revision: 2ae107f750ed3448d9dda70e15676a61820ce53b @@ -25,14 +16,13 @@ GIT mime-types (~> 2.3) GIT - remote: https://github.com/navro/wice_grid - revision: bd833172557e41ac770c937142d772c4025157b8 - branch: rails51 + remote: https://github.com/patricklindsay/wice_grid + revision: 39e301c349bff5db271dec3222c5ca91d4bfcbd4 specs: - wice_grid (4.0.1) + wice_grid (4.1.0) coffee-rails (> 3.2) - kaminari (~> 0.16) - rails (~> 5.0, < 5.2) + kaminari (~> 1.1) + rails (~> 5.0, < 5.3) GIT remote: https://github.com/zpaulovics/datetimepicker-rails @@ -108,7 +98,7 @@ GEM bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) - builder (3.2.3) + builder (3.2.4) bullet (5.7.5) activesupport (>= 3.0.0) uniform_notifier (~> 1.11.0) @@ -156,11 +146,11 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.9) connection_pool (2.2.1) cookies_eu (1.7.1) js_cookie_rails (~> 2.2.0) - crass (1.0.5) + crass (1.0.6) css_parser (1.6.0) addressable database_cleaner (1.7.0) @@ -184,7 +174,7 @@ GEM railties (>= 3.2, < 6.0) ed25519 (1.2.4) ejs (1.1.1) - erubi (1.9.0) + erubi (1.10.0) et-orbi (1.1.0) tzinfo execjs (2.7.0) @@ -211,7 +201,7 @@ GEM http-2 (0.8.4) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (1.7.0) + i18n (1.8.10) concurrent-ruby (~> 1.0) icalendar (2.4.1) jquery-rails (4.3.3) @@ -227,15 +217,24 @@ GEM railties (>= 3.1) json (2.1.0) jsonapi-renderer (0.1.2) - kaminari (0.17.0) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) + kaminari (1.2.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.1) + kaminari-activerecord (= 1.2.1) + kaminari-core (= 1.2.1) + kaminari-actionview (1.2.1) + actionview + kaminari-core (= 1.2.1) + kaminari-activerecord (1.2.1) + activerecord + kaminari-core (= 1.2.1) + kaminari-core (1.2.1) libv8 (3.16.14.19) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.3.1) + loofah (2.12.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -249,8 +248,8 @@ GEM rake mini_magick (4.9.5) mini_mime (1.0.1) - mini_portile2 (2.5.1) - minitest (5.13.0) + mini_portile2 (2.6.1) + minitest (5.14.4) momentjs-rails (2.20.1) railties (>= 3.1) multi_json (1.13.1) @@ -263,8 +262,8 @@ GEM net-ssh (5.2.0) netrc (0.11.0) nio4r (2.3.1) - nokogiri (1.11.4) - mini_portile2 (~> 2.5.0) + nokogiri (1.12.5) + mini_portile2 (~> 2.6.1) racc (~> 1.4) onesky-rails (1.4.0) i18n (>= 0.5.0) @@ -308,7 +307,7 @@ GEM public_suffix (4.0.6) puma (3.11.4) racc (1.5.2) - rack (2.0.7) + rack (2.2.3) rack-protection (2.0.1) rack rack-test (1.1.0) @@ -332,7 +331,7 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) railties (5.1.6.2) actionpack (= 5.1.6.2) @@ -457,7 +456,7 @@ GEM turbolinks (5.1.1) turbolinks-source (~> 5.1) turbolinks-source (5.1.0) - tzinfo (1.2.5) + tzinfo (1.2.9) thread_safe (~> 0.1) uglifier (4.1.11) execjs (>= 0.3.0, < 3) @@ -485,7 +484,6 @@ DEPENDENCIES active_model_serializers (~> 0.10.0) activemodel-serializers-xml bcrypt_pbkdf (~> 1.1.0.rc1) - better_errors! bootstrap-datepicker-rails bootstrap-sass bullet @@ -517,7 +515,7 @@ DEPENDENCIES jquery-rails jquery-turbolinks jquery-ui-rails - kaminari + kaminari (~> 1.1) listen mail (>= 2.6.6.rc1) meta-tags @@ -554,6 +552,7 @@ DEPENDENCIES sidekiq-unique-jobs simple_form sitemap_generator + sprockets (~> 3.7) therubyracer turbolinks uglifier diff --git a/Gemfile.next b/Gemfile.next new file mode 120000 index 000000000..6ab79009c --- /dev/null +++ b/Gemfile.next @@ -0,0 +1 @@ +Gemfile \ No newline at end of file diff --git a/Gemfile.next.lock b/Gemfile.next.lock new file mode 100644 index 000000000..56c4dbbda --- /dev/null +++ b/Gemfile.next.lock @@ -0,0 +1,587 @@ +GIT + remote: https://github.com/globalize/globalize + revision: 76b808b13d15c2b7158c0f61ff000b05de47afe6 + specs: + globalize (6.0.1) + activemodel (>= 4.2, < 7.0) + activerecord (>= 4.2, < 7.0) + request_store (~> 1.0) + +GIT + remote: https://github.com/lardawge/carrierwave_backgrounder + revision: e1faa5e264d6a2ee0a58ade6b0d05d1147266b86 + specs: + carrierwave_backgrounder (0.4.2) + carrierwave (>= 0.5, < 2.2) + +GIT + remote: https://github.com/patricklindsay/wice_grid + revision: 39e301c349bff5db271dec3222c5ca91d4bfcbd4 + specs: + wice_grid (4.1.0) + coffee-rails (> 3.2) + kaminari (~> 1.1) + rails (~> 5.0, < 5.3) + +GIT + remote: https://github.com/zpaulovics/datetimepicker-rails + revision: 36d21cec5da7f5b214925804f60e63c61c747023 + branch: master + submodules: true + specs: + datetimepicker-rails (4.7.16) + momentjs-rails (>= 2.9.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.6) + actionpack (= 5.2.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.6) + actionview (= 5.2.6) + activesupport (= 5.2.6) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.6) + activesupport (= 5.2.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + active_model_serializers (0.10.12) + actionpack (>= 4.1, < 6.2) + activemodel (>= 4.1, < 6.2) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + activejob (5.2.6) + activesupport (= 5.2.6) + globalid (>= 0.3.6) + activemodel (5.2.6) + activesupport (= 5.2.6) + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) + builder (~> 3.1) + activerecord (5.2.6) + activemodel (= 5.2.6) + activesupport (= 5.2.6) + arel (>= 9.0) + activestorage (5.2.6) + actionpack (= 5.2.6) + activerecord (= 5.2.6) + marcel (~> 1.0.0) + activesupport (5.2.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) + sshkit (>= 1.6.1, != 1.7.0) + arel (9.0.0) + autoprefixer-rails (10.3.3.0) + execjs (~> 2) + bcrypt (3.1.16) + bcrypt_pbkdf (1.1.0) + bindex (0.8.1) + bootstrap-datepicker-rails (1.9.0.1) + railties (>= 3.0) + bootstrap-sass (3.4.1) + autoprefixer-rails (>= 5.2.1) + sassc (>= 2.0.0) + brpoplpush-redis_script (0.1.2) + concurrent-ruby (~> 1.0, >= 1.0.5) + redis (>= 1.0, <= 5.0) + builder (3.2.4) + bullet (6.1.5) + activesupport (>= 3.0.0) + uniform_notifier (~> 1.11) + byebug (11.1.3) + cancancan (3.3.0) + capistrano (3.16.0) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (2.0.1) + capistrano (~> 3.1) + capistrano-passenger (0.2.1) + capistrano (~> 3.0) + capistrano-rails (1.6.1) + capistrano (~> 3.1) + capistrano-bundler (>= 1.1, < 3) + capistrano-rbenv (2.2.0) + capistrano (~> 3.1) + sshkit (~> 1.3) + capybara (3.35.3) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + carrierwave (0.11.2) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + json (>= 1.7) + mime-types (>= 1.16) + mimemagic (>= 0.3.0) + case_transform (0.2) + activesupport + climate_control (0.2.0) + cliver (0.3.2) + codeclimate-test-reporter (1.0.9) + simplecov (<= 0.13) + coderay (1.1.3) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.9) + connection_pool (2.2.5) + cookies_eu (1.7.8) + js_cookie_rails (~> 2.2.0) + crass (1.0.6) + css_parser (1.10.0) + addressable + database_cleaner (2.0.1) + database_cleaner-active_record (~> 2.0.0) + database_cleaner-active_record (2.0.1) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + devise (4.7.3) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + devise_token_auth (1.1.5) + bcrypt (~> 3.0) + devise (> 3.5.2, < 5) + rails (>= 4.2.0, < 6.2) + diff-lcs (1.4.4) + docile (1.1.5) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) + ed25519 (1.2.4) + ejs (1.1.1) + erubi (1.10.0) + et-orbi (1.2.5) + tzinfo + execjs (2.8.1) + factory_bot (6.2.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) + railties (>= 5.0.0) + ffi (1.15.4) + font-awesome-sass (5.6.1) + sassc (>= 1.11) + foreman (0.87.2) + fotoramajs (4.6.4) + sprockets (>= 2) + fugit (1.5.2) + et-orbi (~> 1.1, >= 1.1.8) + raabro (~> 1.4) + fullcalendar-rails (3.9.0.0) + jquery-rails (>= 4.0.5, < 5.0.0) + jquery-ui-rails (>= 5.0.2) + momentjs-rails (>= 2.9.0) + globalid (0.5.2) + activesupport (>= 5.0) + globalize-accessors (0.3.0) + globalize (>= 5.0.0) + hkdf (0.3.0) + http-2 (0.11.0) + http-cookie (1.0.4) + domain_name (~> 0.5) + i18n (1.8.10) + concurrent-ruby (~> 1.0) + icalendar (2.7.1) + ice_cube (~> 0.16) + ice_cube (0.16.3) + jquery-rails (4.4.0) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + jquery-turbolinks (2.1.0) + railties (>= 3.1.0) + turbolinks + jquery-ui-rails (6.0.1) + railties (>= 3.2.16) + js_cookie_rails (2.2.0) + railties (>= 3.1) + json (2.5.1) + jsonapi-renderer (0.2.2) + jwt (2.3.0) + kaminari (1.2.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.1) + kaminari-activerecord (= 1.2.1) + kaminari-core (= 1.2.1) + kaminari-actionview (1.2.1) + actionview + kaminari-core (= 1.2.1) + kaminari-activerecord (1.2.1) + activerecord + kaminari-core (= 1.2.1) + kaminari-core (1.2.1) + libv8 (3.16.14.19) + listen (3.7.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.12.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.2) + meta-tags (2.16.0) + actionpack (>= 3.2.0, < 7.1) + method_source (1.0.0) + mime-types (2.99.3) + mimemagic (0.3.10) + nokogiri (~> 1) + rake + mini_magick (4.11.0) + mini_mime (1.1.1) + minitest (5.14.4) + momentjs-rails (2.20.1) + railties (>= 3.1) + multi_json (1.15.0) + net-http-persistent (4.0.1) + connection_pool (~> 2.2) + net-http2 (0.18.4) + http-2 (~> 0.11) + 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.8) + nokogiri (1.12.5-x86_64-darwin) + racc (~> 1.4) + onesky-rails (1.4.0) + i18n (>= 0.5.0) + onesky-ruby (~> 1.0.0) + onesky-ruby (1.0.1) + rest-client (~> 1.8) + orm_adapter (0.5.0) + pagedown-bootstrap-rails (2.1.4) + railties (> 3.1) + paperclip (6.1.0) + activemodel (>= 4.2.0) + activesupport (>= 4.2.0) + mime-types + mimemagic (~> 0.3.0) + terrapin (~> 0.6.0) + paranoia (2.4.3) + activerecord (>= 4.0, < 6.2) + pdf-core (0.9.0) + pg (1.2.3) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) + cliver (~> 0.3.1) + websocket-driver (>= 0.2.0) + prawn (2.4.0) + pdf-core (~> 0.9.0) + ttfunk (~> 1.7) + prawn-rails (1.4.2) + actionview (>= 3.1.0) + prawn + prawn-table + prawn-table (0.2.2) + prawn (>= 1.3.0, < 3.0.0) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) + pry-rails (0.3.9) + pry (>= 0.10.4) + public_suffix (4.0.6) + puma (5.5.0) + nio4r (~> 2.0) + 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 (5.2.6) + actioncable (= 5.2.6) + actionmailer (= 5.2.6) + actionpack (= 5.2.6) + actionview (= 5.2.6) + activejob (= 5.2.6) + activemodel (= 5.2.6) + activerecord (= 5.2.6) + activestorage (= 5.2.6) + activesupport (= 5.2.6) + bundler (>= 1.3.0) + railties (= 5.2.6) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.4.2) + loofah (~> 2.3) + railties (5.2.6) + actionpack (= 5.2.6) + activesupport (= 5.2.6) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rainbow (3.0.0) + rake (13.0.6) + rb-fsevent (0.11.0) + rb-inotify (0.10.1) + ffi (~> 1.0) + recaptcha (5.8.1) + json + redcarpet (3.5.1) + redis (3.3.5) + ref (2.0.0) + regexp_parser (2.1.1) + request_store (1.5.0) + rack (>= 1.4) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rest-client (1.8.0) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) + roadie (3.5.1) + css_parser (~> 1.4) + nokogiri (~> 1.8) + roadie-rails (1.3.0) + railties (>= 3.0, < 5.3) + roadie (~> 3.1) + rollbar (3.2.0) + routing-filter (0.6.3) + actionpack (>= 4.2) + activesupport (>= 4.2) + rpush (6.0.1) + activesupport (>= 5.2) + jwt (>= 1.5.6) + multi_json (~> 1.0) + net-http-persistent + net-http2 (~> 0.18, >= 0.18.3) + railties + rainbow + thor (>= 0.18.1, < 2.0) + webpush (~> 1.0) + rspec-core (3.10.1) + rspec-support (~> 3.10.0) + rspec-example_steps (3.1.1) + rspec-core (>= 3.0.0) + rspec-expectations (3.10.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-rails (5.0.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.10.2) + rspec_junit_formatter (0.4.1) + rspec-core (>= 2, < 4, != 2.12.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 + select2-rails (4.0.13) + shoulda-matchers (4.5.1) + activesupport (>= 4.2.0) + sidekiq (5.2.9) + connection_pool (~> 2.2, >= 2.2.2) + rack (~> 2.0) + rack-protection (>= 1.5.0) + redis (>= 3.3.5, < 4.2) + sidekiq-cron (1.2.0) + fugit (~> 1.1) + sidekiq (>= 4.2.1) + sidekiq-unique-jobs (7.1.8) + brpoplpush-redis_script (> 0.1.1, <= 2.0.0) + concurrent-ruby (~> 1.0, >= 1.0.5) + sidekiq (>= 5.0, < 8.0) + thor (>= 0.20, < 3.0) + simple_form (5.1.0) + actionpack (>= 5.2) + activemodel (>= 5.2) + simplecov (0.13.0) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + sitemap_generator (6.1.2) + builder (~> 3.0) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.2) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sshkit (1.21.2) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) + terrapin (0.6.0) + climate_control (>= 0.0.3, < 1.0) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) + ref + thor (1.1.0) + thread_safe (0.3.6) + tilt (2.0.10) + ttfunk (1.7.0) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + tzinfo (1.2.9) + thread_safe (~> 0.1) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) + unf (0.1.4) + unf_ext + unf_ext (0.0.8) + uniform_notifier (1.14.2) + warden (1.2.9) + rack (>= 2.0.9) + web-console (3.7.0) + actionview (>= 5.0) + activemodel (>= 5.0) + bindex (>= 0.4.0) + railties (>= 5.0) + webpush (1.1.0) + hkdf (~> 0.2) + jwt (~> 2.0) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + +PLATFORMS + x86_64-darwin-19 + +DEPENDENCIES + active_model_serializers (~> 0.10.0) + activemodel-serializers-xml + bcrypt_pbkdf (~> 1.1.0.rc1) + bootstrap-datepicker-rails + bootstrap-sass + bullet + cancancan + capistrano + capistrano-passenger + capistrano-rails + capistrano-rbenv + capybara + carrierwave (~> 0.11.2) + carrierwave_backgrounder! + codeclimate-test-reporter + cookies_eu + database_cleaner + datetimepicker-rails! + devise (~> 4.7.1) + devise_token_auth (~> 1.1.3) + dotenv-rails + ed25519 (~> 1.2, >= 1.2.4) + ejs + factory_bot_rails + font-awesome-sass (~> 5.6.1) + foreman + fotoramajs + fullcalendar-rails + globalize! + globalize-accessors + icalendar + jquery-rails + jquery-turbolinks + jquery-ui-rails + kaminari + listen + mail (>= 2.6.6.rc1) + meta-tags + mini_magick + momentjs-rails + nokogiri (>= 1.7) + onesky-rails + pagedown-bootstrap-rails + paperclip (>= 5.2.0) + paranoia + pg + poltergeist + prawn-rails + pry-byebug + pry-rails + puma + rails (~> 5.2) + rails-controller-testing + recaptcha + redcarpet + redis (< 4) + roadie-rails (~> 1.3) + rollbar + routing-filter (~> 0.6.2) + rpush + rspec-example_steps + rspec-rails + rspec_junit_formatter + sassc-rails + select2-rails + shoulda-matchers + sidekiq + sidekiq-cron + sidekiq-unique-jobs + simple_form + sitemap_generator + sprockets (~> 3.7) + therubyracer + turbolinks + uglifier + web-console + wice_grid! + +RUBY VERSION + ruby 2.5.0p0 + +BUNDLED WITH + 2.2.29 From 2819989012496f2e6014dcf27731b974e7ce6aa8 Mon Sep 17 00:00:00 2001 From: David Wessman Date: Sat, 9 Oct 2021 16:38:34 +0200 Subject: [PATCH 2/4] Update syntax in factories --- .../admin/tool_rentings_controller_spec.rb | 14 +++++++---- spec/factories/albums.rb | 3 +-- spec/factories/cafe_shifts.rb | 19 +++++++-------- spec/factories/cafe_workers.rb | 2 +- spec/factories/candidates.rb | 2 +- spec/factories/constants.rb | 1 - spec/factories/contact_messages.rb | 5 ++-- spec/factories/contacts.rb | 3 +-- spec/factories/councils.rb | 3 +-- spec/factories/documents.rb | 3 +-- spec/factories/elections.rb | 8 +++---- spec/factories/event_signups.rb | 12 +++++----- spec/factories/event_users.rb | 2 +- spec/factories/faq.rb | 1 - spec/factories/group_users.rb | 2 +- spec/factories/images.rb | 3 +-- spec/factories/introductions.rb | 2 +- spec/factories/mail_aliases.rb | 7 +++--- spec/factories/main_menu.rb | 2 +- spec/factories/menus.rb | 6 ++--- spec/factories/news.rb | 3 +-- spec/factories/notifications.rb | 4 ++-- spec/factories/page_elements.rb | 13 +++++----- spec/factories/page_images.rb | 2 +- spec/factories/pages.rb | 6 ++--- spec/factories/permissions.rb | 8 +++---- spec/factories/posts.rb | 17 +++++++------ spec/factories/rents.rb | 14 +++++------ spec/factories/shared.rb | 2 +- spec/factories/short_links.rb | 5 ++-- spec/factories/tool_rentings.rb | 6 ++--- spec/factories/tools.rb | 4 ++-- spec/factories/users.rb | 24 +++++++++---------- spec/factories/work_posts.rb | 11 ++++----- spec/models/tool_renting_spec.rb | 18 +++----------- 35 files changed, 107 insertions(+), 130 deletions(-) diff --git a/spec/controllers/admin/tool_rentings_controller_spec.rb b/spec/controllers/admin/tool_rentings_controller_spec.rb index 566b9771a..9ccc6a6ca 100644 --- a/spec/controllers/admin/tool_rentings_controller_spec.rb +++ b/spec/controllers/admin/tool_rentings_controller_spec.rb @@ -12,7 +12,12 @@ describe 'POST #create' do it 'valid parameters' do tool = create(:tool) - attributes = attributes_for(:tool_renting, tool: tool) + user = create(:user) + attributes = { + user_id: user.id, + purpose: "To build a house", + return_date: 10.days.from_now + } lambda do post :create, params: { tool_id: tool, tool_renting: attributes } @@ -56,13 +61,14 @@ describe 'PATCH #update' do it 'valid parameters' do tool = create(:tool) - rent = create(:tool_renting, tool: tool, user_id: 1) - attributes = { user_id: 2 } + rent = create(:tool_renting, tool: tool) + new_user = create(:user) + attributes = { user_id: new_user.id } patch :update, params: { tool_id: tool, id: rent, tool_renting: attributes } rent.reload - rent.user_id.should eq(2) + rent.user.should eq(new_user) response.should redirect_to(admin_tool_path(tool)) end diff --git a/spec/factories/albums.rb b/spec/factories/albums.rb index b9dcfe4da..e27de5d23 100644 --- a/spec/factories/albums.rb +++ b/spec/factories/albums.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 FactoryBot.define do factory :album do title @@ -8,7 +7,7 @@ factory :album_with_images do transient do - image_count 2 + image_count { 2 } end after(:create) do |album, evaluator| diff --git a/spec/factories/cafe_shifts.rb b/spec/factories/cafe_shifts.rb index 66ac36323..15fbc96e4 100644 --- a/spec/factories/cafe_shifts.rb +++ b/spec/factories/cafe_shifts.rb @@ -1,21 +1,20 @@ -# encoding: UTF-8 FactoryBot.define do factory :cafe_shift do - pass 1 - lv 1 - lp 2 + pass { 1 } + lv { 1 } + lp { 2 } start { generate(:date) } trait :tester do - pass 1 - lv 7 - lp 4 + pass { 1 } + lv { 7 } + lp { 4 } end trait :invalid do - pass -5 - lv 1337 - lp 6122 + pass { -5 } + lv { 1337 } + lp { 6122 } end trait :with_worker do diff --git a/spec/factories/cafe_workers.rb b/spec/factories/cafe_workers.rb index f57617ca1..8ea3b62ea 100644 --- a/spec/factories/cafe_workers.rb +++ b/spec/factories/cafe_workers.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :cafe_worker do cafe_shift - competition true + competition { true } user end end diff --git a/spec/factories/candidates.rb b/spec/factories/candidates.rb index 1d0f37abc..9cd3a69b5 100644 --- a/spec/factories/candidates.rb +++ b/spec/factories/candidates.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :candidate do |c| + factory :candidate do |_c| association :election, semester: Post::AUTUMN association :post, semester: Post::AUTUMN user diff --git a/spec/factories/constants.rb b/spec/factories/constants.rb index 9eebe7d9d..d85a8c512 100644 --- a/spec/factories/constants.rb +++ b/spec/factories/constants.rb @@ -1,4 +1,3 @@ -#encoding: UTF-8 FactoryBot.define do factory :constant do name diff --git a/spec/factories/contact_messages.rb b/spec/factories/contact_messages.rb index 16d4cb2d3..2734578cf 100644 --- a/spec/factories/contact_messages.rb +++ b/spec/factories/contact_messages.rb @@ -1,9 +1,8 @@ -# encoding: UTF-8 FactoryBot.define do factory :contact_message do skip_create - name 'Hilbert Älg' - email 'utomifran@gmail.se' + name { 'Hilbert Älg' } + email { 'utomifran@gmail.se' } message { generate(:description) } end end diff --git a/spec/factories/contacts.rb b/spec/factories/contacts.rb index 45d6dcd4b..a81af4ae6 100644 --- a/spec/factories/contacts.rb +++ b/spec/factories/contacts.rb @@ -1,7 +1,6 @@ -# encoding: UTF-8 FactoryBot.define do factory :contact do |c| - name 'Spindelmän' + name { 'Spindelmän' } email c.public { [true, false].sample } text { generate(:description) } diff --git a/spec/factories/councils.rb b/spec/factories/councils.rb index a8528e66e..1710ecbe8 100644 --- a/spec/factories/councils.rb +++ b/spec/factories/councils.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 FactoryBot.define do factory :council do title @@ -12,7 +11,7 @@ trait :with_posts do transient do - post_count 3 + post_count { 3 } end after(:create) do |council, evaluator| diff --git a/spec/factories/documents.rb b/spec/factories/documents.rb index 09688cfb3..9f337eeb6 100644 --- a/spec/factories/documents.rb +++ b/spec/factories/documents.rb @@ -1,8 +1,7 @@ -# encoding: UTF-8 FactoryBot.define do factory :document do title - pdf Rack::Test::UploadedFile.new(File.open('spec/assets/pdf.pdf')) + pdf { Rack::Test::UploadedFile.new(File.open('spec/assets/pdf.pdf')) } category { ['Styrdokument', 'Protokoll', 'Von Tänen'].sample } end end diff --git a/spec/factories/elections.rb b/spec/factories/elections.rb index c4bf8c125..293e3bfc4 100644 --- a/spec/factories/elections.rb +++ b/spec/factories/elections.rb @@ -5,7 +5,7 @@ open { 2.days.ago } close_general { 5.days.from_now } close_all { 7.days.from_now } - visible true + visible { true } description candidate_mail_star { generate(:email) } mail_link { generate(:email) } @@ -37,15 +37,15 @@ end trait :autumn do - semester Post::AUTUMN + semester { Post::AUTUMN } end trait :spring do - semester Post::SPRING + semester {Post::SPRING} end trait :other do - semester Post::OTHER + semester {Post::OTHER} end end end diff --git a/spec/factories/event_signups.rb b/spec/factories/event_signups.rb index c4879f273..5205de7f1 100644 --- a/spec/factories/event_signups.rb +++ b/spec/factories/event_signups.rb @@ -1,13 +1,13 @@ FactoryBot.define do factory :event_signup do event - slots 5 + slots { 5 } opens { Time.zone.now } closes { opens + 1.day } - custom_name 'Dryga gamla fös' - custom 37 - novice 30 - mentor 20 - member 10 + custom_name { 'Dryga gamla fös' } + custom { 37 } + novice { 30 } + mentor { 20 } + member { 10 } end end diff --git a/spec/factories/event_users.rb b/spec/factories/event_users.rb index 28c3558d1..c340123e9 100644 --- a/spec/factories/event_users.rb +++ b/spec/factories/event_users.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :event_user do user - user_type EventSignup::MEMBER + user_type { EventSignup::MEMBER } association(:event, :with_signup) end end diff --git a/spec/factories/faq.rb b/spec/factories/faq.rb index 8cb94f1fb..6f08814d8 100644 --- a/spec/factories/faq.rb +++ b/spec/factories/faq.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 FactoryBot.define do factory :faq do question { generate(:description) } diff --git a/spec/factories/group_users.rb b/spec/factories/group_users.rb index 278d043f7..52002a46d 100644 --- a/spec/factories/group_users.rb +++ b/spec/factories/group_users.rb @@ -2,6 +2,6 @@ factory :group_user do user group - fadder false + fadder { false } end end diff --git a/spec/factories/images.rb b/spec/factories/images.rb index 55fe9f879..9fdd36d97 100644 --- a/spec/factories/images.rb +++ b/spec/factories/images.rb @@ -1,9 +1,8 @@ -# encoding: UTF-8 FactoryBot.define do factory :image do album photographer { FactoryBot.create(:user) } - file Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) + file { Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) } filename { generate(:firstname) } end end diff --git a/spec/factories/introductions.rb b/spec/factories/introductions.rb index caef3a499..bab2a4fef 100644 --- a/spec/factories/introductions.rb +++ b/spec/factories/introductions.rb @@ -6,6 +6,6 @@ start { 2.days.from_now } stop { 26.days.from_now } slug { generate(:url) } - current false + current { false } end end diff --git a/spec/factories/mail_aliases.rb b/spec/factories/mail_aliases.rb index 87b29b807..74c2e4aa4 100644 --- a/spec/factories/mail_aliases.rb +++ b/spec/factories/mail_aliases.rb @@ -1,8 +1,7 @@ FactoryBot.define do factory :mail_alias do - username 'mr_boss' - domain 'fsektionen.se' - target 'johan@forberg.se' + username { 'mr_boss' } + domain { 'fsektionen.se' } + target { 'johan@forberg.se' } end end - diff --git a/spec/factories/main_menu.rb b/spec/factories/main_menu.rb index 99e090812..c0a410974 100644 --- a/spec/factories/main_menu.rb +++ b/spec/factories/main_menu.rb @@ -2,6 +2,6 @@ factory :main_menu do name index { rand(10..100) } - mega false + mega { false } end end diff --git a/spec/factories/menus.rb b/spec/factories/menus.rb index b5e9e478f..4ce7b96a2 100644 --- a/spec/factories/menus.rb +++ b/spec/factories/menus.rb @@ -4,8 +4,8 @@ main_menu index { rand(10..100) } link { generate(:url) } - visible true - turbolinks true - blank_p false + visible { true } + turbolinks { true } + blank_p { false } end end diff --git a/spec/factories/news.rb b/spec/factories/news.rb index c18f32249..553a725b6 100644 --- a/spec/factories/news.rb +++ b/spec/factories/news.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 FactoryBot.define do factory :news do title @@ -6,7 +5,7 @@ user trait :with_image do - image Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) + image { Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) } end end end diff --git a/spec/factories/notifications.rb b/spec/factories/notifications.rb index 0468590e8..e7dec9fcf 100644 --- a/spec/factories/notifications.rb +++ b/spec/factories/notifications.rb @@ -1,8 +1,8 @@ FactoryBot.define do factory :notification do user - seen false - mode Notification::ALLOWED['EventUser'].keys.first + seen { false } + mode { Notification::ALLOWED['EventUser'].keys.first } # To be able to use the same user for an event_user this hack is used. # Callable as build(:notification, :build) diff --git a/spec/factories/page_elements.rb b/spec/factories/page_elements.rb index fc99b2fc3..60f6e89ab 100644 --- a/spec/factories/page_elements.rb +++ b/spec/factories/page_elements.rb @@ -1,22 +1,21 @@ -# encoding: UTF-8 FactoryBot.define do factory :page_element do page index { rand(1..10) } - sidebar false - visible true + sidebar { false } + visible { true } text_sv { generate(:description) } text_en { "English: #{text_sv}" } trait :image do - element_type PageElement::IMAGE + element_type { PageElement::IMAGE } page_image { create(:page_image, page: page) } - text_sv nil - text_en nil + text_sv { nil } + text_en { nil } end trait :text do - element_type PageElement::TEXT + element_type { PageElement::TEXT } text_sv { generate(:description) } text_en { "English: #{text_sv}" } end diff --git a/spec/factories/page_images.rb b/spec/factories/page_images.rb index ff3d7c470..638ec6387 100644 --- a/spec/factories/page_images.rb +++ b/spec/factories/page_images.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :page_image do page - image Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) + image { Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) } end end diff --git a/spec/factories/pages.rb b/spec/factories/pages.rb index 2b6613efc..66ae50ad3 100644 --- a/spec/factories/pages.rb +++ b/spec/factories/pages.rb @@ -1,15 +1,15 @@ -# encoding: UTF-8 FactoryBot.define do factory :page do url visible { true } title_sv { generate(:title) } title_en { "English #{title_sv}" } - public true + + public { true } factory :page_with_elements do transient do - element_count 3 + element_count { 3 } end after(:create) do |page, evaluator| diff --git a/spec/factories/permissions.rb b/spec/factories/permissions.rb index 8db4a8ed6..42dbaeb93 100644 --- a/spec/factories/permissions.rb +++ b/spec/factories/permissions.rb @@ -1,10 +1,10 @@ FactoryBot.define do factory :permission do - subject_class { ['News', 'CafeWork', 'Post', 'Rent', 'Event'].sample } - action { ['read', 'create', 'update', 'manage', 'new'].sample } + subject_class { %w[News CafeWork Post Rent Event].sample } + action { %w[read create update manage new].sample } end factory :admin_permission, class: 'Permission' do - subject_class :all - action :manage + subject_class { :all } + action { :manage } end end diff --git a/spec/factories/posts.rb b/spec/factories/posts.rb index 78ba6eafa..ab30de851 100644 --- a/spec/factories/posts.rb +++ b/spec/factories/posts.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 FactoryBot.define do factory :post do title @@ -10,11 +9,11 @@ rec_limit { rand(3..7) } trait :board_member do - board true + board { true } end trait :allowed_rental do - car_rent true + car_rent { true } end trait :with_admin_permissions do @@ -24,27 +23,27 @@ end trait :autumn do - semester Post::AUTUMN + semester { Post::AUTUMN } end trait :spring do - semester Post::SPRING + semester { Post::SPRING } end trait :both do - semester Post::BOTH + semester { Post::BOTH } end trait :general do - elected_by Post::GENERAL + elected_by { Post::GENERAL } end trait :board do - elected_by Post::BOARD + elected_by { Post::BOARD } end trait :education do - elected_by Post::EDUCATION + elected_by { Post::EDUCATION } end end end diff --git a/spec/factories/rents.rb b/spec/factories/rents.rb index 4e66bc3b8..021fb650e 100644 --- a/spec/factories/rents.rb +++ b/spec/factories/rents.rb @@ -1,14 +1,12 @@ -# encoding: UTF-8 FactoryBot.define do - factory :rent do user - purpose 'Handla möbler på IKEA' + purpose { 'Handla möbler på IKEA' } d_from { Time.zone.now + 10.days } d_til { Time.zone.now + 10.days + 12.hours } - aktiv true - status :confirmed - terms '1' + aktiv { true } + status { :confirmed } + terms { '1' } # Override after_create callbacks. after(:build) do |rent| @@ -35,10 +33,10 @@ end trait :purpose do - purpose 'Handla möbler på IKEA' + purpose { 'Handla möbler på IKEA' } end trait :comment do - comment 'Du har uppebarligen inget körkort' + comment { 'Du har uppebarligen inget körkort' } end end diff --git a/spec/factories/shared.rb b/spec/factories/shared.rb index 1b05bf6af..1c3642fee 100644 --- a/spec/factories/shared.rb +++ b/spec/factories/shared.rb @@ -10,7 +10,7 @@ sequence(:url) { |n| "url#{n}" } sequence(:username) { |n| "davidwessman#{n}" } sequence(:value) { |n| "david#{n}" } - sequence(:location) { ['MH:A','Hilbert','Kårhuset','Ön-ön','Sjönsjön','Bastun'].sample } + sequence(:location) { ['MH:A', 'Hilbert', 'Kårhuset', 'Ön-ön', 'Sjönsjön', 'Bastun'].sample } sequence(:date) { |n| Time.zone.now + 10.days + n.days } trait :with_user do diff --git a/spec/factories/short_links.rb b/spec/factories/short_links.rb index bc3d780c7..83ad71517 100644 --- a/spec/factories/short_links.rb +++ b/spec/factories/short_links.rb @@ -1,7 +1,6 @@ FactoryBot.define do factory :short_link do - link 'my_awesomeshort-link0' - target 'http://randomwebpage.com:80/some/resource/yeah?q=asdf&yeah=' + link { 'my_awesomeshort-link0' } + target { 'http://randomwebpage.com:80/some/resource/yeah?q=asdf&yeah=' } end end - diff --git a/spec/factories/tool_rentings.rb b/spec/factories/tool_rentings.rb index ed97cffdf..d9c49ae78 100644 --- a/spec/factories/tool_rentings.rb +++ b/spec/factories/tool_rentings.rb @@ -1,9 +1,9 @@ FactoryBot.define do factory :tool_renting do - user_id 1 - purpose 'to use' + user + purpose { 'to use' } tool return_date { Time.zone.now + 10.days } - returned false + returned { false } end end diff --git a/spec/factories/tools.rb b/spec/factories/tools.rb index 4901a02a2..8edfc36a5 100644 --- a/spec/factories/tools.rb +++ b/spec/factories/tools.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :tool do - title 'Awesome Tool' + title { 'Awesome Tool' } description - total 3 + total { 3 } end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index fb94b2c13..95e0d4a96 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,32 +1,32 @@ FactoryBot.define do factory :user do email - password '12345678' - password_confirmation '12345678' + password { '12345678' } + password_confirmation { '12345678' } firstname lastname phone student_id - start_year Time.now.year + start_year { Time.now.year } confirmed_at { 10.days.ago } member_at { 10.days.ago } - terms_version 1 + terms_version { 1 } trait :admin do - password '12345678' + password { '12345678' } with_admin_post end end factory :admin, class: 'User' do email - password '12345678' - password_confirmation '12345678' + password { '12345678' } + password_confirmation { '12345678' } firstname lastname phone student_id - start_year Time.now.year + start_year { Time.now.year } confirmed_at { Time.zone.now } member_at { Time.zone.now } with_admin_post @@ -39,17 +39,17 @@ end trait :unconfirmed do - confirmed_at nil - confirmation_token 'confirmmyaccount' + confirmed_at { nil } + confirmation_token { 'confirmmyaccount' } confirmation_sent_at { Time.zone.now } end trait :reset_password do - reset_password_token 'resetmypassword' + reset_password_token { 'resetmypassword' } reset_password_sent_at { Time.zone.now } end trait :not_member do - member_at nil + member_at { nil } end end diff --git a/spec/factories/work_posts.rb b/spec/factories/work_posts.rb index 90f81110d..42bf2f936 100644 --- a/spec/factories/work_posts.rb +++ b/spec/factories/work_posts.rb @@ -1,18 +1,17 @@ -# encoding: UTF-8 FactoryBot.define do factory :work_post do title description - kind { ['Sommarjobb', 'Examensarbete', 'Deltid'].sample } - company { ['IKEA', 'Axis', 'Sony', 'Flatfrog'].sample } + kind { %w[Sommarjobb Examensarbete Deltid].sample } + company { %w[IKEA Axis Sony Flatfrog].sample } target_group { ['Teknisk matematik', 'Teknisk fysik', 'Teknisk nanovetenskap'].sample } - field { ['Fysik', 'IT', 'Ekonomi'].sample } + field { %w[Fysik IT Ekonomi].sample } deadline { Time.zone.now + 10.days } - visible true + visible { true } publish { Time.zone.now - 1.days } trait :image do - image Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) + image { Rack::Test::UploadedFile.new(File.open('spec/assets/image.jpg')) } end end end diff --git a/spec/models/tool_renting_spec.rb b/spec/models/tool_renting_spec.rb index 1722c3742..5a08644ad 100644 --- a/spec/models/tool_renting_spec.rb +++ b/spec/models/tool_renting_spec.rb @@ -2,30 +2,18 @@ RSpec.describe ToolRenting, type: :model do describe :Validations do - it 'check presence user_id' do - ToolRenting.new.should validate_presence_of(:user_id) - end - - it 'check presence tool' do - ToolRenting.new.should validate_presence_of(:tool) - end - - it 'check presence return_date' do - ToolRenting.new.should validate_presence_of(:return_date) - end - context 'free tools' do it 'valid with free tool' do tool = create(:tool, total: 1) - rent = create(:tool_renting, user_id: 1, tool_id: tool.id) + rent = create(:tool_renting, tool_id: tool.id) - rent.user_id = 2 + rent.user = create(:user) rent.valid?.should eq(true) end it 'invalid without free tool' do tool = create(:tool, total: 1) - create(:tool_renting, user_id: 1, tool_id: tool.id) + create(:tool_renting, tool_id: tool.id) tool.reload tool.free.should eq(0) From 3d645741178c7fad99a9bec3a5522df2c477c80f Mon Sep 17 00:00:00 2001 From: David Wessman Date: Sat, 9 Oct 2021 16:39:16 +0200 Subject: [PATCH 3/4] Remove local from wice_grid_ --- app/controllers/admin/adventure_missions_controller.rb | 2 +- app/controllers/admin/adventures_controller.rb | 2 +- app/controllers/admin/blog_posts_controller.rb | 1 - app/controllers/admin/contacts_controller.rb | 2 +- app/controllers/admin/councils_controller.rb | 2 +- app/controllers/admin/events_controller.rb | 1 - app/controllers/admin/introductions_controller.rb | 2 +- app/controllers/admin/main_menus_controller.rb | 2 +- app/controllers/admin/menus_controller.rb | 1 - app/controllers/admin/news_controller.rb | 1 - app/controllers/admin/posts_controller.rb | 4 ++-- app/controllers/adventures_controller.rb | 2 +- app/controllers/elections_controller.rb | 2 -- 13 files changed, 9 insertions(+), 15 deletions(-) diff --git a/app/controllers/admin/adventure_missions_controller.rb b/app/controllers/admin/adventure_missions_controller.rb index 4bc6556e2..8b48aef09 100644 --- a/app/controllers/admin/adventure_missions_controller.rb +++ b/app/controllers/admin/adventure_missions_controller.rb @@ -4,7 +4,7 @@ class Admin::AdventureMissionsController < Admin::BaseController load_and_authorize_resource :adventure_mission, through: :adventure def index - @grid = initialize_grid(@adventure_missions, locale: :sv, order: 'adventure_missions.index') + @grid = initialize_grid(@adventure_missions, order: 'adventure_missions.index') end def new diff --git a/app/controllers/admin/adventures_controller.rb b/app/controllers/admin/adventures_controller.rb index 56a918653..28e6da4b0 100644 --- a/app/controllers/admin/adventures_controller.rb +++ b/app/controllers/admin/adventures_controller.rb @@ -3,7 +3,7 @@ class Admin::AdventuresController < Admin::BaseController def index set_adventures - @grid = initialize_grid(@adventures, order: :start_date, locale: :sv) + @grid = initialize_grid(@adventures, order: :start_date) end def new diff --git a/app/controllers/admin/blog_posts_controller.rb b/app/controllers/admin/blog_posts_controller.rb index f6c4de317..a656bf6d0 100644 --- a/app/controllers/admin/blog_posts_controller.rb +++ b/app/controllers/admin/blog_posts_controller.rb @@ -4,7 +4,6 @@ class Admin::BlogPostsController < Admin::BaseController def index @post_grid = initialize_grid(BlogPost, include: :user, - locale: :sv, order: :created_at) end diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 4e6fbfac8..e012fcb39 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -2,7 +2,7 @@ class Admin::ContactsController < Admin::BaseController load_permissions_and_authorize_resource def index - @contact_grid = initialize_grid(Contact, include: :post, locale: :sv) + @contact_grid = initialize_grid(Contact, include: :post) end def new diff --git a/app/controllers/admin/councils_controller.rb b/app/controllers/admin/councils_controller.rb index fc5e7439c..52c3946c9 100644 --- a/app/controllers/admin/councils_controller.rb +++ b/app/controllers/admin/councils_controller.rb @@ -3,7 +3,7 @@ class Admin::CouncilsController < Admin::BaseController load_permissions_and_authorize_resource find_by: :url def index - @council_grid = initialize_grid(Council, locale: :sv, order: 'council_translations.title') + @council_grid = initialize_grid(Council.with_translations(I18n.locale), order: 'council_translations.title') end def new diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 532767d85..5e7377d3d 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -5,7 +5,6 @@ class Admin::EventsController < Admin::BaseController def index @event_grid = initialize_grid(Event, include: :event_signup, - locale: :sv, order: :starts_at, order_direction: :desc) end diff --git a/app/controllers/admin/introductions_controller.rb b/app/controllers/admin/introductions_controller.rb index a6e75657e..c6bff3fb8 100644 --- a/app/controllers/admin/introductions_controller.rb +++ b/app/controllers/admin/introductions_controller.rb @@ -2,7 +2,7 @@ class Admin::IntroductionsController < Admin::BaseController load_permissions_and_authorize_resource(find_by: :slug) def index - @grid = initialize_grid(Introduction, order: :start, locale: :sv) + @grid = initialize_grid(Introduction, order: :start) end def show diff --git a/app/controllers/admin/main_menus_controller.rb b/app/controllers/admin/main_menus_controller.rb index c2f0517f0..b998ec91f 100644 --- a/app/controllers/admin/main_menus_controller.rb +++ b/app/controllers/admin/main_menus_controller.rb @@ -2,7 +2,7 @@ class Admin::MainMenusController < Admin::BaseController load_permissions_and_authorize_resource def index - @grid = initialize_grid(MainMenu, locale: :sv) + @grid = initialize_grid(MainMenu) end def new diff --git a/app/controllers/admin/menus_controller.rb b/app/controllers/admin/menus_controller.rb index 65c1203cd..4dc18fde5 100644 --- a/app/controllers/admin/menus_controller.rb +++ b/app/controllers/admin/menus_controller.rb @@ -4,7 +4,6 @@ class Admin::MenusController < Admin::BaseController def index @menus_grid = initialize_grid(Menu, include: [main_menu: :translations], - locale: :sv, order: 'menus.main_menu_id', order_direction: 'asc') end diff --git a/app/controllers/admin/news_controller.rb b/app/controllers/admin/news_controller.rb index beb54ebe2..285800532 100644 --- a/app/controllers/admin/news_controller.rb +++ b/app/controllers/admin/news_controller.rb @@ -5,7 +5,6 @@ def index @news_grid = initialize_grid(News, include: :user, order: 'news.created_at', - locale: 'sv', order_direction: :desc) end diff --git a/app/controllers/admin/posts_controller.rb b/app/controllers/admin/posts_controller.rb index 1f93c629f..88973ae13 100644 --- a/app/controllers/admin/posts_controller.rb +++ b/app/controllers/admin/posts_controller.rb @@ -30,7 +30,7 @@ def remove_user def index council = Council.find_by_url!(params[:council_id]) @post_view = PostView.new(council: council, post_user: PostUser.new, users: User.by_firstname) - @post_view.post_grid = initialize_grid(council.posts, name: 'posts', locale: :sv) + @post_view.post_grid = initialize_grid(council.posts, name: 'posts') @post_view.post_user_grid = initialize_grid(council.post_users, include: [:post, :user], name: 'post_users') end @@ -76,7 +76,7 @@ def destroy private def set_grids(post_view) - post_view.post_grid = initialize_grid(post_view.council.posts, name: 'posts', locale: :sv) + post_view.post_grid = initialize_grid(post_view.council.posts, name: 'posts') post_view.post_user_grid = initialize_grid(post_view.council.post_users, include: [:post, :user], name: 'post_users') diff --git a/app/controllers/adventures_controller.rb b/app/controllers/adventures_controller.rb index a5cc5c512..f664c12ab 100644 --- a/app/controllers/adventures_controller.rb +++ b/app/controllers/adventures_controller.rb @@ -43,7 +43,7 @@ def set_mission_variables(adventure) am.points = am.points(@group) end - @grid = initialize_grid(@adventure_missions, locale: :sv, order: 'adventure_missions.index') + @grid = initialize_grid(@adventure_missions, order: 'adventure_missions.index') end private diff --git a/app/controllers/elections_controller.rb b/app/controllers/elections_controller.rb index cbbc4146c..0a4dd467a 100644 --- a/app/controllers/elections_controller.rb +++ b/app/controllers/elections_controller.rb @@ -9,7 +9,6 @@ def index @election_view.grid = initialize_grid(election.current_posts, name: :main, per_page: 70, - locale: I18n.locale, include: [council: :translations], order: 'post_translations.title') @count = election.post_count @@ -18,7 +17,6 @@ def index @election_view.rest_grid = initialize_grid(election.after_posts, name: :rest, per_page: 70, - locale: I18n.locale, include: [council: :translations], order: 'post_translations.title') end From a0d1f424107f5c6d6a651edd392d503b7d74a182 Mon Sep 17 00:00:00 2001 From: David Wessman Date: Sat, 9 Oct 2021 17:16:14 +0200 Subject: [PATCH 4/4] ToolRenting: Proper user association - Sets required on both tool and user --- app/models/tools/tool_renting.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/tools/tool_renting.rb b/app/models/tools/tool_renting.rb index e4a372854..c78644522 100644 --- a/app/models/tools/tool_renting.rb +++ b/app/models/tools/tool_renting.rb @@ -1,7 +1,8 @@ class ToolRenting < ApplicationRecord - belongs_to :tool + belongs_to :tool, required: true + belongs_to :user, required: true - validates :user_id, :tool, :return_date, presence: true + validates :return_date, presence: true validate :there_are_free_tools validate :return_date_lesser_than_today