Skip to content

Commit

Permalink
Using ActiveSupport::JSON for better compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
dwbutler committed Jan 22, 2013
1 parent fcd96e1 commit 995988d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/unit/serializer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
class CustomSerializer
require 'json'
def self.dump(object_hash)
object_hash.to_json
ActiveSupport::JSON.encode object_hash
end

def self.load(string)
JSON.parse string
ActiveSupport::JSON.decode string
end
end

Expand Down Expand Up @@ -63,8 +63,8 @@ class SerializerTest < ActiveSupport::TestCase

# Check values are stored as JSON.
hash = {"widget_id" => nil,"name" =>"Some text.","id" =>1}
assert_equal hash.to_json, @fluxor.versions[1].object
assert_equal hash, JSON.parse(@fluxor.versions[1].object)
assert_equal ActiveSupport::JSON.encode(hash), @fluxor.versions[1].object
assert_equal hash, ActiveSupport::JSON.decode(@fluxor.versions[1].object)
end

should 'store object_changes' do
Expand Down

0 comments on commit 995988d

Please sign in to comment.