mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Adjust test for Rails versions that address CVE-2014-4671
Compare https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_controller/metal/renderers.rb#L94 to https://github.com/rails/rails/blob/4-0-stable/actionpack/lib/action_controller/metal/renderers.rb#L97
This commit is contained in:
parent
b05d9dbd36
commit
d03b8179f5
@ -242,9 +242,13 @@ class RenderJsonTest < ActionController::TestCase
|
||||
|
||||
def test_render_json_with_callback
|
||||
get :render_json_hello_world_with_callback
|
||||
if Rails::VERSION::MAJOR == 3
|
||||
assert_equal 'alert({"hello":"world"})', @response.body
|
||||
assert_match %r(application/json), @response.content_type.to_s
|
||||
else
|
||||
assert_equal '/**/alert({"hello":"world"})', @response.body
|
||||
# For JSONP, Rails 3 uses application/json, but Rails 4 uses text/javascript
|
||||
assert_match %r(application/json|text/javascript), @response.content_type.to_s
|
||||
assert_match %r(text/javascript), @response.content_type.to_s
|
||||
end
|
||||
end
|
||||
|
||||
def test_render_json_with_custom_content_type
|
||||
|
||||
@ -1363,7 +1363,6 @@ class SerializerTest < ActiveModel::TestCase
|
||||
def test_inheritance_does_not_used_cached_attributes
|
||||
parent = Class.new(ActiveModel::Serializer) do
|
||||
attributes :title
|
||||
alias :read_attribute_for_serialization :send
|
||||
end
|
||||
|
||||
child = Class.new(parent) do
|
||||
@ -1371,8 +1370,8 @@ class SerializerTest < ActiveModel::TestCase
|
||||
end
|
||||
|
||||
data_class = Class.new do
|
||||
include ActiveModel::Serializers::JSON
|
||||
attr_accessor :title, :body
|
||||
alias :read_attribute_for_serialization :send
|
||||
end
|
||||
|
||||
item = data_class.new
|
||||
|
||||
@ -199,7 +199,7 @@ class SomeSerializer < ActiveModel::Serializer
|
||||
end
|
||||
|
||||
class SomeObject < Struct.new(:some)
|
||||
alias :read_attribute_for_serialization :send
|
||||
include ActiveModel::Serializers::JSON
|
||||
end
|
||||
|
||||
# Set up some classes for polymorphic testing
|
||||
|
||||
Loading…
Reference in New Issue
Block a user