Permalink
Browse files

Merge branch 'master' of github.com:apotonick/apotomo

  • Loading branch information...
2 parents 77a2ca1 + 76706ed commit c6c26f67dde9be18847f97d5616e2c1a312d2aa1 @apotonick committed Feb 17, 2012
Showing with 39 additions and 41 deletions.
  1. +1 −1 README.rdoc
  2. +38 −40 lib/apotomo/test_case.rb
View
@@ -44,7 +44,7 @@ Let's wrap that comments block in a widget.
Go and generate a widget stub.
- $ rails generate apotomo:widget CommentsWidget display write -e haml
+ $ rails generate apotomo:widget Comments display write -e haml
create app/cells/
create app/cells/comments_widget
create app/cells/comments_widget.rb
View
@@ -34,54 +34,52 @@ class TestCase < Cell::TestCase # TODO: re-arrange modules in Cell::TestCase and
module TestMethods
extend ActiveSupport::Concern
- module InstanceMethods
- include Cell::TestCase::CommonTestMethods
+ include Cell::TestCase::CommonTestMethods
+
+ attr_reader :view_assigns
+
+ def setup
+ super # defined in Cell::TestCase::CommonTestMethods.
- attr_reader :view_assigns
-
- def setup
- super # defined in Cell::TestCase::CommonTestMethods.
-
- @controller.instance_eval do
- def controller_path
- 'barn'
- end
+ @controller.instance_eval do
+ def controller_path
+ 'barn'
end
- @controller.extend Apotomo::Rails::ControllerMethods
end
-
- # Renders the widget +name+.
- def render_widget(*args)
- @view_assigns = extract_state_ivars_for(root[args.first]) do
- @last_invoke = root.render_widget(*args)
- end
-
- @last_invoke
+ @controller.extend Apotomo::Rails::ControllerMethods
+ end
+
+ # Renders the widget +name+.
+ def render_widget(*args)
+ @view_assigns = extract_state_ivars_for(root[args.first]) do
+ @last_invoke = root.render_widget(*args)
end
+
+ @last_invoke
+ end
- # Triggers an event of +type+. You have to pass the +source+ as second options.
- #
- # Example:
- #
- # trigger :submit, :comments
- def trigger(type, source, options={})
- source = root.find_widget(source)
- source.fire(type, options)
- root.page_updates
- end
+ # Triggers an event of +type+. You have to pass the +source+ as second options.
+ #
+ # Example:
+ #
+ # trigger :submit, :comments
+ def trigger(type, source, options={})
+ source = root.find_widget(source)
+ source.fire(type, options)
+ root.page_updates
+ 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 has_widgets()"
- @root ||= Apotomo::Widget.new(parent_controller, "root").tap do |root|
- self.instance_exec(root, &blk)
- end
- end
-
- def parent_controller
- @controller
+ # Returns the widget tree from TestCase.has_widgets.
+ def root
+ blk = self.class.has_widgets_blocks or raise "Please setup a widget tree using has_widgets()"
+ @root ||= Apotomo::Widget.new(parent_controller, "root").tap do |root|
+ self.instance_exec(root, &blk)
end
end
+
+ def parent_controller
+ @controller
+ end
module ClassMethods
def has_widgets_blocks

0 comments on commit c6c26f6

Please sign in to comment.