1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/models/nobrainer/invalid_persistor_no_brainer.rb
Guillaume Hain 65073e360a Add support for Nobrainer (RethinkDB)
* 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
2018-02-13 12:49:27 +05:30

39 lines
843 B
Ruby

class InvalidPersistorNoBrainer
include NoBrainer::Document
include AASM
field :name
field :status
aasm :left, column: :status, skip_validation_on_save: true 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 MultipleInvalidPersistorNoBrainer
include NoBrainer::Document
include AASM
field :name
field :status
aasm :left, column: :status, skip_validation_on_save: true 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