Skip to content
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

[0.9 stable] Make the test suite pass with Rails 7.1 and Ruby 3.3 #2462

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
matrix:
include:
# Recent Rubies and Rails
# - ruby-version: '3.1'
# rails-version: '7.0'
- ruby-version: '3.3'
rails-version: '7.1'
# - ruby-version: '3.0'
# rails-version: '7.0'
# - ruby-version: '2.7'
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ end

group :test do
platforms(*(@windows_platforms + [:ruby])) do
if version == 'master' || version >= '6'
gem 'sqlite3', '~> 1.4'
else
if RUBY_VERSION < '2.5' || version < '6'
gem 'sqlite3', '~> 1.3.13'
else
gem 'sqlite3'
end
end
platforms :jruby do
Expand Down
1 change: 1 addition & 0 deletions lib/action_controller/serialization_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def process(*args)
@serializers = Hash.new(0)
super
end
ruby2_keywords :process if respond_to?(:ruby2_keywords, true)

# Asserts that the request was rendered with the appropriate serializers.
#
Expand Down
26 changes: 13 additions & 13 deletions test/integration/action_controller/serialization_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def render_using_implicit_serializer

def test_render_using_implicit_serializer
get :render_using_implicit_serializer
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"profile":{"name":"Name 1","description":"Description 1"}}', @response.body
end
end
Expand All @@ -35,7 +35,7 @@ def current_user

def test_render_using_implicit_serializer_and_scope
get :render_using_implicit_serializer_and_scope
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_user"}}', @response.body
end
end
Expand Down Expand Up @@ -65,7 +65,7 @@ def current_admin

def test_render_using_scope_set_in_default_serializer_options
get :render_using_scope_set_in_default_serializer_options
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_admin"}}', @response.body
end
end
Expand All @@ -91,7 +91,7 @@ def current_admin

def test_render_using_implicit_serializer_and_explicit_scope
get :render_using_implicit_serializer_and_explicit_scope
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_admin"}}', @response.body
end
end
Expand All @@ -117,7 +117,7 @@ def serialization_scope

def test_render_overriding_serialization_scope
get :render_overriding_serialization_scope
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_admin"}}', @response.body
end
end
Expand All @@ -141,7 +141,7 @@ def current_user

def test_render_calling_serialization_scope
get :render_calling_serialization_scope
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"profile":{"name":"Name 1","description":"Description 1 - current_user"}}', @response.body
end
end
Expand All @@ -157,7 +157,7 @@ def render_using_json_dump

def test_render_using_json_dump
get :render_using_json_dump
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"hello":"world"}', @response.body
end
end
Expand All @@ -173,7 +173,7 @@ def render_using_rails_behavior

def test_render_using_rails_behavior
get :render_using_rails_behavior
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '[{"attributes":{"name":"Name 1","description":"Description 1","comments":"Comments 1"}}]', @response.body
end
end
Expand All @@ -189,7 +189,7 @@ def render_array

def test_render_array
get :render_array
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"my":[{"name":"Name 1","description":"Description 1"}]}', @response.body
end
end
Expand All @@ -205,7 +205,7 @@ def render_array

def test_render_array
get :render_array
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"webLog":[{"name":"Name 1","displayName":"Display Name 1"},{"name":"Name 2","displayName":"Display Name 2"}]}', @response.body
end
end
Expand All @@ -223,7 +223,7 @@ def render_without_root

def test_render_without_root
get :render_without_root
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '{"name":"Name 1","displayName":"Display Name 1"}', @response.body
end
end
Expand All @@ -242,7 +242,7 @@ def render_array_without_root

def test_render_array_without_root
get :render_array_without_root
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'
assert_equal '[{"name":"Name 1","displayName":"Display Name 1"},{"name":"Name 2","displayName":"Display Name 2"}]', @response.body
end
end
Expand Down Expand Up @@ -278,7 +278,7 @@ def test_render_array_embeding_in_root
@association.embed_in_root = true

get :render_array_embeding_in_root
assert_equal 'application/json', @response.content_type
assert_includes @response.content_type, 'application/json'

assert_equal("{\"my\":[{\"name\":\"Name 1\",\"email\":\"[email protected]\",\"profile_id\":#{@controller.user.profile.object_id}}],\"profiles\":[{\"name\":\"N1\",\"description\":\"D1\"}]}", @response.body)
end
Expand Down
Loading