tests/test_json_rails.rb in json-1.1.2 vs tests/test_json_rails.rb in json-1.1.3

- old
+ new

@@ -29,10 +29,14 @@ }.to_json(*args) end end class B + def self.json_creatable? + false + end + def to_json(*args) { 'json_class' => self.class.name, }.to_json(*args) end @@ -72,17 +76,17 @@ {"args"=>[666], "json_class"=>"TC_JSONRails::A"}.sort_by { |k,| k }, a_hash.sort_by { |k,| k } ) end - def test_extended_json_fail + def test_extended_json_fail1 b = B.new assert !B.json_creatable? json = generate(b) assert_equal({ 'json_class' => B.name }, JSON.parse(json)) end - def test_extended_json_fail + def test_extended_json_fail2 c = C.new # with rails addition all objects are theoretically creatable assert C.json_creatable? json = generate(c) assert_raises(ArgumentError) { JSON.parse(json) } end