Commit 56915809caf11bd4f53e27270aad12c8cff2eed1

Authored by Rodrigo Souto
1 parent c1cd1797

Fixing approve comment json lib call

(ActionItem2737)
app/models/approve_comment.rb
... ... @@ -6,7 +6,7 @@ class ApproveComment < Task
6 6 validates_presence_of :comment_attributes
7 7  
8 8 def comment
9   - @comment ||= Comment.new(JSON.parse(self.comment_attributes)) unless self.comment_attributes.nil?
  9 + @comment ||= Comment.new(ActiveSupport::JSON.decode(self.comment_attributes)) unless self.comment_attributes.nil?
10 10 end
11 11  
12 12 def requestor_name
... ...
test/functional/comment_controller_test.rb
... ... @@ -150,7 +150,7 @@ class CommentControllerTest < ActionController::TestCase
150 150 login_as @profile.identifier
151 151 page = profile.articles.create!(:name => 'myarticle', :body => 'the body of the text')
152 152 xhr :post, :create, :profile => @profile.identifier, :id => page.id, :comment => { :title => '', :body => '' }, :confirm => 'true'
153   - response = JSON.parse @response.body
  153 + response = ActiveSupport::JSON.decode @response.body
154 154 assert_match /errorExplanation/, response["html"]
155 155 end
156 156  
... ... @@ -507,7 +507,7 @@ class CommentControllerTest < ActionController::TestCase
507 507 comment = fast_create(Comment, :body => 'Original comment', :source_id => page.id, :source_type => 'Article', :author_id => profile)
508 508  
509 509 xhr :post, :update, :id => comment.id, :profile => profile.identifier, :comment => { :body => 'Comment edited' }
510   - assert JSON.parse(@response.body)["ok"], "attribute ok expected to be true"
  510 + assert ActiveSupport::JSON.decode(@response.body)["ok"], "attribute ok expected to be true"
511 511 assert_equal 'Comment edited', Comment.find(comment.id).body
512 512 end
513 513  
... ...