diff --git a/Gemfile b/Gemfile index eaf5afd..8522b67 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ end source 'https://rubygems.org' if next? - gem 'rails', '5.1.7' + gem 'rails', '5.2.8.1' else gem 'rails', '5.1.7' end diff --git a/Gemfile.next.lock b/Gemfile.next.lock index 1a4b785..1928233 100644 --- a/Gemfile.next.lock +++ b/Gemfile.next.lock @@ -12,46 +12,50 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.1.7) - actionpack (= 5.1.7) + actioncable (5.2.8.1) + actionpack (= 5.2.8.1) nio4r (~> 2.0) - websocket-driver (~> 0.6.1) - actionmailer (5.1.7) - actionpack (= 5.1.7) - actionview (= 5.1.7) - activejob (= 5.1.7) + websocket-driver (>= 0.6.1) + actionmailer (5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.7) - actionview (= 5.1.7) - activesupport (= 5.1.7) - rack (~> 2.0) + actionpack (5.2.8.1) + actionview (= 5.2.8.1) + activesupport (= 5.2.8.1) + 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.1.7) - activesupport (= 5.1.7) + actionview (5.2.8.1) + activesupport (= 5.2.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.7) - activesupport (= 5.1.7) + activejob (5.2.8.1) + activesupport (= 5.2.8.1) globalid (>= 0.3.6) - activemodel (5.1.7) - activesupport (= 5.1.7) - activerecord (5.1.7) - activemodel (= 5.1.7) - activesupport (= 5.1.7) - arel (~> 8.0) - activesupport (5.1.7) + activemodel (5.2.8.1) + activesupport (= 5.2.8.1) + activerecord (5.2.8.1) + activemodel (= 5.2.8.1) + activesupport (= 5.2.8.1) + arel (>= 9.0) + activestorage (5.2.8.1) + actionpack (= 5.2.8.1) + activerecord (= 5.2.8.1) + marcel (~> 1.0.0) + activesupport (5.2.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - arel (8.0.0) + arel (9.0.0) aws-sdk (2.3.23) aws-sdk-resources (= 2.3.23) aws-sdk-core (2.3.23) @@ -59,13 +63,12 @@ GEM aws-sdk-resources (2.3.23) aws-sdk-core (= 2.3.23) base64 (0.2.0) - benchmark-ips (2.13.0) + benchmark-ips (2.14.0) bigdecimal (3.1.8) builder (3.3.0) codeclimate-test-reporter (0.6.0) simplecov (>= 0.7.1, < 1.0.0) coderay (1.1.3) - colorize (1.1.0) concurrent-ruby (1.3.4) congestion (0.1.0) connection_pool (>= 2.0) @@ -78,8 +81,6 @@ GEM date (3.3.4) diff-lcs (1.5.1) docile (1.1.5) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) erubi (1.13.0) et-orbi (1.2.11) tzinfo @@ -88,7 +89,7 @@ GEM factory_bot_rails (5.2.0) factory_bot (~> 5.2.0) railties (>= 4.2.0) - faraday (1.10.3) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -111,11 +112,11 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) ffi (1.16.3) formatador (1.1.0) - fugit (1.11.0) + fugit (1.11.1) et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) globalid (1.1.0) @@ -136,10 +137,7 @@ GEM rspec (>= 2.99.0, < 4.0) hashdiff (1.1.1) honeybadger (4.5.6) - http-accept (1.7.0) - http-cookie (1.0.6) - domain_name (~> 0.5) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) its-it (1.3.0) jmespath (1.6.2) @@ -180,13 +178,11 @@ GEM net-imap net-pop net-smtp + marcel (1.0.4) method_source (1.1.0) - mime-types (3.5.2) - mime-types-data (~> 3.2015) - mime-types-data (3.2024.0806) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.24.1) + minitest (5.25.1) mock_redis (0.36.0) ruby2_keywords modware (0.1.3) @@ -202,8 +198,7 @@ GEM timeout net-smtp (0.5.0) net-protocol - netrc (0.11.0) - newrelic_rpm (9.12.0) + newrelic_rpm (9.14.0) nio4r (2.7.3) nokogiri (1.13.10) mini_portile2 (~> 2.8.0) @@ -216,13 +211,13 @@ GEM coderay (~> 1.1) method_source (~> 1.0) public_suffix (5.1.1) - puma (6.4.2) + puma (6.4.3) nio4r (~> 2.0) pundit (1.1.0) activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) - rack (2.2.9) + rack (2.2.10) rack-cors (1.0.6) rack (>= 1.6.0) rack-protection (3.2.0) @@ -230,17 +225,18 @@ GEM rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) - rails (5.1.7) - actioncable (= 5.1.7) - actionmailer (= 5.1.7) - actionpack (= 5.1.7) - actionview (= 5.1.7) - activejob (= 5.1.7) - activemodel (= 5.1.7) - activerecord (= 5.1.7) - activesupport (= 5.1.7) + rails (5.2.8.1) + actioncable (= 5.2.8.1) + actionmailer (= 5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + activemodel (= 5.2.8.1) + activerecord (= 5.2.8.1) + activestorage (= 5.2.8.1) + activesupport (= 5.2.8.1) bundler (>= 1.3.0) - railties (= 5.1.7) + railties (= 5.2.8.1) sprockets-rails (>= 2.0.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) @@ -248,12 +244,13 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.5.0) loofah (~> 2.19, >= 2.19.1) - railties (5.1.7) - actionpack (= 5.1.7) - activesupport (= 5.1.7) + railties (5.2.8.1) + actionpack (= 5.2.8.1) + activesupport (= 5.2.8.1) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) + rainbow (3.0.0) rake (13.2.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) @@ -261,26 +258,20 @@ GEM redis (3.3.5) request_store (1.7.0) rack (>= 1.4) - rest-client (2.1.0) - http-accept (>= 1.7.0, < 2.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) - rexml (3.3.5) - strscan + rexml (3.3.8) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.0) + rspec-core (3.13.2) rspec-support (~> 3.13.0) - rspec-expectations (3.13.1) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-its (1.3.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (4.1.2) @@ -332,30 +323,24 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - strscan (3.1.0) - ten_years_rails (0.2.0) - actionview - activesupport - colorize (>= 0.8.1) - rest-client (>= 2.0.2) - thor (1.3.1) + ten_years_rails (1.0.2) + actionview (~> 5.2.3) + rainbow (~> 3.0.0) + thor (1.3.2) thread_safe (0.3.6) timecop (0.9.10) timeout (0.4.1) tzinfo (1.2.11) thread_safe (~> 0.1) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1) - webmock (3.23.1) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket-driver (0.6.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) zoo_stream (1.0.1) @@ -385,7 +370,7 @@ DEPENDENCIES puma pundit (~> 1.1.0) rack-cors (~> 1.0.5) - rails (= 5.1.7) + rails (= 5.2.8.1) redis (~> 3.3.0) restpack_serializer! rspec-its diff --git a/Rakefile b/Rakefile index 77bfffc..00c4e64 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,27 @@ require File.expand_path('../config/application', __FILE__) Rails.application.load_tasks + +# In Rails 5.2 the `load_config` task was made dependent on `environment` +# to enable credentials reading, see https://github.com/rails/rails/pull/31135 +# This causes the whole app to initialize before `db:create` and that +# causes a database connection for observers, sphinx, concerns, etc, that cant be established +# when DB does not exist yet. +# See SO: https://stackoverflow.com/questions/72147515/rails-5-2-load-order-breaks-dbcreate +# While clearing the environment prerequisite of load_config will help db:create +# and create the db, other tasks like db:schema:load and our panoptes talk rake tasks +# will actually need the prereq, and therefore we bring back the environment prereq +# for other rake tasks. We do this to keep our CI test workflows and local dev environment setup functional. + +Rake::Task['db:load_config'].prerequisites.delete("environment") +Rake::Task.tasks.select { |task| + next if task.name == "db:create" + task.name.start_with?("db:") && task.prerequisites.include?("load_config") +}.each { |task| + task.prerequisites.insert(task.prerequisites.index("load_config"), "environment") +} +Rake::Task.tasks.select { |task| + task.prerequisites.include?("db:load_config") +}.each { |task| + task.prerequisites.insert(task.prerequisites.index("db:load_config"), "environment") +} \ No newline at end of file diff --git a/app/models/project.rb b/app/models/project.rb index 9556e7d..8e6cbeb 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,4 +1,5 @@ class Project < ApplicationRecord + self.primary_key = :id has_many :boards alias_attribute :title, :display_name diff --git a/app/models/subject.rb b/app/models/subject.rb index 8b26f1c..c8da9cc 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -1,4 +1,5 @@ class Subject < ApplicationRecord + self.primary_key = :id include Focusable belongs_to :project end diff --git a/app/models/user.rb b/app/models/user.rb index b3061c3..a879142 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,5 @@ class User < ApplicationRecord + self.primary_key = :id include Moderatable ALLOWED_LOGIN_CHARACTERS = '\w\-\.'.freeze diff --git a/spec/models/announcement_spec.rb b/spec/models/announcement_spec.rb index 6f5c7d6..681aac4 100644 --- a/spec/models/announcement_spec.rb +++ b/spec/models/announcement_spec.rb @@ -9,10 +9,10 @@ end context 'creating' do - let(:announcement){ create :announcement } + let(:announcement){ build :announcement } it 'should publish' do expect(AnnouncementWorker).to receive :perform_async - announcement.run_callbacks :commit + announcement.save! end end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 01edc2b..8d1419a 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -30,10 +30,10 @@ end context 'creating' do - let(:notification){ create :notification } + let(:notification){ build :notification } it 'should publish' do expect(NotificationWorker).to receive :perform_async - notification.run_callbacks :commit + notification.save! end end