lib/apotomo/test_case.rb in apotomo-1.0.5 vs lib/apotomo/test_case.rb in apotomo-1.1.0.rc1
- old
+ new
@@ -40,42 +40,42 @@
end
def setup
super
@controller.instance_eval do
- def controller_name
+ def controller_path
'barn'
end
end
@controller.extend Apotomo::Rails::ControllerMethods
end
# Returns the widget tree from TestCase.has_widgets.
def root
blk = self.class.has_widgets_blocks or raise "Please setup a widget tree using TestCase.has_widgets"
- @root ||= widget("apotomo/widget", "root").tap do |root|
+ @root ||= Apotomo::Widget.new(parent_controller, "root").tap do |root|
self.instance_exec(root, &blk)
end
end
def parent_controller
@controller
end
# Renders the widget +name+.
- def render_widget(name, options={})
- @last_invoke = root.find_widget(name).tap { |w| w.opts = options }.invoke # DISCUSS: use ControllerMethods?
+ def render_widget(*args)
+ @last_invoke = root.render_widget(*args)
end
# Triggers an event of +type+. You have to pass <tt>:source</tt> as options.
#
# Example:
#
# trigger :submit, :source => "post-comments"
def trigger(type, options)
source = root.find_widget(options.delete(:source))
- source.instance_variable_set :@params, options # TODO: this is just a try-out (what about children?).
+ source.options.merge!(options) # TODO: this is just a try-out (what about children?).
source.fire(type)
root.page_updates # DISCUSS: use ControllerMethods?
end
# After a #trigger this assertion compares the actually triggered page updates with the passed.