Commit b1514d3c42736bd671b4e302b89d5f51ebcf4c51

Authored by Junior Silva
1 parent 1221eda4

article-version: writing tests to versions_diff

AI2822
test/functional/content_viewer_controller_test.rb
... ... @@ -398,6 +398,16 @@ class ContentViewerControllerTest < ActionController::TestCase
398 398 assert_tag :tag => 'div', :attributes => { :class => /article-body/ }, :content => /edited article/
399 399 end
400 400  
  401 + should 'display differences between article version' do
  402 + page = TextArticle.create!(:name => 'myarticle', :body => 'original article', :display_versions => true, :profile => profile)
  403 + page.body = 'edited article'; page.save
  404 +
  405 + get :versions_diff, :profile => profile.identifier, :page => [ 'myarticle' ], :version => 1
  406 +
  407 + assert_tag :tag => 'div', :attributes => { :class => /article/ }, :content => /edited article/
  408 +
  409 + end
  410 +
401 411 should 'not return an article of a different user' do
402 412 p1 = create_user('test_user').person
403 413 a = p1.articles.create!(:name => 'old-name')
... ... @@ -1246,26 +1256,6 @@ class ContentViewerControllerTest < ActionController::TestCase
1246 1256 assert_not_includes Article.find(article.id).followers, follower_email
1247 1257 end
1248 1258  
1249   - should 'display differences between article versions' do
1250   - blog = Blog.create!(:name => 'A blog test', :profile => profile)
1251   - blog.posts << TinyMceArticle.create!(
1252   - :name => 'Post1',
1253   - :profile => profile,
1254   - :parent => blog,
1255   - :published => true,
1256   - :body => "<p>This is a <strong>bold</strong> statement right there!</p>"
1257   - )
1258   -
1259   - blog.posts << TinyMceArticle.create!(
1260   - :name => 'Post2',
1261   - :profile => profile,
1262   - :parent => blog,
1263   - :published => true,
1264   - :body => "<p>That is a <strong>bold</strong> statement right there!</p>"
1265   - )
1266   - @controller.differences_between_article_versions('Post1','Post2')
1267   - end
1268   -
1269 1259 should 'not display comments marked as spam' do
1270 1260 article = fast_create(Article, :profile_id => profile.id)
1271 1261 ham = fast_create(Comment, :source_id => article.id, :source_type => 'Article', :title => 'some content')
... ...