1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

Add spec for initialization of state on before_create. Closes #91.

This commit is contained in:
Aaron Klaassen 2013-12-04 11:35:08 -06:00
parent 65315189a1
commit 7ce3032968

View file

@ -49,6 +49,11 @@ describe "instance methods" do
gate.valid?
end
it "should call aasm_ensure_initial_state before create, even if skipping validations" do
gate.should_receive(:aasm_ensure_initial_state).and_return(true)
gate.save(validate: false)
end
it "should not call aasm_ensure_initial_state on validation before update" do
gate.stub(:new_record?).and_return(false)
gate.should_not_receive(:aasm_ensure_initial_state)