search for: statisticsreport

Displaying 2 results from an estimated 2 matches for "statisticsreport".

2008 May 08
2
Testing render :text without has_text
...o demarshall the string and compare that with the expected objects. To do this, I need RSpec to give me the complete text string that''s rendered by the controller. Here''s the controller: class StatsController < ApplicationController layout nil def query reports = StatisticsReporter.query params[:query_params] render :text => Marshal.dump(reports) end end And here''s the test: describe StatsController do before :each do @query_params = { :foo => :bar } end it "should return a demarshallable string of the reports" do reports...
2007 Feb 21
1
Rendering all the elements when calling Array#to_xml
When I call to_xml on an array, I want it to get the XML for all the elements in it. I''ve defined to_xml in my class. >> r.to_xml => "<video><id>1</id><views>2</views></video>" >> a = [r] => [#<StatisticsReport:0x3259f38 @video_id=1, @views=2>] >> a.to_xml => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<statistics-reports>\n</statistics-reports>\n" As you can see, I''ve got an array, with the lone element responding to to_xml. But when...