diff options
Diffstat (limited to 'activemodel/test/cases/serializers/json_serialization_test.rb')
-rw-r--r-- | activemodel/test/cases/serializers/json_serialization_test.rb | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/activemodel/test/cases/serializers/json_serialization_test.rb b/activemodel/test/cases/serializers/json_serialization_test.rb index 60414a6570..d765a47636 100644 --- a/activemodel/test/cases/serializers/json_serialization_test.rb +++ b/activemodel/test/cases/serializers/json_serialization_test.rb @@ -1,25 +1,7 @@ require 'cases/helper' require 'models/contact' -require 'models/automobile' require 'active_support/core_ext/object/instance_variables' -class Contact - include ActiveModel::Serializers::JSON - include ActiveModel::Validations - - def attributes=(hash) - hash.each do |k, v| - instance_variable_set("@#{k}", v) - end - end - - remove_method :attributes if method_defined?(:attributes) - - def attributes - instance_values - end -end - class JsonSerializationTest < ActiveModel::TestCase def setup @contact = Contact.new @@ -213,4 +195,8 @@ class JsonSerializationTest < ActiveModel::TestCase assert_no_match %r{"awesome":}, json assert_no_match %r{"preferences":}, json end + + test "Class.model_name should be json encodable" do + assert_match %r{"Contact"}, Contact.model_name.to_json + end end |