Skip to content

Commit

Permalink
Add spec for initialization of state on before_create. Closes #91.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronklaassen committed Dec 4, 2013
1 parent 6531518 commit 7ce3032
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/unit/persistence/active_record_persistence_spec.rb
Expand Up @@ -49,6 +49,11 @@
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)
Expand Down

0 comments on commit 7ce3032

Please sign in to comment.