spec/unit/target_spec.rb in finite_machine-0.2.0 vs spec/unit/target_spec.rb in finite_machine-0.3.0
- old
+ new
@@ -51,9 +51,26 @@
car.engine.forward
expect(car.engine.current).to eql(:one)
expect(car.reverse_lights).to be_false
end
+ it "propagates method call" do
+ fsm = FiniteMachine.define do
+ initial :green
+ events {
+ event :slow, :green => :yellow
+ }
+
+ callbacks {
+ on_enter_yellow do |event|
+ uknown_method
+ end
+ }
+ end
+ expect(fsm.current).to eql(:green)
+ expect { fsm.slow }.to raise_error(StandardError)
+ end
+
it "references machine methods inside callback" do
called = []
fsm = FiniteMachine.define do
initial :green