From 0f3a63125e711e41e858a21b4a1e00db4bff7ef2 Mon Sep 17 00:00:00 2001 From: Junior Silva Date: Fri, 10 Jan 2014 19:34:33 -0300 Subject: [PATCH] versioned_article: using diff to show differences between versions of article --- app/controllers/public/content_viewer_controller.rb | 8 ++++++++ test/functional/content_viewer_controller_test.rb | 4 ++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index cb2eacf..b036eb6 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -1,3 +1,5 @@ +require 'diffy' + class ContentViewerController < ApplicationController needs_profile @@ -149,3 +151,9 @@ class ContentViewerController < ApplicationController helper_method :pass_without_comment_captcha? end + + def versioning_articles(article1, article2) + Diffy::Diff.new('article1', 'article2', :source => 'files').to_s(:html) + end + + diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index a3ee3aa..55a066b 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -1194,6 +1194,10 @@ class ContentViewerControllerTest < ActionController::TestCase assert_not_includes Article.find(article.id).followers, follower_email end + should 'display differences between article versions' do + Article.versioning_articles('/files/test.txt','/files/test.txt') + end + should 'not display comments marked as spam' do article = fast_create(Article, :profile_id => profile.id) ham = fast_create(Comment, :source_id => article.id, :source_type => 'Article', :title => 'some content') -- libgit2 0.21.2