From 56915809caf11bd4f53e27270aad12c8cff2eed1 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Wed, 17 Jul 2013 19:14:55 -0300 Subject: [PATCH] Fixing approve comment json lib call --- app/models/approve_comment.rb | 2 +- test/functional/comment_controller_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/approve_comment.rb b/app/models/approve_comment.rb index 3998ad0..13c9cc1 100644 --- a/app/models/approve_comment.rb +++ b/app/models/approve_comment.rb @@ -6,7 +6,7 @@ class ApproveComment < Task validates_presence_of :comment_attributes def comment - @comment ||= Comment.new(JSON.parse(self.comment_attributes)) unless self.comment_attributes.nil? + @comment ||= Comment.new(ActiveSupport::JSON.decode(self.comment_attributes)) unless self.comment_attributes.nil? end def requestor_name diff --git a/test/functional/comment_controller_test.rb b/test/functional/comment_controller_test.rb index bd03e08..b408030 100644 --- a/test/functional/comment_controller_test.rb +++ b/test/functional/comment_controller_test.rb @@ -150,7 +150,7 @@ class CommentControllerTest < ActionController::TestCase login_as @profile.identifier page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text') xhr :post, :create, :profile => @profile.identifier, :id => page.id, :comment => { :title => '', :body => '' }, :confirm => 'true' - response = JSON.parse @response.body + response = ActiveSupport::JSON.decode @response.body assert_match /errorExplanation/, response["html"] end @@ -507,7 +507,7 @@ class CommentControllerTest < ActionController::TestCase comment = fast_create(Comment, :body => 'Original comment', :source_id => page.id, :source_type => 'Article', :author_id => profile) xhr :post, :update, :id => comment.id, :profile => profile.identifier, :comment => { :body => 'Comment edited' } - assert JSON.parse(@response.body)["ok"], "attribute ok expected to be true" + assert ActiveSupport::JSON.decode(@response.body)["ok"], "attribute ok expected to be true" assert_equal 'Comment edited', Comment.find(comment.id).body end -- libgit2 0.21.2