spec/unit/events_spec.rb in finite_machine-0.8.1 vs spec/unit/events_spec.rb in finite_machine-0.9.0
- old
+ new
@@ -62,20 +62,20 @@
}
end
expect(fsm.current).to eql(:green)
- expect(fsm.can?(:noop)).to be_true
- expect(fsm.can?(:slow)).to be_true
+ expect(fsm.can?(:noop)).to be true
+ expect(fsm.can?(:slow)).to be true
fsm.noop
expect(fsm.current).to eql(:green)
fsm.slow
expect(fsm.current).to eql(:yellow)
- expect(fsm.cannot?(:noop)).to be_true
- expect(fsm.cannot?(:slow)).to be_true
+ expect(fsm.cannot?(:noop)).to be true
+ expect(fsm.cannot?(:slow)).to be true
end
it "permits event from any state with :any 'from'" do
fsm = FiniteMachine.define do
initial :green
@@ -169,11 +169,11 @@
event :slow, from: :green, to: :yellow
event :stop, from: :yellow, to: :red
}
end
expect(fsm.current).to eql(:green)
- expect(fsm.can?(:stop)).to be_false
+ expect(fsm.can?(:stop)).to be false
fsm.stop!
expect(fsm.current).to eql(:red)
end
context 'when multiple from states' do
@@ -189,14 +189,14 @@
}
end
expect(fsm.current).to eql(:green)
- expect(fsm.can?(:slow)).to be_true
- expect(fsm.can?(:stop)).to be_true
- expect(fsm.cannot?(:ready)).to be_true
- expect(fsm.cannot?(:go)).to be_true
+ expect(fsm.can?(:slow)).to be true
+ expect(fsm.can?(:stop)).to be true
+ expect(fsm.cannot?(:ready)).to be true
+ expect(fsm.cannot?(:go)).to be true
fsm.slow; expect(fsm.current).to eql(:yellow)
fsm.stop; expect(fsm.current).to eql(:red)
fsm.ready; expect(fsm.current).to eql(:yellow)
fsm.go; expect(fsm.current).to eql(:green)
@@ -217,14 +217,14 @@
}
end
expect(fsm.current).to eql(:green)
- expect(fsm.can?(:slow)).to be_true
- expect(fsm.can?(:stop)).to be_true
- expect(fsm.cannot?(:ready)).to be_true
- expect(fsm.cannot?(:go)).to be_true
+ expect(fsm.can?(:slow)).to be true
+ expect(fsm.can?(:stop)).to be true
+ expect(fsm.cannot?(:ready)).to be true
+ expect(fsm.cannot?(:go)).to be true
fsm.slow; expect(fsm.current).to eql(:yellow)
fsm.stop; expect(fsm.current).to eql(:red)
fsm.ready; expect(fsm.current).to eql(:yellow)
fsm.go; expect(fsm.current).to eql(:green)
@@ -245,11 +245,11 @@
event :cycle, [:yellow, :red, :pink] => :green
}
end
expect(fsm.current).to eql(:green)
- expect(fsm.can?(:stop)).to be_true
+ expect(fsm.can?(:stop)).to be true
fsm.stop
expect(fsm.current).to eql(:yellow)
fsm.stop
expect(fsm.current).to eql(:red)
fsm.stop
@@ -270,15 +270,12 @@
:medium => :high
}
end
expect(fsm.current).to eq(:initial)
- fsm.bump
- expect(fsm.current).to eq(:low)
- fsm.bump
- expect(fsm.current).to eq(:medium)
- fsm.bump
- expect(fsm.current).to eq(:high)
+ fsm.bump; expect(fsm.current).to eq(:low)
+ fsm.bump; expect(fsm.current).to eq(:medium)
+ fsm.bump; expect(fsm.current).to eq(:high)
end
it "returns values for events" do
fsm = FiniteMachine.define do
initial :neutral