Commit 0f3a63125e711e41e858a21b4a1e00db4bff7ef2

Authored by Junior Silva
1 parent 28a75f78

versioned_article: using diff to show differences between versions of

article

AI2822
app/controllers/public/content_viewer_controller.rb
  1 +require 'diffy'
  2 +
1 3 class ContentViewerController < ApplicationController
2 4  
3 5 needs_profile
... ... @@ -149,3 +151,9 @@ class ContentViewerController &lt; ApplicationController
149 151 helper_method :pass_without_comment_captcha?
150 152  
151 153 end
  154 +
  155 + def versioning_articles(article1, article2)
  156 + Diffy::Diff.new('article1', 'article2', :source => 'files').to_s(:html)
  157 + end
  158 +
  159 +
... ...
test/functional/content_viewer_controller_test.rb
... ... @@ -1194,6 +1194,10 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
1194 1194 assert_not_includes Article.find(article.id).followers, follower_email
1195 1195 end
1196 1196  
  1197 + should 'display differences between article versions' do
  1198 + Article.versioning_articles('/files/test.txt','/files/test.txt')
  1199 + end
  1200 +
1197 1201 should 'not display comments marked as spam' do
1198 1202 article = fast_create(Article, :profile_id => profile.id)
1199 1203 ham = fast_create(Comment, :source_id => article.id, :source_type => 'Article', :title => 'some content')
... ...