test/unit/widget_test.rb in apotomo-1.1.0 vs test/unit/widget_test.rb in apotomo-1.1.1
- old
+ new
@@ -48,11 +48,11 @@
@root << @mum
assert_equal ['mum', 'kid'], @root.children.collect { |w| w.name }
end
- should "inherit callbacks for now" do
+ should "inherit callbacks" do
@berry = Class.new(@mum.class).new(@controller, 'berry', :squeak)
@root << @berry
assert_equal ['berry', 'kid'], @root.children.collect { |w| w.name }
end
@@ -91,13 +91,29 @@
@mum.visible = false
assert_not @mum.visible?
end
end
- should "respond to #find_widget" do
- mum_and_kid!
- assert_not @mum.find_widget('pet')
- assert_equal @kid, @mum.find_widget('kid')
+ context "#find_widget" do
+ setup do
+ mum_and_kid!
+ end
+
+ should "find itself" do
+ assert_equal @mum, @mum.find_widget('mum')
+ end
+
+ should "return nil for not-existant widgets" do
+ assert_nil @mum.find_widget('pet')
+ end
+
+ should "find children" do
+ assert_equal @kid, @mum.find_widget('kid')
+ end
+
+ should "find treat 'id' and :id the same" do
+ assert_equal @mum.find_widget(:kid), @mum.find_widget('kid')
+ end
end
should "respond to the WidgetShortcuts methods, like #widget" do
assert_respond_to @mum, :widget
end