Changeset 1286

Show
Ignore:
Timestamp:
03/16/08 19:32:17 (8 months ago)
Author:
sandal
Message:

Now breaking everything

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ruport/branches/brian/exp-stage-data/lib/ruport/formatter.rb

    r1268 r1286  
    6565    # 
    6666    module RenderingTools 
    67       # Iterates through <tt>data</tt> and passes 
    68       # each row to render_row with the given options. 
    69       # This interface is is very inefficient, since new Renderer and 
    70       # Formatter objects are created for every row, and is deprecated. 
    71       # Iterate the rows directly within your Formatter instead. 
    72       def render_data_by_row(data,options={},&block) 
    73         data.each do |r| 
    74           render_row(r,options,&block) 
    75         end 
    76       end 
    77  
    7867      # Uses Renderer::Row to render the Row object with the 
    7968      # given options. 
  • ruport/trunk/test/csv_formatter_test.rb

    r1226 r1286  
    44class TestRenderCSVRow < Test::Unit::TestCase 
    55  def test_render_csv_row 
    6     actual = Ruport::Renderer::Row.render_csv(:data => [1,2,3]) 
     6    actual = Ruport::Controller::Row.render_csv(:data => [1,2,3]) 
    77    assert_equal("1,2,3\n", actual) 
    88  end 
     
    2525 
    2626  def test_render_csv_table 
    27     actual = Ruport::Renderer::Table.render_csv do |r|  
     27    actual = Ruport::Controller::Table.render_csv do |r|  
    2828      r.data = Table([], :data => [[1,2,3],[4,5,6]]) 
    2929    end 
    3030    assert_equal("1,2,3\n4,5,6\n",actual) 
    3131 
    32     actual = Ruport::Renderer::Table.render_csv do |r| 
     32    actual = Ruport::Controller::Table.render_csv do |r| 
    3333      r.data = Table(%w[a b c], :data => [[1,2,3],[4,5,6]]) 
    3434    end 
     
    4343 
    4444  def test_table_headers 
    45     actual = Ruport::Renderer::Table. 
     45    actual = Ruport::Controller::Table. 
    4646             render_csv(:show_table_headers => false,  
    4747                        :data => Table(%w[a b c], :data => [[1,2,3],[4,5,6]])) 
     
    5151  def test_render_with_template 
    5252    formatter = Ruport::Formatter::CSV.new 
    53     formatter.options = Ruport::Renderer::Options.new 
     53    formatter.options = Ruport::Controller::Options.new 
    5454    formatter.options.template = :simple 
    5555    formatter.apply_template 
     
    113113                                    :data => [[1,2,3],[4,5,6]], 
    114114                                    :column_names => %w[a b c]) 
    115     actual = Ruport::Renderer::Group. 
     115    actual = Ruport::Controller::Group. 
    116116             render_csv(:data => group, :show_table_headers => false ) 
    117117    assert_equal("test\n\n1,2,3\n4,5,6\n",actual) 
  • ruport/trunk/test/grouping_test.rb

    r1209 r1286  
    9898    assert_nothing_raised { @group.as(:csv) } 
    9999    assert_nothing_raised { @group.to_csv } 
    100     assert_raises(Ruport::Renderer::UnknownFormatError) { 
     100    assert_raises(Ruport::Controller::UnknownFormatError) { 
    101101      @group.as(:nothing) } 
    102     assert_raises(Ruport::Renderer::UnknownFormatError) { 
     102    assert_raises(Ruport::Controller::UnknownFormatError) { 
    103103      @group.to_nothing } 
    104104  end 
     
    380380    assert_nothing_raised { @grouping.as(:csv) } 
    381381    assert_nothing_raised { @grouping.to_csv } 
    382     assert_raises(Ruport::Renderer::UnknownFormatError) { 
     382    assert_raises(Ruport::Controller::UnknownFormatError) { 
    383383      @grouping.as(:nothing) } 
    384     assert_raises(Ruport::Renderer::UnknownFormatError) { 
     384    assert_raises(Ruport::Controller::UnknownFormatError) { 
    385385      @grouping.to_nothing } 
    386386  end 
  • ruport/trunk/test/html_formatter_test.rb

    r1277 r1286  
    2525  def test_render_html_basic 
    2626     
    27     actual = Ruport::Renderer::Table.render_html { |r| 
     27    actual = Ruport::Controller::Table.render_html { |r| 
    2828      r.data = Table([], :data => [[1,2,3],[4,5,6]]) 
    2929    }           
     
    3434                 "\t</tr>\n\t</table>\n",actual) 
    3535 
    36     actual = Ruport::Renderer::Table.render_html { |r|  
     36    actual = Ruport::Controller::Table.render_html { |r|  
    3737      r.data = Table(%w[a b c], :data => [ [1,2,3],[4,5,6]])  
    3838    } 
     
    4848  def test_render_with_template 
    4949    formatter = Ruport::Formatter::HTML.new 
    50     formatter.options = Ruport::Renderer::Options.new 
     50    formatter.options = Ruport::Controller::Options.new 
    5151    formatter.options.template = :simple 
    5252    formatter.apply_template 
     
    103103   
    104104  def test_render_html_row 
    105     actual = Ruport::Renderer::Row.render_html { |r| r.data = [1,2,3] } 
     105    actual = Ruport::Controller::Row.render_html { |r| r.data = [1,2,3] } 
    106106    assert_equal("\t\t<tr>\n\t\t\t<td>1</td>\n\t\t\t<td>2"+ 
    107107                 "</td>\n\t\t\t<td>3</td>\n\t\t</tr>\n",actual) 
     
    116116                                    :data => [[1,2,3],[4,5,6]], 
    117117                                    :column_names => %w[a b c]) 
    118     actual = Ruport::Renderer::Group.render(:html, :data => group) 
     118    actual = Ruport::Controller::Group.render(:html, :data => group) 
    119119    assert_equal "\t<p>test</p>\n"+ 
    120120      "\t<table>\n\t\t<tr>\n\t\t\t<th>a</th>\n\t\t\t<th>b</th>"+ 
     
    129129                                    :data => [[1,2,3],[4,5,6]], 
    130130                                    :column_names => %w[a b c]) 
    131     actual = Ruport::Renderer::Group.render(:html, :data => group, 
     131    actual = Ruport::Controller::Group.render(:html, :data => group, 
    132132      :show_table_headers => false) 
    133133    assert_equal "\t<p>test</p>\n\t<table>\n\t\t<tr>\n\t\t\t<td>1</td>"+ 
     
    144144    table = Table(%w[a b c]) << [1,2,3] << [1,1,3] << [2,7,9] 
    145145    g = Grouping(table,:by => "a") 
    146     actual = Ruport::Renderer::Grouping.render(:html, :data => g, 
     146    actual = Ruport::Controller::Grouping.render(:html, :data => g, 
    147147                                               :show_table_headers => false) 
    148148 
     
    156156    table = Table(%w[a b c]) << [1,2,3] << [1,1,3] << [2,7,9] 
    157157    g = Grouping(table,:by => "a") 
    158     actual = Ruport::Renderer::Grouping.render(:html, :data => g) 
     158    actual = Ruport::Controller::Grouping.render(:html, :data => g) 
    159159 
    160160    assert_equal "\t<p>1</p>\n\t<table>\n\t\t<tr>\n\t\t\t<th>b</th>\n"+ 
     
    170170    table = Table(%w[a b c]) << [1,2,3] << [1,1,3] << [2,7,9] 
    171171    g = Grouping(table,:by => "a") 
    172     actual = Ruport::Renderer::Grouping.render(:html, :data => g, 
     172    actual = Ruport::Controller::Grouping.render(:html, :data => g, 
    173173                                               :style => :justified) 
    174174 
  • ruport/trunk/test/pdf_formatter_test.rb

    r1236 r1286  
    6464  def test_render_with_template 
    6565    formatter = Ruport::Formatter::PDF.new 
    66     formatter.options = Ruport::Renderer::Options.new 
     66    formatter.options = Ruport::Controller::Options.new 
    6767    formatter.options.template = :simple 
    6868    formatter.apply_template 
     
    194194  def test_draw_table_should_not_destroy_nested_rendering_options 
    195195     f = Ruport::Formatter::PDF.new    
    196      f.options = Ruport::Renderer::Options.new  
     196     f.options = Ruport::Controller::Options.new  
    197197     f.options[:table_format] =   
    198198       { :column_options => { :heading => {:justification => :center }}} 
  • ruport/trunk/test/record_test.rb

    r1214 r1286  
    314314 
    315315      def specify_as_should_throw_proper_errors 
    316         assert_raises(Ruport::Renderer::UnknownFormatError) { @a.as(:nothing) }  
     316        assert_raises(Ruport::Controller::UnknownFormatError) { @a.as(:nothing) }  
    317317      end  
    318318     
    319319      def specify_to_format_should_throw_proper_errors 
    320         assert_raises(Ruport::Renderer::UnknownFormatError) { @a.to_nothing } 
     320        assert_raises(Ruport::Controller::UnknownFormatError) { @a.to_nothing } 
    321321      end   
    322322    end    
  • ruport/trunk/test/renderer_test.rb

    r1262 r1286  
    1515#============================================================================ 
    1616# These two renderers represent the two styles that can be used when defining 
    17 # renderers in Ruport.  The OldSchoolRenderer approach has largely been 
     17# renderers in Ruport.  The OldSchoolController approach has largely been 
    1818# deprecated, but still has uses in edge cases that we need to support. 
    1919#============================================================================ 
    2020 
    21 class OldSchoolRenderer < Ruport::Renderer 
     21class OldSchoolController < Ruport::Controller 
    2222 
    2323  def run 
     
    3131end                
    3232 
    33 class VanillaRenderer < Ruport::Renderer 
     33class VanillaController < Ruport::Controller 
    3434  stage :header,:body,:footer 
    3535end 
     
    4141class DummyText < Ruport::Formatter 
    4242   
    43   renders :text, :for => OldSchoolRenderer 
     43  renders :text, :for => OldSchoolController 
    4444   
    4545  def prepare_document 
     
    8383 
    8484class VanillaBinary < Ruport::Formatter 
    85   renders :bin, :for => VanillaRenderer 
     85  renders :bin, :for => VanillaController 
    8686  save_as_binary_file 
    8787end 
    8888 
    8989 
    90 class TestRenderer < Test::Unit::TestCase 
     90class TestController < Test::Unit::TestCase 
    9191 
    9292  def teardown 
     
    9595 
    9696  def test_trivial 
    97     actual = OldSchoolRenderer.render(:text) 
     97    actual = OldSchoolController.render(:text) 
    9898    assert_equal "header\nbody\nfooter\n", actual 
    9999  end     
     
    143143    require "stringio" 
    144144    out = StringIO.new 
    145     a = OldSchoolRenderer.render(:text) { |r| r.io = out } 
     145    a = OldSchoolController.render(:text) { |r| r.io = out } 
    146146    out.rewind 
    147147    assert_equal "header\nbody\nfooter\n", out.read 
     
    152152    f = [] 
    153153    File.expects(:open).yields(f) 
    154     a = OldSchoolRenderer.render(:text, :file => "foo.text") 
     154    a = OldSchoolController.render(:text, :file => "foo.text") 
    155155    assert_equal "header\nbody\nfooter\n", f[0] 
    156156     
    157157    f = [] 
    158158    File.expects(:open).with("blah","wb").yields(f) 
    159     VanillaRenderer.render(:bin, :file => "blah")         
     159    VanillaController.render(:bin, :file => "blah")         
    160160  end        
    161161   
     
    169169 
    170170  def test_formats 
    171     assert_equal( {}, Ruport::Renderer.formats ) 
    172     assert_equal( { :text => DummyText },OldSchoolRenderer.formats ) 
     171    assert_equal( {}, Ruport::Controller.formats ) 
     172    assert_equal( { :text => DummyText },OldSchoolController.formats ) 
    173173  end 
    174174 
    175175  def test_method_missing 
    176     actual = OldSchoolRenderer.render_text 
     176    actual = OldSchoolController.render_text 
    177177    assert_equal "header\nbody\nfooter\n", actual 
    178178  end 
     
    180180  def test_formatter 
    181181    # normal instance mode 
    182     rend = OldSchoolRenderer.new 
     182    rend = OldSchoolController.new 
    183183    rend.send(:use_formatter,:text) 
    184184 
     
    187187 
    188188    # render mode 
    189     OldSchoolRenderer.render_text do |r| 
     189    OldSchoolController.render_text do |r| 
    190190      assert_kind_of Ruport::Formatter, r.formatter 
    191191      assert_kind_of DummyText, r.formatter 
     
    199199   
    200200  def test_options_act_like_indifferent_hash 
    201      opts = Ruport::Renderer::Options.new 
     201     opts = Ruport::Controller::Options.new 
    202202     opts.foo = "bar" 
    203203     assert_equal "bar", opts[:foo] 
     
    221221  # This formatter uses the build syntax 
    222222  class UsesBuild < Ruport::Formatter 
    223      renders :text_using_build, :for => VanillaRenderer  
     223     renders :text_using_build, :for => VanillaController  
    224224      
    225225     build :header do 
     
    238238  def test_should_render_using_build_syntax 
    239239    assert_equal "header\nbody\nfooter\n", 
    240       VanillaRenderer.render_text_using_build 
    241     VanillaRenderer.render_text_using_build do |rend| 
     240      VanillaController.render_text_using_build 
     241    VanillaController.render_text_using_build do |rend| 
    242242      assert rend.formatter.respond_to?(:build_header) 
    243243      assert rend.formatter.respond_to?(:build_body) 
     
    252252  # in which a layout method is called and yielded to when defined 
    253253  class WithLayout < DummyText 
    254      renders :text_with_layout, :for => VanillaRenderer  
     254     renders :text_with_layout, :for => VanillaController  
    255255      
    256256     def layout      
     
    264264  def test_layout 
    265265     assert_equal "---\nheader\nbody\nfooter\n---\n",  
    266                   VanillaRenderer.render_text_with_layout 
     266                  VanillaController.render_text_with_layout 
    267267  end 
    268268   
    269269  def test_layout_disabled 
    270270     assert_equal "header\nbody\nfooter\n", 
    271                   VanillaRenderer.render_text_with_layout(:layout => false) 
    272   end 
    273  
    274 end 
    275  
    276  
    277 class TestRendererWithManyHooks < Test::Unit::TestCase 
    278   # This provides a way to check several hooks that Renderer supports 
    279   class RendererWithManyHooks < Ruport::Renderer 
     271                  VanillaController.render_text_with_layout(:layout => false) 
     272  end 
     273 
     274end 
     275 
     276 
     277class TestControllerWithManyHooks < Test::Unit::TestCase 
     278  # This provides a way to check several hooks that controllers supports 
     279  class ControllerWithManyHooks < Ruport::Controller 
    280280    add_format DummyText, :text 
    281281    add_format Destructive, :destructive 
     
    296296 
    297297  def test_hash_options_setters 
    298     a = RendererWithManyHooks.render(:text, :subtitle => "foo", 
     298    a = ControllerWithManyHooks.render(:text, :subtitle => "foo", 
    299299                                       :subsubtitle => "bar") { |r| 
    300300      assert_equal "foo", r.options.subtitle 
     
    304304 
    305305  def test_data_accessors 
    306    a = RendererWithManyHooks.render(:text, :data => [1,2,4]) { |r| 
     306   a = ControllerWithManyHooks.render(:text, :data => [1,2,4]) { |r| 
    307307     assert_equal [1,2,4], r.data 
    308308   } 
    309309   
    310    b = RendererWithManyHooks.render_text(%w[a b c]) { |r| 
     310   b = ControllerWithManyHooks.render_text(%w[a b c]) { |r| 
    311311     assert_equal %w[a b c], r.data 
    312312   } 
    313313   
    314    c = RendererWithManyHooks.render_text(%w[a b f],:snapper => :red) { |r| 
     314   c = ControllerWithManyHooks.render_text(%w[a b f],:snapper => :red) { |r| 
    315315     assert_equal %w[a b f], r.data 
    316316     assert_equal :red, r.options.snapper 
     
    320320  def test_formatter_data_dup 
    321321    source = "some text" 
    322     result = RendererWithManyHooks.render(:destructive, :data => source) 
     322    result = ControllerWithManyHooks.render(:destructive, :data => source) 
    323323    assert_equal("You sent some text", result) 
    324324    assert_equal("some text", source) 
     
    326326 
    327327  def test_stage_helper 
    328     assert RendererWithManyHooks.stages.include?('body') 
     328    assert ControllerWithManyHooks.stages.include?('body') 
    329329  end 
    330330  
    331331  def test_finalize_helper 
    332     assert_equal :document, RendererWithManyHooks.final_stage 
     332    assert_equal :document, ControllerWithManyHooks.final_stage 
    333333  end 
    334334 
    335335  def test_prepare_helper 
    336    assert_equal :document, RendererWithManyHooks.first_stage 
     336   assert_equal :document, ControllerWithManyHooks.first_stage 
    337337  end 
    338338 
    339339  def test_finalize_again 
    340    assert_raise(Ruport::Renderer::StageAlreadyDefinedError) {  
    341      RendererWithManyHooks.finalize :report  
     340   assert_raise(Ruport::Controller::StageAlreadyDefinedError) {  
     341     ControllerWithManyHooks.finalize :report  
    342342   } 
    343343  end 
    344344 
    345345  def test_prepare_again 
    346    assert_raise(Ruport::Renderer::StageAlreadyDefinedError) {  
    347      RendererWithManyHooks.prepare :foo  
     346   assert_raise(Ruport::Controller::StageAlreadyDefinedError) {  
     347     ControllerWithManyHooks.prepare :foo  
    348348   } 
    349349  end 
    350350 
    351351  def test_renderer_using_helpers 
    352    actual = RendererWithManyHooks.render(:text) 
     352   actual = ControllerWithManyHooks.render(:text) 
    353353   assert_equal "pheader\nbody\nfooter\nf", actual 
    354354 
    355    actual = RendererWithManyHooks.render_text 
     355   actual = ControllerWithManyHooks.render_text 
    356356   assert_equal "pheader\nbody\nfooter\nf", actual 
    357357  end 
    358358 
    359359  def test_required_option_helper 
    360    a = RendererWithManyHooks.dup 
     360   a = ControllerWithManyHooks.dup 
    361361   a.required_option :title 
    362362 
     
    369369 
    370370  def test_without_required_option 
    371    a = RendererWithManyHooks.dup 
     371   a = ControllerWithManyHooks.dup 
    372372   a.required_option :title 
    373373 
    374    assert_raise(Ruport::Renderer::RequiredOptionNotSet) { a.render(:text) } 
     374   assert_raise(Ruport::Controller::RequiredOptionNotSet) { a.render(:text) } 
    375375  end 
    376376  
     
    378378 
    379379 
    380 class TestRendererWithRunHook < Test::Unit::TestCase 
    381  
    382   class RendererWithRunHook < Ruport::Renderer 
     380class TestControllerWithRunHook < Test::Unit::TestCase 
     381 
     382  class ControllerWithRunHook < Ruport::Controller 
    383383    add_format DummyText, :text 
    384384 
     
    397397  def test_renderer_with_run_hooks 
    398398    assert_equal "|header\nbody\nfooter\n",  
    399        RendererWithRunHook.render_text(:foo => "bar",:bar => "baz") 
    400   end 
    401  
    402 end 
    403  
    404  
    405 class TestRendererWithHelperModule < Test::Unit::TestCase 
    406  
    407   class RendererWithHelperModule < VanillaRenderer 
     399       ControllerWithRunHook.render_text(:foo => "bar",:bar => "baz") 
     400  end 
     401 
     402end 
     403 
     404 
     405class TestControllerWithHelperModule < Test::Unit::TestCase 
     406 
     407  class ControllerWithHelperModule < VanillaController 
    408408 
    409409    add_format DummyText, :stub 
     
    417417 
    418418  def test_renderer_helper_module 
    419     RendererWithHelperModule.render_stub do |r| 
     419    ControllerWithHelperModule.render_stub do |r| 
    420420      assert_equal "Hello Dolly", r.formatter.say_hello 
    421421    end 
     
    425425 
    426426class TestMultiPurposeFormatter < Test::Unit::TestCase 
    427   # This provides a way to check the multi-format hooks for the Renderer 
     427  # This provides a way to check the multi-format hooks for the Controller 
    428428  class MultiPurposeFormatter < Ruport::Formatter  
    429429 
    430      renders [:html,:text], :for => VanillaRenderer 
     430     renders [:html,:text], :for => VanillaController 
    431431 
    432432     def build_header 
     
    446446 
    447447  def test_multi_purpose 
    448     text = VanillaRenderer.render_text(:body_text => "foo") 
     448    text = VanillaController.render_text(:body_text => "foo") 
    449449    assert_equal "Foo: 10\nfoo", text 
    450     html = VanillaRenderer.render_html(:body_text => "bar") 
     450    html = VanillaController.render_html(:body_text => "bar") 
    451451    assert_equal "<b>Foo: 10</b>\n<pre>\nbar\n</pre>\n",html 
    452452  end 
     
    479479  class ErbFormatter < Ruport::Formatter 
    480480      
    481     renders :terb, :for  => VanillaRenderer 
     481    renders :terb, :for  => VanillaController 
    482482     
    483483    def build_body     
     
    497497 
    498498   def test_self_bound 
    499      assert_equal "Default Binding: bar", VanillaRenderer.render_terb 
     499     assert_equal "Default Binding: bar", VanillaController.render_terb 
    500500   end 
    501501    
     
    504504     arr_binding = a.instance_eval { binding } 
    505505     assert_equal "Binding Override: 321",  
    506                    VanillaRenderer.render_terb(:binding => arr_binding) 
     506                   VanillaController.render_terb(:binding => arr_binding) 
    507507   end 
    508508end     
     
    511511class TestOptionReaders < Test::Unit::TestCase 
    512512   
    513   class RendererForCheckingOptionReaders < Ruport::Renderer 
     513  class ControllerForCheckingOptionReaders < Ruport::Controller 
    514514    required_option :foo   
    515515  end  
    516516   
    517   class RendererForCheckingPassivity < Ruport::Renderer 
     517  class ControllerForCheckingPassivity < Ruport::Controller 
    518518    def foo 
    519519      "apples" 
     
    523523 
    524524   def setup  
    525      @renderer = RendererForCheckingOptionReaders.new  
     525     @renderer = ControllerForCheckingOptionReaders.new  
    526526     @renderer.formatter = Ruport::Formatter.new  
    527527      
    528      @passive = RendererForCheckingPassivity.new 
     528     @passive = ControllerForCheckingPassivity.new 
    529529     @passive.formatter = Ruport::Formatter.new 
    530530   end 
     
    546546class TestSetupOrdering < Test::Unit::TestCase 
    547547    
    548   class RendererWithSetup < Ruport::Renderer 
     548  class ControllerWithSetup < Ruport::Controller 
    549549    stage :bar 
    550550    def setup 
     
    554554   
    555555  class BasicFormatter < Ruport::Formatter  
    556     renders :text, :for => RendererWithSetup 
     556    renders :text, :for => ControllerWithSetup 
    557557     
    558558    def build_bar 
     
    562562   
    563563  def test_render_hash_options_should_be_called_before_setup 
    564     assert_equal "Hello", RendererWithSetup.render_text(:foo => "hello") 
     564    assert_equal "Hello", ControllerWithSetup.render_text(:foo => "hello") 
    565565  end        
    566566   
    567567  def test_render_block_should_be_called_before_setup 
    568568    assert_equal "Hello",  
    569       RendererWithSetup.render_text { |r| r.options.foo = "hello" } 
    570   end 
    571    
    572 end 
    573  
    574 class TestRendererHooks < Test::Unit::TestCase 
     569      ControllerWithSetup.render_text { |r| r.options.foo = "hello" } 
     570  end 
     571   
     572end 
     573 
     574class TestControllerHooks < Test::Unit::TestCase 
    575575 
    576576  context "when renderable_data omitted" do 
     
    579579 
    580580    class DummyObject  
    581       include Ruport::Renderer::Hooks 
     581      include Ruport::Controller::Hooks 
    582582      renders_as_table 
    583583    end 
     
    587587      rend = mock("renderer") 
    588588      rend.expects(:data=).with(a) 
    589       Ruport::Renderer::Table.expects(:render).with(:csv,{}).yields(rend) 
     589      Ruport::Controller::Table.expects(:render).with(:csv,{}).yields(rend) 
    590590      a.as(:csv) 
    591591    end 
     
    596596 
    597597    class DummyObject2 
    598       include Ruport::Renderer::Hooks 
     598      include Ruport::Controller::Hooks 
    599599      renders_as_table 
    600600 
     
    608608      rend = mock("renderer") 
    609609      rend.expects(:data=).with(1) 
    610       Ruport::Renderer::Table.expects(:render).with(:csv,{}).yields(rend) 
     610      Ruport::Controller::Table.expects(:render).with(:csv,{}).yields(rend) 
    611611      a.as(:csv) 
    612612    end 
    613613 
    614614    class DummyObject3 
    615       include Ruport::Renderer::Hooks 
     615      include Ruport::Controller::Hooks 
    616616      renders_as_table 
    617617       
     
    626626 
    627627    class DummyObject4 
    628       include Ruport::Renderer::Hooks 
     628      include Ruport::Controller::Hooks 
    629629      renders_as_table 
    630630 
     
    643643      rend = mock("renderer") 
    644644      rend.expects(:data=).with(2) 
    645       Ruport::Renderer::Table.expects(:render).with(:csv,{}).yields(rend) 
     645      Ruport::Controller::Table.expects(:render).with(:csv,{}).yields(rend) 
    646646      a.as(:csv) 
    647647    end 
     
    653653    def specify_an_unknown_format_error_should_be_raised 
    654654 
    655       assert_raises(Ruport::Renderer::UnknownFormatError) do 
    656         Ruport::Renderer.render_foo 
     655      assert_raises(Ruport::Controller::UnknownFormatError) do 
     656        Ruport::Controller.render_foo 
    657657      end 
    658658 
  • ruport/trunk/test/table_test.rb

    r1210 r1286  
    439439                                    :data => [[1,2],[3,4],[5,6]] 
    440440    assert_equal("a,b\n1,2\n3,4\n5,6\n",table.to_csv) 
    441     assert_raises(Ruport::Renderer::UnknownFormatError) { table.to_nothing } 
     441    assert_raises(Ruport::Controller::UnknownFormatError) { table.to_nothing } 
    442442  end 
    443443 
     
    446446    assert_nothing_raised { a.as(:csv) } 
    447447    assert_nothing_raised { a.to_csv } 
    448     assert_raises(Ruport::Renderer::UnknownFormatError) { a.as(:nothing) } 
    449     assert_raises(Ruport::Renderer::UnknownFormatError) { a.to_nothing } 
     448    assert_raises(Ruport::Controller::UnknownFormatError) { a.as(:nothing) } 
     449    assert_raises(Ruport::Controller::UnknownFormatError) { a.to_nothing } 
    450450  end 
    451451     
  • ruport/trunk/test/text_formatter_test.rb

    r1226 r1286  
    8080  def test_render_with_template 
    8181    formatter = Ruport::Formatter::Text.new 
    82     formatter.options = Ruport::Renderer::Options.new 
     82    formatter.options = Ruport::Controller::Options.new 
    8383    formatter.options.template = :simple 
    8484    formatter.apply_template 
     
    166166 
    167167  def test_row_basic 
    168     actual = Ruport::Renderer::Row.render_text(:data => [1,2,3]) 
     168    actual = Ruport::Controller::Row.render_text(:data => [1,2,3]) 
    169169    assert_equal("| 1 | 2 | 3 |\n", actual) 
    170170  end 
     
    181181                                    :column_names => %w[i hope so]) 
    182182 
    183     actual = Ruport::Renderer::Group.render_text(:data => group) 
     183    actual = Ruport::Controller::Group.render_text(:data => group) 
    184184    expected = "test:\n\n"+ 
    185185               "+------------------------------+\n"+ 
     
    198198                                   :column_names => %w[i hope so]) 
    199199    
    200     actual = Ruport::Renderer::Group.render(:text, :data => group, 
     200    actual = Ruport::Controller::Group.render(:text, :data => group, 
    201201      :show_table_headers => false ) 
    202202    expected = "test:\n\n"+ 
     
    218218    grouping = Grouping(table, :by => "i") 
    219219 
    220     actual = Ruport::Renderer::Grouping.render(:text, :data => grouping) 
     220    actual = Ruport::Controller::Grouping.render(:text, :data => grouping) 
    221221    expected = "interesting:\n\n"+ 
    222222               "+----------------+\n"+ 
     
    243243    grouping = Grouping(table, :by => "i") 
    244244 
    245     actual = Ruport::Renderer::Grouping.render(:text, :data => grouping, 
     245    actual = Ruport::Controller::Grouping.render(:text, :data => grouping, 
    246246      :show_table_headers => false) 
    247247    expected = "interesting:\n\n"+