test/unit/serializer_test.rb in enumerate_by-0.4.3 vs test/unit/serializer_test.rb in enumerate_by-0.4.4
- old
+ new
@@ -6,18 +6,19 @@
@car = create_car(:name => 'Ford Mustang', :color => @red)
@serializer = ActiveRecord::Serialization::Serializer.new(@car)
end
def test_should_include_enumerations_in_serializable_attribute_names
- assert_equal %w(color feature_id feature_type id name), @serializer.serializable_attribute_names
+ assert_equal %w(color feature_id feature_type id legacy_color name), @serializer.serializable_attribute_names
end
def test_should_typecast_serializable_record
expected = {
'color' => 'red',
'feature_id' => nil,
'feature_type' => nil,
+ 'legacy_color' => nil,
'id' => @car.id,
'name' => 'Ford Mustang'
}
assert_equal expected, @serializer.serializable_record
@@ -30,18 +31,19 @@
@car = create_car(:name => 'Ford Mustang', :color => @red)
@serializer = ActiveRecord::Serialization::Serializer.new(@car, :enumerations => false)
end
def test_should_not_include_enumerations_in_serializable_attribute_names
- assert_equal %w(color_id feature_id feature_type id name), @serializer.serializable_attribute_names
+ assert_equal %w(color_id feature_id feature_type id legacy_color_id name), @serializer.serializable_attribute_names
end
def test_should_not_typecast_serializable_record
expected = {
'color_id' => @red.id,
'feature_id' => nil,
'feature_type' => nil,
+ 'legacy_color_id' => nil,
'id' => @car.id,
'name' => 'Ford Mustang'
}
assert_equal expected, @serializer.serializable_record
@@ -96,17 +98,18 @@
@car = create_car(:name => 'Ford Mustang', :color => @red)
@serializer = ActiveRecord::Serialization::Serializer.new(@car, :except => :color_id)
end
def test_should_not_include_enumeration_in_serializable_attribute_names
- assert_equal %w(feature_id feature_type id name), @serializer.serializable_attribute_names
+ assert_equal %w(feature_id feature_type id legacy_color name), @serializer.serializable_attribute_names
end
def test_should_not_include_enumeration_in_serializable_record
expected = {
'feature_id' => nil,
'feature_type' => nil,
+ 'legacy_color' => nil,
'id' => @car.id,
'name' => 'Ford Mustang'
}
assert_equal expected, @serializer.serializable_record
@@ -119,17 +122,18 @@
@car = create_car(:name => 'Ford Mustang', :color => @red)
@serializer = ActiveRecord::Serialization::Serializer.new(@car, :except => :color)
end
def test_should_not_include_enumeration_in_serializable_attribute_names
- assert_equal %w(feature_id feature_type id name), @serializer.serializable_attribute_names
+ assert_equal %w(feature_id feature_type id legacy_color name), @serializer.serializable_attribute_names
end
def test_should_not_include_enumeration_in_serializable_record
expected = {
'feature_id' => nil,
'feature_type' => nil,
+ 'legacy_color' => nil,
'id' => @car.id,
'name' => 'Ford Mustang'
}
assert_equal expected, @serializer.serializable_record
@@ -142,11 +146,11 @@
@car = create_car(:name => 'Ford Mustang', :color => @red)
@serializer = ActiveRecord::Serialization::Serializer.new(@car, :include => :color)
end
def test_should_not_include_enumeration_in_serializable_attribute_names
- assert_equal %w(color_id feature_id feature_type id name), @serializer.serializable_attribute_names
+ assert_equal %w(color_id feature_id feature_type id legacy_color name), @serializer.serializable_attribute_names
end
def test_should_include_entire_enumeration_in_serializable_record
expected = {
:color => {
@@ -155,9 +159,10 @@
'name' => 'red'
},
'color_id' => @red.id,
'feature_id' => nil,
'feature_type' => nil,
+ 'legacy_color' => nil,
'id' => @car.id,
'name' => 'Ford Mustang'
}
assert_equal expected, @serializer.serializable_record