(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
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
(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
(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
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.