+
+private
+
+ def check_trace_feed(traces)
+ assert_response :success
+ assert_template nil
+ assert_equal "application/rss+xml", @response.content_type
+ assert_select "rss", :count => 1 do
+ assert_select "channel", :count => 1 do
+ assert_select "title"
+ assert_select "description"
+ assert_select "link"
+ assert_select "image"
+ assert_select "item", :count => traces.visible.count do |items|
+ traces.visible.order("timestamp DESC").zip(items).each do |trace,item|
+ assert_select item, "title", trace.name
+ assert_select item, "link", "http://test.host/user/#{trace.user.display_name}/traces/#{trace.id}"
+ assert_select item, "guid", "http://test.host/user/#{trace.user.display_name}/traces/#{trace.id}"
+ assert_select item, "description"
+ assert_select item, "author", trace.user.display_name
+ assert_select item, "pubDate", trace.timestamp.rfc822
+ end
+ end
+ end
+ end
+ end
+
+ def check_trace_list(traces)
+ assert_response :success
+ assert_template "list"
+
+ if traces.count > 0
+ assert_select "table#trace_list tbody", :count => 1 do
+ assert_select "tr", :count => traces.visible.count do |rows|
+ traces.visible.order("timestamp DESC").zip(rows).each do |trace,row|
+ assert_select row, "span.trace_summary", Regexp.new(Regexp.escape("(#{trace.size} points)"))
+ assert_select row, "td", Regexp.new(Regexp.escape(trace.description))
+ assert_select row, "td", Regexp.new(Regexp.escape("by #{trace.user.display_name}"))
+ end
+ end
+ end
+ else
+ assert_select "h4", /Nothing here yet/
+ end
+ end