test/support/test_case_methods.rb in apotomo-1.0.5 vs test/support/test_case_methods.rb in apotomo-1.1.0.rc1
- old
+ new
@@ -1,23 +1,23 @@
module Apotomo
module TestCaseMethods
# Provides a ready-to-use mouse widget instance.
- def mouse_mock(id='mouse', start_state=:eating, opts={}, &block)
- mouse = MouseCell.new(parent_controller, id, start_state, opts)
+ def mouse_mock(id='mouse', opts={}, &block)
+ mouse = MouseWidget.new(parent_controller, id, opts)
mouse.instance_eval &block if block_given?
mouse
end
def mouse_class_mock(&block)
- klass = Class.new(MouseCell)
+ klass = Class.new(MouseWidget)
klass.instance_eval &block if block_given?
klass
end
def mum_and_kid!
- @mum = mouse_mock('mum', :answer_squeak)
- @mum << @kid = mouse_mock('kid', :peek)
+ @mum = mouse_mock('mum')
+ @mum << @kid = mouse_mock('kid')
@mum.respond_to_event :squeak, :with => :answer_squeak
@mum.respond_to_event :squeak, :from => 'kid', :with => :alert
@mum.respond_to_event :footsteps, :with => :escape
@@ -41,28 +41,14 @@
def barn_controller!
@controller = Class.new(ActionController::Base) do
def self.default_url_options; {:controller => :barn}; end
end.new
- @controller.class.instance_eval { include Apotomo::Rails::ControllerMethods }
@controller.extend ActionController::UrlWriter
@controller.params = {}
- ### FIXME: @controller.session = {}
end
- def hibernate_widget(widget, session = {})
- Apotomo::StatefulWidget.freeze_for(session, widget)
-
- session = Marshal.load(Marshal.dump(session))
-
- Apotomo::StatefulWidget.thaw_for(@controller, session, )
- end
-
- def hibernate(widget, session = {})
- Apotomo::StatefulWidget.freeze_for(session, widget)
- session = Marshal.load(Marshal.dump(session))
- Apotomo::StatefulWidget.thaw_for(session, widget('apotomo/widget', 'root'))
- end
+
module TestController
def setup
barn_controller!
end