-
Notifications
You must be signed in to change notification settings - Fork 17
Upgrade to rails 7 #760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to rails 7 #760
Conversation
fix a broken test for Checkin::Creator due to Position not saving without a location
fix spec: use allow_blank rather than conditional validation
eadbbd9 to
d0eef51
Compare
| it { is_expected.to validate_inclusion_of(:trackable_type).in_array(%w[Condition Symptom Treatment]) } | ||
|
|
||
| context "without foreign key checks" do | ||
| subject { create :tracking, :for_condition, :active } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed an error during upgrade, see shoulda-matchers issue.
| end | ||
| context "on a past checkin" do | ||
| before { checkin.update!(date: Time.zone.today - 1.day) } | ||
| let(:checkin) { create(:checkin, user_id: user.id, date: Time.zone.today - 1.day) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update! in the before {} caused an lazy loading error (from Bullet), use a lazy let instead.
| "postal_code" => "55403" | ||
| } | ||
| Geocoder::Lookup::Test.set_default_stub([minneapolis_geo]) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to do this before any updates, spec failed consistently because position would not save/validate as its geocoder position was nil
# backend/app/models/position.rb:21
def geocoder_position
@geocoder_position ||= Geocoder.search(postal_code).first
endCaused more issues until I matched location info to the Weather lookup VCR stub
| module Concerns | ||
| end | ||
| end | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to autoload (zeitwerk) api/v1/concerns. Concerns::Notificatable wasn't working in comment/post serializer, for example.
| # uri: mongodb://user:password@mongodb.domain.com:27017/flaredown_development | ||
|
|
||
| # Otherwise define the parameters separately. | ||
| # This defines the name of the default database that Mongoid can connect to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes in this file are all comments replacing comments. They are all from running rails g mongoid:config after upgrading Mongoid.
|
|
||
| it { is_expected.to respond_to(:value) } | ||
| it { is_expected.to validate_inclusion_of(:value).to_allow(0..4) } | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional validate in app/models/checkin/fiveable.rb concern: validates :value, inclusion: {in: (0..4)}, if: -> { value.present? } was the problem. I created this shared example while trying to fix it.
I like the it_behaves_like pattern for concerns, but can revert this shared example change if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
remove old options, clean
| Bullet.console = true | ||
| # Bullet.growl = true | ||
| Bullet.rails_logger = true | ||
| Bullet.add_footer = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from top of file - config.after_initialize Bullet setup was done twice here.
| # "info" includes generic and useful information about system operation, but avoids logging too much | ||
| # information to avoid inadvertent exposure of personally identifiable information (PII). If you | ||
| # want to log everything, set the level to "debug". | ||
| config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "debug") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails default is "info" but was previously set to debug in removed L51.
| config.action_mailer.delivery_method = :test | ||
|
|
||
| # Randomize the order test cases are executed. | ||
| config.active_support.test_order = :random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left this removed because it was not doing what it said - this only affects minitest.
I added --order random to the backend/.rspec and did see some failing tests!
|
wow! will review |
Resolves #734
Specs are all green via
script/backend rspec.New to the project, not sure how deployment works, but I assumed there are no rolling deploys involved. If there are seperate server instances, this commit will need to be removed, then re-added after deployment.
One annoying thing is deprecation warnings in specs (9 total):
I think it is out of scope here, and I don't know how prod env is handled -- but will need to migrate from secrets to credentials before upgrading to 7.2. (Warning gem could suppress warnings while running specs til then).
Other than than, I think this is ready.