-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Test against rails 8.0 #3702
base: master
Are you sure you want to change the base?
Test against rails 8.0 #3702
Conversation
gemfiles/rails_8.0.gemfile
Outdated
platforms :ruby, :mswin, :mingw, :x64_mingw do | ||
gem "mysql2", ">= 0.3.14" | ||
gem "pg", ">= 1.0.0" | ||
gem "sqlite3", "~> 1.3" |
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.
From Rails 8.0, it looks like the version of sqlite3 needs to be upgraded to v2.1 or higher.
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.
indeed, I upgraded it, and now it seems to work
It looks like a lot of unrelated things are broken, not sure how to proceed. |
@jewilmeer Indeed, I was able to reproduce the issue on master. I suspect that because the json gem isn't pinned, the latest CI runs install a version that is greater than 2.7.6, the newer versions'
The test fails because RailsAdmin's Json field class calls JSON.pretty_generate, and the test's regex is expecting at least one newline from its result. As a quick test, I made the following change, and the tests pass: diff --git a/spec/rails_admin/config/fields/types/json_spec.rb b/spec/rails_admin/config/fields/types/json_spec.rb
index a1e03958..a749d930 100644
--- a/spec/rails_admin/config/fields/types/json_spec.rb
+++ b/spec/rails_admin/config/fields/types/json_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe RailsAdmin::Config::Fields::Types::Json do
it 'returns correct value for empty json' do
allow(object).to receive(:json_field) { {} }
actual = field.with(bindings).formatted_value
- expect(actual).to match(/{\n+}/)
+ expect(actual).to match(/{\n*}/)
end
it 'retuns correct value' do
@@ -72,7 +72,7 @@ RSpec.describe RailsAdmin::Config::Fields::Types::Json do
it 'returns correct value for empty json' do
allow(object).to receive(:json_field) { {} }
actual = field.with(bindings).export_value
- expect(actual).to match(/{\n+}/)
+ expect(actual).to match(/{\n*}/)
end
it 'returns correct value' do I don't see any need for the newline, so I'd lean towards just updating the test (whether to split the change into a separate PR is up to you and the maintainers), but I'm also not a frequent user of RailsAdmin. |
As rails 8 came out, and not a lot has changed internally since 7.2, it might just work :-)