Skip to content

Commit

Permalink
chore(rails): upgrade to rails 7.1.4
Browse files Browse the repository at this point in the history
- removed deprecated fixture_path config keys
- updated certain enum fields to be attributes
- changed @connection to @raw_connection in database extension
  • Loading branch information
adi-herwana-nus committed Sep 11, 2024
1 parent 165c3f9 commit c22224d
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 78 deletions.
7 changes: 1 addition & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ruby '3.1.4'
gem 'tzinfo-data', platforms: [:mswin, :mswin64]

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 7.0.8.4'
gem 'rails', '~> 7.1.4'

# Use PostgreSQL for the backend
gem 'pg'
Expand Down Expand Up @@ -180,11 +180,6 @@ gem 'jwt'
# Use cancancan for authorization
gem 'cancancan'

# Some helpers for structuring CSS/JavaScript
# Official version https://github.com/winston/rails_utils/pull/30 is no longer maintained.
# We also want stricter sanitization.
# gem 'rails_utils', git: 'https://github.com/Coursemology/rails_utils.git'

# Using CarrierWave for file uploads
gem 'carrierwave', '2.2.6'
# Generate sequential filenames
Expand Down
159 changes: 93 additions & 66 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,75 +36,84 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
actioncable (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
zeitwerk (~> 2.6)
actionmailbox (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8.4)
actionpack (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activesupport (= 7.0.8.4)
actionmailer (7.1.4)
actionpack (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activesupport (= 7.1.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8.4)
actionview (= 7.0.8.4)
activesupport (= 7.0.8.4)
rack (~> 2.0, >= 2.2.4)
rails-dom-testing (~> 2.2)
actionpack (7.1.4)
actionview (= 7.1.4)
activesupport (= 7.1.4)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8.4)
actionpack (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.4)
actionpack (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8.4)
activesupport (= 7.0.8.4)
actionview (7.1.4)
activesupport (= 7.1.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_record_upsert (0.11.2)
activerecord (>= 5.2, < 7.2)
pg (>= 0.18, < 2.0)
activejob (7.0.8.4)
activesupport (= 7.0.8.4)
activejob (7.1.4)
activesupport (= 7.1.4)
globalid (>= 0.3.6)
activemodel (7.0.8.4)
activesupport (= 7.0.8.4)
activerecord (7.0.8.4)
activemodel (= 7.0.8.4)
activesupport (= 7.0.8.4)
activemodel (7.1.4)
activesupport (= 7.1.4)
activerecord (7.1.4)
activemodel (= 7.1.4)
activesupport (= 7.1.4)
timeout (>= 0.4.0)
activerecord-import (1.8.1)
activerecord (>= 4.2)
activestorage (7.0.8.4)
actionpack (= 7.0.8.4)
activejob (= 7.0.8.4)
activerecord (= 7.0.8.4)
activesupport (= 7.0.8.4)
activestorage (7.1.4)
actionpack (= 7.1.4)
activejob (= 7.1.4)
activerecord (= 7.1.4)
activesupport (= 7.1.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8.4)
activesupport (7.1.4)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
acts_as_tenant (1.0.1)
rails (>= 6.0)
Expand Down Expand Up @@ -132,6 +141,7 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.2.0)
bcrypt (3.1.20)
bigdecimal (3.1.8)
builder (3.3.0)
bullet (7.2.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -189,6 +199,7 @@ GEM
dotenv-rails (3.1.2)
dotenv (= 3.1.2)
railties (>= 6.1)
drb (2.2.1)
edge (0.6.1)
activerecord (>= 5.0.0)
email_spec (2.3.0)
Expand Down Expand Up @@ -269,6 +280,10 @@ GEM
ruby-vips (>= 2.0.17, < 3)
image_size (3.4.0)
in_threads (1.6.0)
io-console (0.7.2)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.12.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -322,7 +337,6 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0820)
Expand All @@ -334,6 +348,7 @@ GEM
mini_portile2 (2.8.7)
minitest (5.25.1)
multi_json (1.15.0)
mutex_m (0.2.0)
net-imap (0.4.14)
date
net-protocol
Expand All @@ -357,6 +372,8 @@ GEM
racc
pg (1.5.8)
progress (3.6.0)
psych (5.1.2)
stringio
public_suffix (6.0.0)
puma (6.4.2)
nio4r (~> 2.0)
Expand All @@ -371,20 +388,23 @@ GEM
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8.4)
actioncable (= 7.0.8.4)
actionmailbox (= 7.0.8.4)
actionmailer (= 7.0.8.4)
actionpack (= 7.0.8.4)
actiontext (= 7.0.8.4)
actionview (= 7.0.8.4)
activejob (= 7.0.8.4)
activemodel (= 7.0.8.4)
activerecord (= 7.0.8.4)
activestorage (= 7.0.8.4)
activesupport (= 7.0.8.4)
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.4)
actioncable (= 7.1.4)
actionmailbox (= 7.1.4)
actionmailer (= 7.1.4)
actionpack (= 7.1.4)
actiontext (= 7.1.4)
actionview (= 7.1.4)
activejob (= 7.1.4)
activemodel (= 7.1.4)
activerecord (= 7.1.4)
activestorage (= 7.1.4)
activesupport (= 7.1.4)
bundler (>= 1.15.0)
railties (= 7.0.8.4)
railties (= 7.1.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -399,18 +419,21 @@ GEM
rails-i18n (7.0.9)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
railties (7.0.8.4)
actionpack (= 7.0.8.4)
activesupport (= 7.0.8.4)
method_source
railties (7.1.4)
actionpack (= 7.1.4)
activesupport (= 7.1.4)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (6.7.0)
psych (>= 4.0.0)
recaptcha (5.17.0)
record_tag_helper (1.0.1)
actionview (>= 5)
Expand All @@ -435,6 +458,8 @@ GEM
redis-store (1.10.0)
redis (>= 4, < 6)
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
responders (3.1.1)
Expand Down Expand Up @@ -540,6 +565,7 @@ GEM
rack (>= 2.2.4, < 4)
ssrf_filter (1.1.2)
stackprof (0.2.26)
stringio (3.1.1)
temple (0.10.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
Expand All @@ -559,6 +585,7 @@ GEM
activesupport (>= 3.0)
warden (1.2.9)
rack (>= 2.0.9)
webrick (1.8.1)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
Expand Down Expand Up @@ -628,7 +655,7 @@ DEPENDENCIES
puma
rack-cors
rack-mini-profiler
rails (~> 7.0.8.4)
rails (~> 7.1.4)
rails-controller-testing
rails-html-sanitizer (>= 1.0.4)
recaptcha
Expand Down
1 change: 1 addition & 0 deletions app/models/course/survey.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Course::Survey < ApplicationRecord

include Course::ClosingReminderConcern

attribute :question_type, :integer
enum question_type: { text_response: 0, multiple_choice: 1, multiple_response: 2 }

validates :end_at, presence: true, if: :allow_response_after_end
Expand Down
1 change: 1 addition & 0 deletions app/models/course/survey/question.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true
class Course::Survey::Question < ApplicationRecord
attribute :question_type, :integer
enum question_type: { text: 0, multiple_choice: 1, multiple_response: 2 }

validates :description, presence: true
Expand Down
2 changes: 1 addition & 1 deletion lib/extensions/database_event/active_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def wait_for_identifier(identifier, deadline, while_callback, &block)
def wait_until(deadline, while_callback, &block)
while deadline.nil? || Time.zone.now < deadline
wait_timeout = deadline ? deadline - Time.zone.now : nil
result = connection.instance_variable_get(:@connection).
result = connection.instance_variable_get(:@raw_connection).

Check warning on line 61 in lib/extensions/database_event/active_record/base.rb

View check run for this annotation

Codecov / codecov/patch

lib/extensions/database_event/active_record/base.rb#L61

Added line #L61 was not covered by tests
wait_for_notify(wait_timeout, &block)
return result if while_callback.nil? || !while_callback.call
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
question = create(:course_assessment_question_programming,
assessment: assessment, template_file_count: 0, package_type: :zip_upload)

empty_package = File.join(fixture_path, 'course/empty_programming_question_template.zip')
valid_package = File.join(fixture_path, 'course/programming_question_template.zip')
empty_package = File.join(file_fixture_path, 'course/empty_programming_question_template.zip')
valid_package = File.join(file_fixture_path, 'course/programming_question_template.zip')

visit edit_course_assessment_question_programming_path(course, assessment, question)
find('span', text: 'Evaluate and test code').click
Expand Down
7 changes: 5 additions & 2 deletions spec/libraries/duplicator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,11 @@ def initialize_duplicate(duplicator, other)
end

temporary_table(:children_parents) do |t|
t.integer :children_id, foreign_key: { references: :complex_active_records, primary_key: :id }
t.integer :parent_id, foreign_key: { references: :complex_active_records, primary_key: :id }
# Something in Rails 7.1 upgrade broke the one-line declarations here.
t.integer :children_id
t.foreign_key :complex_active_records, column: :children_id, primary_key: :id
t.integer :parent_id
t.foreign_key :complex_active_records, column: :parent_id, primary_key: :id
end

class DuplicationTraceableActiveRecordWithSource < ApplicationRecord
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# config.fixture_paths = ["#{::Rails.root}/spec/fixtures"]
config.file_fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
Expand Down

0 comments on commit c22224d

Please sign in to comment.