From b1514d3c42736bd671b4e302b89d5f51ebcf4c51 Mon Sep 17 00:00:00 2001 From: Junior Silva Date: Wed, 19 Mar 2014 14:55:47 -0300 Subject: [PATCH] article-version: writing tests to versions_diff AI2822 --- test/functional/content_viewer_controller_test.rb | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 23f3bf1..c6028c3 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -398,6 +398,16 @@ class ContentViewerControllerTest < ActionController::TestCase assert_tag :tag => 'div', :attributes => { :class => /article-body/ }, :content => /edited article/ end + should 'display differences between article version' do + page = TextArticle.create!(:name => 'myarticle', :body => 'original article', :display_versions => true, :profile => profile) + page.body = 'edited article'; page.save + + get :versions_diff, :profile => profile.identifier, :page => [ 'myarticle' ], :version => 1 + + assert_tag :tag => 'div', :attributes => { :class => /article/ }, :content => /edited article/ + + end + should 'not return an article of a different user' do p1 = create_user('test_user').person a = p1.articles.create!(:name => 'old-name') @@ -1246,26 +1256,6 @@ class ContentViewerControllerTest < ActionController::TestCase assert_not_includes Article.find(article.id).followers, follower_email end - should 'display differences between article versions' do - blog = Blog.create!(:name => 'A blog test', :profile => profile) - blog.posts << TinyMceArticle.create!( - :name => 'Post1', - :profile => profile, - :parent => blog, - :published => true, - :body => "

This is a bold statement right there!

" - ) - - blog.posts << TinyMceArticle.create!( - :name => 'Post2', - :profile => profile, - :parent => blog, - :published => true, - :body => "

That is a bold statement right there!

" - ) - @controller.differences_between_article_versions('Post1','Post2') - 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