test/unit/widget_test.rb in apotomo-1.0.1 vs test/unit/widget_test.rb in apotomo-1.0.2
- old
+ new
@@ -73,10 +73,15 @@
end
should "accept arbitrary options" do
assert_equal({:volume=>"loud", :source=>"mum", :type=>:squeak, :controller=>"barn"}, @mum.address_for_event(:squeak, :volume => 'loud'))
end
+
+ should "work with controller namespaces" do
+ @mum = Apotomo::Widget.new(namespaced_controller, 'mum', :squeak)
+ assert_equal({:source=>"mum", :type=>:squeak, :controller=>"farm/barn"}, @mum.address_for_event(:squeak))
+ end
end
context "implementing visibility" do
should "per default respond to #visible?" do
assert @mum.visible?
@@ -129,8 +134,23 @@
assert_equal nil, @mum.param(:whatever)
assert_equal 'grey', @mum.param(:color)
assert_equal 'grey', @mum.param('color')
assert_equal 'shrew', @mum.param(:type)
assert_equal 'Logitech', @mum.param(:brand)
+ end
+
+
+ # internal_methods:
+ should "not list internal methods in action_methods" do
+ assert_equal [], Class.new(Apotomo::Widget).action_methods
+ end
+
+ should "list both local and inherited states in Widget.action_methods" do
+ assert MouseCell.action_methods.collect{ |m| m.to_s }.include?("eating")
+ assert Class.new(MouseCell).action_methods.collect{ |m| m.to_s }.include?("eating")
+ end
+
+ should "not list #display in internal_methods although it's defined in Object" do
+ assert_not Apotomo::Widget.internal_methods.include?(:display)
end
end
end