add tests for feeds

and reorganize existing tests
This commit is contained in:
Carsten Otto 2016-06-03 23:38:17 +02:00
parent 6bc9151400
commit d7aa83b747
2 changed files with 233 additions and 69 deletions

View file

@ -89,7 +89,29 @@ class ActionController::TestCase
@html_document = xml_document
assert_select(*args, &block)
end
def assert_number_of_items_in_rss_feed(expected)
assert_xml_select 'rss[version="2.0"]' do
assert_select 'channel' do
assert_select 'item', expected
end
end
end
def assert_number_of_items_in_atom_feed(expected)
assert_xml_select 'feed[xmlns="http://www.w3.org/2005/Atom"]' do
assert_xml_select 'entry', expected
end
end
def assert_number_of_items_in_text_feed(expected)
assert_equal expected, @response.body.scan(/^ \- /).size
end
def assert_number_of_items_in_ical_feed(expected)
assert_equal expected, @response.body.scan(/^BEGIN:VTODO/).size
end
private
def get_model_class