Commit fc87be858c7037046e69972d1987a55cabb2c165

Authored by MoisesMachado
1 parent c53dd5e3

ActionItem193: tested the exclusion of non text arguments of the recent documents list


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1536 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 15 additions and 7 deletions   Show diff stats
test/unit/recent_documents_block_test.rb
... ... @@ -3,18 +3,16 @@ require File.dirname(__FILE__) + '/../test_helper'
3 3 class RecentDocumentsBlockTest < Test::Unit::TestCase
4 4  
5 5 def setup
6   - profile = create_user('testinguser').person
7   - profile.articles.build(:name => 'first').save!
8   - profile.articles.build(:name => 'second').save!
9   - profile.articles.build(:name => 'third').save!
10   - profile.articles.build(:name => 'fourth').save!
11   - profile.articles.build(:name => 'fifth').save!
  6 + @profile = create_user('testinguser').person
  7 + ['first', 'second', 'third', 'fourth', 'fifth'].each do |name|
  8 + @profile.articles << TextArticle.create(:name => name)
  9 + end
12 10  
13 11 box = Box.create!(:owner => profile)
14 12 @block = RecentDocumentsBlock.create!(:box_id => box.id)
15 13  
16 14 end
17   - attr_reader :block
  15 + attr_reader :block, :profile
18 16  
19 17 should 'describe itself' do
20 18 assert_not_equal Block.description, RecentDocumentsBlock.description
... ... @@ -42,4 +40,14 @@ class RecentDocumentsBlockTest &lt; Test::Unit::TestCase
42 40 assert_no_match /href=.*\/testinguser\/first/, output
43 41 end
44 42  
  43 + should 'not list rss feed articles' do
  44 + profile.articles << RssFeed.create(:name => 'sixth')
  45 + profile.save!
  46 +
  47 + output = block.content
  48 +
  49 + assert_match /href=.*\/testinguser\/first/, output
  50 + assert_no_match /href=.*\/testinguser\/sixth/, output
  51 + end
  52 +
45 53 end
... ...