RSS feeds accept query parameter start, end and limit

This commit is contained in:
Alexey Verkhovsky 2005-02-18 02:24:16 +00:00
parent 5e25a94e51
commit aa95acb4f7
4 changed files with 73 additions and 6 deletions

View file

@ -344,7 +344,6 @@ class WikiControllerTest < Test::Unit::TestCase
assert_equal @home.revisions[0], r.template_objects['revision']
end
def test_rss_with_content
setup_wiki_with_three_pages
@ -388,6 +387,45 @@ class WikiControllerTest < Test::Unit::TestCase
assert_template_xpath_match '/rss/channel/item/link', expected_page_links
end
def test_rss_with_params
setup_wiki_with_30_pages
r = process 'rss_with_headlines', 'web' => 'wiki1'
assert_success
pages = r.template_objects['pages_by_revision']
assert_equal 15, pages.size, 15
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => '5'
assert_success
pages = r.template_objects['pages_by_revision']
assert_equal 5, pages.size
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => '25'
assert_success
pages = r.template_objects['pages_by_revision']
assert_equal 25, pages.size
r = process 'rss_with_headlines', 'web' => 'wiki1', 'limit' => 'all'
assert_success
pages = r.template_objects['pages_by_revision']
assert_equal 31, pages.size
r = process 'rss_with_headlines', 'web' => 'wiki1', 'start' => '1976-10-16'
assert_success
pages = r.template_objects['pages_by_revision']
assert_equal 16, pages.size
r = process 'rss_with_headlines', 'web' => 'wiki1', 'end' => '1976-10-16'
assert_success
pages = r.template_objects['pages_by_revision']
assert_equal 15, pages.size
r = process 'rss_with_headlines', 'web' => 'wiki1', 'start' => '1976-10-01', 'end' => '1976-10-06'
assert_success
pages = r.template_objects['pages_by_revision']
assert_equal 5, pages.size
end
def test_save
r = process 'save', 'web' => 'wiki1', 'id' => 'NewPage', 'content' => 'Contents of a new page',
'author' => 'AuthorOfNewPage'

View file

@ -45,6 +45,13 @@ class Test::Unit::TestCase
10.minutes.ago, Author.new('Guest', '127.0.0.2'))
end
def setup_wiki_with_30_pages
(1..30).each { |i|
@wiki.write_page('wiki1', "page#{i}", "Test page #{i}\ncategory: test",
Time.local(1976, 10, i, 12, 00, 00), Author.new('Dema', '127.0.0.2'))
}
end
def tear_down_wiki
ApplicationController.wiki = nil
end