rss_feed_test.rb
1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require File.dirname(__FILE__) + '/../test_helper'
class RssFeedTest < Test::Unit::TestCase
should 'indicate the correct mime/type' do
assert_equal 'text/xml', RssFeed.new.mime_type
end
should 'store settings in a hash serialized into body field' do
feed = RssFeed.new
assert_kind_of Hash, feed.body
feed.body = {
:include => :abstract,
:search => :parent,
}
feed.valid?
assert !feed.errors.invalid?(:body)
end
should 'list recent articles of profile when top-level' do
profile = create_user('testuser').person
a1 = profile.articles.build(:name => 'article 1'); a1.save!
a2 = profile.articles.build(:name => 'article 2'); a2.save!
a3 = profile.articles.build(:name => 'article 3'); a3.save!
feed = RssFeed.new(:name => 'feed')
feed.profile = profile
feed.save!
rss = feed.data
assert_match /<title>article 1<\/title>/, rss
assert_match /<title>article 2<\/title>/, rss
assert_match /<title>article 3<\/title>/, rss
end
should 'list recent article from parent article' do
profile = create_user('testuser').person
feed = RssFeed.new
feed.expects(:profile).returns(profile).at_least_once
array = []
profile.expects(:recent_documents).returns(array)
feed.data
end
should 'be able to choose to put abstract or entire body on feed' do
flunk 'pending'
end
should 'be able to choose search in all articles or in subarticles of parent' do
flunk 'pending'
end
should 'be able to indicate maximum number of items' do
flunk 'pending'
end
end