spec/models/elevator.rb in finite-1.0.0 vs spec/models/elevator.rb in finite-1.1.0
- old
+ new
@@ -1,12 +1,13 @@
class Elevator
include Finite
-
+ attr_accessor :broken
def initialize
@before_called = 0
@after_called = 0
+ @broken = false
end
finite initial: :idle do
before :doors_closing do
@@ -29,11 +30,11 @@
@after_called += 1
end
event :prepare do
- go from: :idle, to: :doors_closing
+ go from: :idle, to: :doors_closing, if: -> { not @broken }
end
event :go_up do
go from: :doors_closing, to: :elevator_going_up
after do
@@ -89,6 +90,6 @@
# elevator.go_up
# elevator.start
# elevator.approach
# elevator.stop
# puts elevator.can_open_doors?
-# puts elevator.can_finish?
\ No newline at end of file
+# puts elevator.can_finish?