test/test_interaction.rb in launchpad-0.1.0 vs test/test_interaction.rb in launchpad-0.1.1

- old
+ new

@@ -24,9 +24,38 @@ assert !Launchpad::Interaction.new.active end end + context 'close' do + + should 'close device' do + interaction = Launchpad::Interaction.new(:device => device = Launchpad::Device.new) + device.expects(:close) + interaction.close + end + + should 'craise NoInputAllowedError on subsequent accesses' do + interaction = Launchpad::Interaction.new(:device => device = Launchpad::Device.new) + interaction.close + assert_raise Launchpad::NoInputAllowedError do + interaction.start + end + end + + end + + context 'closed?' do + + should 'return false on a newly created interaction, but true after closing' do + interaction = Launchpad::Interaction.new + assert !interaction.closed? + interaction.close + assert interaction.closed? + end + + end + context 'start' do # this is kinda greybox tested, since I couldn't come up with another way to test a loop [thomas, 2009-11-11] setup do