mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
![Guillaume Hain](/assets/img/avatar_default.png)
* Add persistence for NoBrainer * Add tests for NoBrainer * Show the ORM version when running the tests * Add a Dockerfile and a docker-compose.yml file allowing to run from anywhere very easily the test suite with `docker-compose run --rm aasm\' * Moves the Mongoid database name definition in the gem loader (avoiding code repetition) * Update the CHANGELOG.md and the README.md files * Add Rails generator for NoBrainer
39 lines
831 B
Ruby
39 lines
831 B
Ruby
class SilentPersistorNoBrainer
|
|
include NoBrainer::Document
|
|
include AASM
|
|
|
|
field :name
|
|
field :status
|
|
|
|
aasm :left, column: :status, whiny_persistence: false do
|
|
state :sleeping, initial: true
|
|
state :running
|
|
event :run do
|
|
transitions to: :running, from: :sleeping
|
|
end
|
|
event :sleep do
|
|
transitions to: :sleeping, from: :running
|
|
end
|
|
end
|
|
validates_presence_of :name
|
|
end
|
|
|
|
class MultipleSilentPersistorNoBrainer
|
|
include NoBrainer::Document
|
|
include AASM
|
|
|
|
field :name
|
|
field :status
|
|
|
|
aasm :left, column: :status, whiny_persistence: false do
|
|
state :sleeping, initial: true
|
|
state :running
|
|
event :run do
|
|
transitions to: :running, from: :sleeping
|
|
end
|
|
event :sleep do
|
|
transitions to: :sleeping, from: :running
|
|
end
|
|
end
|
|
validates_presence_of :name
|
|
end
|