test/rails/controller_methods_test.rb in apotomo-1.0.0.beta1 vs test/rails/controller_methods_test.rb in apotomo-1.0.0.beta2

- old
+ new

@@ -20,10 +20,14 @@ assert_kind_of Apotomo::RequestProcessor, @controller.apotomo_request_processor assert_equal 1, @controller.apotomo_request_processor.root.size end end + should "respond to parent_controller" do + assert_equal @controller, @controller.send(:parent_controller) + end + context "invoking #has_widgets" do setup do @controller.class.has_widgets do |root| root << widget(:mouse_cell, 'mum') end @@ -56,16 +60,19 @@ assert @sub_controller.apotomo_root['mum'] assert @sub_controller.apotomo_root['berry'] end - should "be aliased to has_widgets" do + should "be executed in controller context" do + @controller.instance_eval do + def roomies; ['mice', 'cows']; end + end + @controller.class.has_widgets do |root| - root << widget(:mouse_cell, 'kid') + root << widget(:mouse_cell, 'kid', :display, :roomies => roomies) end - assert @controller.apotomo_root['mum'] - assert @controller.apotomo_root['kid'] + assert_equal ['mice', 'cows'], @controller.apotomo_root['kid'].opts[:roomies] end end context "invoking #use_widgets" do should "have an empty apotomo_root if no call happened, yet" do