Files

Class Index [+]

Quicksearch

UbiquoDesign::Extensions::TestHelper

Public Instance Methods

create_test_page(type, widget_options) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/extensions/test_helper.rb, line 43
43:       def create_test_page(type, widget_options)
44:         widget = type.to_s.classify.constantize.new(widget_options)
45:         block = Block.new(:block_type => 'test')
46: 
47:         default_page_options = {
48:           :name => 'Test page',
49:           :url_name => rand.to_s[2..-1],
50:           :page_template => 'test',
51:           :published_id => nil,
52:         }
53:         page = Page.create!(default_page_options)
54:         widget.block = block
55:         page.blocks << block
56:         [widget, page]
57:       end
insert_widget_in_page(type, widget_options) click to toggle source

Create a widget for testing

A page and a block are created on-the-fly, so there is no need to create fixtures for each widget

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/extensions/test_helper.rb, line 35
35:       def insert_widget_in_page(type, widget_options)
36:         widget_options.reverse_merge!(:name => 'TestWidget')
37:         widget, page = create_test_page(type, widget_options)
38:         assert widget.save, "Widget has errors (attributes: #{widget.options.inspect})"
39:         page.publish
40:         [widget, page]
41:       end
run_generator(name, widget, options) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/extensions/test_helper.rb, line 20
20:       def  run_generatorrun_generator(name, widget, options)
21:         @controller.stubs(:session).returns(@controller.request.session)
22:         @controller.send(name.to_s+"_generator", widget, options)
23:       end
run_menu_generator(name, options) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/extensions/test_helper.rb, line 25
25:       def run_menu_generator(name, options)
26:         @controller.stubs(:session).returns(@controller.request.session)
27:         @controller.send(name.to_s+"_generator", options)
28:       end
template_mock(page) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_design/lib/ubiquo_design/extensions/test_helper.rb, line 10
10:       def  template_mocktemplate_mock(page)
11:         def @controller.render_template_file(*args)
12:           template_file = File.join(ActiveSupport::TestCase.fixture_path, "templates", "test", "public.html.erb")
13:           render :file => template_file
14:         end
15:         @controller.class.send(:define_method, :render_page_to_string) do
16:           render_to_string :file => File.join(ActiveSupport::TestCase.fixture_path, "templates", "test", "ubiquo.html.erb"), :locals => {:page => page}
17:         end
18:       end
widget_form_mock() click to toggle source

(Not documented)

   # File vendor/plugins/ubiquo_design/lib/ubiquo_design/extensions/test_helper.rb, line 4
4:       def widget_form_mock
5:         def @controller.render_widget_form(*args)
6:           render :inline => "Hi"
7:         end
8:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.