source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/multiple_transitions_that_differ_only_by_guard.rb
Ruby
mit
5,199
master
632
class MultipleTransitionsThatDifferOnlyByGuard include AASM attr_accessor :executed_second aasm do state :start, :initial => true state :gone event :go do transitions :from => :start, :to => :gone, :guard => :returns_false, :after => :this_should_not_execute transitions :from => :start,...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/redis/redis_simple.rb
Ruby
mit
5,199
master
307
class RedisSimple include Redis::Objects include AASM value :status def id 1 end aasm :column => :status aasm do state :alpha, :initial => true state :beta state :gamma event :release do transitions :from => [:alpha, :beta, :gamma], :to => :beta end end end
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/redis/redis_multiple.rb
Ruby
mit
5,199
master
322
class RedisMultiple include Redis::Objects include AASM value :status def id 1 end aasm :left, :column => :status aasm :left do state :alpha, :initial => true state :beta state :gamma event :release do transitions :from => [:alpha, :beta, :gamma], :to => :beta end end en...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/redis/complex_redis_example.rb
Ruby
mit
5,199
master
798
class RedisComplexExample include Redis::Objects include AASM value :left value :right def id 1 end aasm :left, :column => 'left' do state :one, :initial => true state :two state :three event :increment do transitions :from => :one, :to => :two transitions :from => :two...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/sequel_simple.rb
Ruby
mit
5,199
master
583
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) # if you want to see the statements while running the spec enable the following line # db.loggers << Logger.new($stderr) db.create_table(:simples) do primary_key :id String :status end module Sequel class Simple < Sequel::Model(:simples) include AASM...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/validator.rb
Ruby
mit
5,199
master
2,199
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) db.create_table(:validators) do primary_key :id String "name" String "status" Fixnum "worker_id" end module Sequel class Validator < Sequel::Model(:validators) plugin :validation_helpers attr_accessor :after_all_transactions_performed, ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/complex_sequel_example.rb
Ruby
mit
5,199
master
1,057
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) # if you want to see the statements while running the spec enable the following line # db.loggers << Logger.new($stderr) db.create_table(:complex_sequel_examples) do primary_key :id String :left String :right end module Sequel class ComplexExample < Sequ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/worker.rb
Ruby
mit
5,199
master
210
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) db.create_table(:workers) do primary_key :id String "name" String "status" end module Sequel class Worker < Sequel::Model(:workers) end end
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/invalid_persistor.rb
Ruby
mit
5,199
master
1,264
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) [:invalid_persistors, :multiple_invalid_persistors].each do |table_name| db.create_table(table_name) do primary_key :id String "name" String "status" end end module Sequel class InvalidPersistor < Sequel::Model(:invalid_persistors) plugin...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/sequel_multiple.rb
Ruby
mit
5,199
master
601
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) # if you want to see the statements while running the spec enable the following line # db.loggers << Logger.new($stderr) db.create_table(:multiples) do primary_key :id String :status end module Sequel class Multiple < Sequel::Model(:multiples) include...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/silent_persistor.rb
Ruby
mit
5,199
master
1,205
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) [:silent_persistors, :multiple_silent_persistors].each do |t| db.create_table(t) do primary_key :id String "name" String "status" end end module Sequel class SilentPersistor < Sequel::Model(:silent_persistors) plugin :validation_helpers ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/sequel/transactor.rb
Ruby
mit
5,199
master
2,436
db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB) [:transactors, :no_lock_transactors, :lock_transactors, :lock_no_wait_transactors, :multiple_transactors].each do |table_name| db.create_table(table_name) do primary_key :id String "name" String "status" Fixnum "worker_id" end end module Se...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/no_scope_no_brainer.rb
Ruby
mit
5,199
master
382
class NoScopeNoBrainer include NoBrainer::Document include AASM field :status, type: String aasm create_scopes: false, column: :status do state :ignored_scope end end class NoScopeNoBrainerMultiple include NoBrainer::Document include AASM field :status, type: String aasm :left, create_scopes:...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/invalid_persistor_no_brainer.rb
Ruby
mit
5,199
master
843
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...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/silent_persistor_no_brainer.rb
Ruby
mit
5,199
master
831
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 ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/nobrainer_relationships.rb
Ruby
mit
5,199
master
372
class Parent include NoBrainer::Document include AASM field :status, type: String has_many :childs aasm column: :status do state :unknown_scope state :new end end class Child include NoBrainer::Document include AASM field :status, type: String belongs_to :parent aasm column: :status d...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/complex_no_brainer_example.rb
Ruby
mit
5,199
master
759
class ComplexNoBrainerExample include NoBrainer::Document include AASM field :left, type: String field :right, type: String aasm :left, column: 'left' do state :one, initial: true state :two state :three event :increment do transitions from: :one, to: :two transitions from: :two...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/simple_new_dsl_nobrainer.rb
Ruby
mit
5,199
master
428
class SimpleNewDslNoBrainer include NoBrainer::Document include AASM field :status, type: String aasm column: :status aasm do state :unknown_scope, initial: true state :new end end class SimpleNewDslNoBrainerMultiple include NoBrainer::Document include AASM field :status, type: String a...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/simple_no_brainer.rb
Ruby
mit
5,199
master
414
class SimpleNoBrainer include NoBrainer::Document include AASM field :status, type: String aasm column: :status do state :unknown_scope, :another_unknown_scope state :new end end class SimpleNoBrainerMultiple include NoBrainer::Document include AASM field :status, type: String aasm :left,...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/nobrainer/validator_no_brainer.rb
Ruby
mit
5,199
master
1,900
class ValidatorNoBrainer include NoBrainer::Document include AASM field :name field :status attr_accessor :invalid validate do |_| errors.add(:validator, 'invalid') if invalid end aasm column: :status, whiny_persistence: true do before_all_transactions :before_all_transactions after_all_...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/with_true_enum.rb
Ruby
mit
5,199
master
648
class WithTrueEnum < ActiveRecord::Base include AASM # Fake this column for testing purposes attr_accessor :aasm_state def value 'value' end aasm :enum => true do state :opened state :closed event :view do transitions :to => :read, :from => [:needs_attention] end end end cla...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/with_false_enum.rb
Ruby
mit
5,199
master
590
class WithFalseEnum < ActiveRecord::Base include AASM # Fake this column for testing purposes attr_accessor :aasm_state aasm :enum => false do state :opened state :closed event :view do transitions :to => :read, :from => [:needs_attention] end end end class MultipleWithFalseEnum < Ac...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/readme_job.rb
Ruby
mit
5,199
master
410
class ReadmeJob < ActiveRecord::Base include AASM aasm do state :sleeping, :initial => true state :running state :cleaning event :run do transitions :from => :sleeping, :to => :running end event :clean do transitions :from => :running, :to => :cleaning end event :slee...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/complex_active_record_example.rb
Ruby
mit
5,199
master
799
class ComplexActiveRecordExample < ActiveRecord::Base include AASM aasm :left, :column => 'left' do state :one, :initial => true state :two state :three event :increment do transitions :from => :one, :to => :two, guard: :allowed? transitions :from => :two, :to => :three end eve...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/simple_new_dsl.rb
Ruby
mit
5,199
master
611
class SimpleNewDsl < ActiveRecord::Base include AASM aasm :column => :status aasm do state :unknown_scope, :another_unknown_scope state :new end end class MultipleSimpleNewDsl < ActiveRecord::Base include AASM aasm :left, :column => :status aasm :left do state :unknown_scope, :another_unknown...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/transactor.rb
Ruby
mit
5,199
master
2,263
class Transactor < ActiveRecord::Base belongs_to :worker include AASM aasm :column => :status do state :sleeping, :initial => true state :running, :before_enter => :start_worker, :after_enter => :fail event :run do transitions :to => :running, :from => :sleeping end end private def ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/provided_and_persisted_state.rb
Ruby
mit
5,199
master
531
class ProvidedAndPersistedState < ActiveRecord::Base attr_accessor :transient_store, :persisted_store include AASM aasm do state :alpha, :initial => true state :beta state :gamma event :release do transitions :from => [:alpha, :beta, :gamma], :to => :beta end end def aasm_read_state...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/basic_active_record_two_state_machines_example.rb
Ruby
mit
5,199
master
545
class BasicActiveRecordTwoStateMachinesExample < ActiveRecord::Base include AASM aasm :search do state :initialised, :initial => true state :queried state :requested event :query do transitions :from => [:initialised, :requested], :to => :queried end event :request do transitio...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/gate.rb
Ruby
mit
5,199
master
631
class Gate < ActiveRecord::Base include AASM # Fake this column for testing purposes # attr_accessor :aasm_state def value 'value' end aasm do state :opened state :closed event :view do transitions :to => :read, :from => [:needs_attention] end end end class MultipleGate < Ac...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/silent_persistor.rb
Ruby
mit
5,199
master
766
class SilentPersistor < ActiveRecord::Base include AASM aasm :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 => :r...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/no_direct_assignment.rb
Ruby
mit
5,199
master
532
class NoDirectAssignment < ActiveRecord::Base include AASM aasm :no_direct_assignment => true do state :pending, :initial => true state :running event :run do transitions :from => :pending, :to => :running end end end class MultipleNoDirectAssignment < ActiveRecord::Base include AASM aa...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/with_enum.rb
Ruby
mit
5,199
master
640
class WithEnum < ActiveRecord::Base include AASM # Fake this column for testing purposes attr_accessor :aasm_state def self.test {} end aasm :enum => :test do state :opened state :closed event :view do transitions :to => :read, :from => [:needs_attention] end end end class M...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/validator.rb
Ruby
mit
5,199
master
3,079
class Validator < ActiveRecord::Base attr_accessor :after_all_transactions_performed, :after_transaction_performed_on_fail, :after_transaction_performed_on_fail_with_reason, :after_transaction_performed_on_run, :before_all_transactions_performed, :before_transaction_performed_on_fail, :before_...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/thief.rb
Ruby
mit
5,199
master
703
class Thief < ActiveRecord::Base if ActiveRecord::VERSION::MAJOR >= 3 self.table_name = 'thieves' else set_table_name "thieves" end include AASM aasm do state :rich state :jailed initial_state Proc.new {|thief| thief.skilled ? :rich : :jailed } end attr_accessor :skilled, :aasm_state e...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/localizer_test_model.rb
Ruby
mit
5,199
master
1,196
class LocalizerTestModel < ActiveRecord::Base include AASM aasm do state :opened, :initial => true state :closed event :close event :open end end describe 'localized state names' do before(:all) do I18n.load_path << 'spec/localizer_test_model_new_style.yml' I18n.reload! end after(...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/no_scope.rb
Ruby
mit
5,199
master
498
class NoScope < ActiveRecord::Base include AASM aasm :create_scopes => false do state :pending, :initial => true state :running event :run do transitions :from => :pending, :to => :running end end end class MultipleNoScope < ActiveRecord::Base include AASM aasm :left, :column => :aasm_s...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/active_record_callback.rb
Ruby
mit
5,199
master
3,360
class ActiveRecordCallback < ActiveRecord::Base include AASM def reset_data @data = [] end def data @data.join(' ') end aasm column: :status do before_all_events :before_all_events after_all_events :after_all_events ensure_on_all_events :ensure_on_all_events after_...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/with_enum_without_column.rb
Ruby
mit
5,199
master
827
class WithEnumWithoutColumn < ActiveRecord::Base include AASM if ActiveRecord::VERSION::MAJOR >= 4 && ActiveRecord::VERSION::MINOR >= 1 # won't work with Rails <= 4.1 enum status: { opened: 0, closed: 1 } end aasm :column => :status do state :closed, initial: true state :opened ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/namespaced.rb
Ruby
mit
5,199
master
301
class MultipleNamespaced < ActiveRecord::Base include AASM aasm(:status, namespace: :car) do state :unsold, initial: true state :sold event :sell do transitions from: :unsold, to: :sold end event :return do transitions from: :sold, to: :unsold end end end
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/invalid_persistor.rb
Ruby
mit
5,199
master
778
class InvalidPersistor < ActiveRecord::Base include AASM aasm :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...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/persisted_state.rb
Ruby
mit
5,199
master
291
class PersistedState < ActiveRecord::Base attr_accessor :transient_store, :persisted_store include AASM aasm do state :alpha, :initial => true state :beta state :gamma event :release do transitions :from => [:alpha, :beta, :gamma], :to => :beta end end end
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/false_state.rb
Ruby
mit
5,199
master
549
class FalseState < ActiveRecord::Base include AASM def initialize(*args) super self.aasm_state = false end aasm do state :opened state :closed event :view do transitions :to => :read, :from => [:needs_attention] end end end class MultipleFalseState < ActiveRecord::Base incl...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/person.rb
Ruby
mit
5,199
master
382
class Base < ActiveRecord::Base include AASM aasm column: 'status' do state :inactive, initial: true state :active event :activate do transitions from: :inactive, to: :active end event :deactivate do transitions from: :active, to: :inactive end end self.abstract_class = t...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/instance_level_skip_validation_example.rb
Ruby
mit
5,199
master
375
class InstanceLevelSkipValidationExample < ActiveRecord::Base include AASM aasm :state do state :new, :initial => true state :draft state :complete event :set_draft do transitions from: :new, to: :draft end event :complete do transitions from: %i[draft new], to: :complete ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/active_record/timestamp_example.rb
Ruby
mit
5,199
master
271
class TimestampExample < ActiveRecord::Base include AASM aasm column: :aasm_state, timestamps: true do state :opened state :closed event :open do transitions to: :opened end event :close do transitions to: :closed end end end
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/multiple_transitions_transition_guard.rb
Ruby
mit
5,199
master
2,301
module Callbacks class MultipleTransitionsTransitionGuard include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] end aasm do state :open, :initial => true, :b...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/basic_multiple.rb
Ruby
mit
5,199
master
2,581
module Callbacks class BasicMultiple include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] reset_data end def reset_data @data = [] end def data ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/with_state_arg_multiple.rb
Ruby
mit
5,199
master
729
module Callbacks class WithStateArgMultiple include AASM aasm(:left) do state :open, :initial => true state :closed state :out_to_lunch event :close, :before => :before_method, :after => :after_method, :before_success => :before_success_method, :success => :success_method do ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/guard_within_block.rb
Ruby
mit
5,199
master
2,257
module Callbacks class GuardWithinBlock include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] end aasm do state :open, :initial => true, :before_enter => :be...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/with_args.rb
Ruby
mit
5,199
master
2,286
module Callbacks class WithArgs include AASM def initialize(options={}) @log = options[:log] reset_data end def reset_data @data = [] end def data @data.join(' ') end aasm do state :open, :initial => true, :before_enter => :before_enter_open, ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/with_state_arg.rb
Ruby
mit
5,199
master
845
module Callbacks class WithStateArg include AASM aasm do state :open, :initial => true state :closed state :out_to_lunch event :close, :before => :before_method, :after => :after_method, :before_success => :before_success_method, :success => :success_method3 do transitions :...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/guard_within_block_multiple.rb
Ruby
mit
5,199
master
2,180
module Callbacks class GuardWithinBlockMultiple include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] end aasm(:left) do state :open, :initial => true, :befo...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/with_args_multiple.rb
Ruby
mit
5,199
master
2,158
module Callbacks class WithArgsMultiple include AASM def initialize(options={}) @log = options[:log] reset_data end def reset_data @data = [] end def data @data.join(' ') end aasm(:left) do state :open, :initial => true, :before_enter => :befor...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/private_method.rb
Ruby
mit
5,199
master
848
module Callbacks class PrivateMethod include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] reset_data end def reset_data @data = [] end def data ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/basic.rb
Ruby
mit
5,199
master
3,597
module Callbacks class Basic include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] reset_data end def reset_data @data = [] end def data @data.j...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/multiple_transitions_transition_guard_multiple.rb
Ruby
mit
5,199
master
2,224
module Callbacks class MultipleTransitionsTransitionGuardMultiple include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] end aasm(:left) do state :open, :initial => t...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/callbacks/private_method_multiple.rb
Ruby
mit
5,199
master
863
module Callbacks class PrivateMethodMultiple include AASM def initialize(options={}) @fail_event_guard = options[:fail_event_guard] @fail_transition_guard = options[:fail_transition_guard] @log = options[:log] reset_data end def reset_data @data = [] end def da...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/timestamp_example_mongoid.rb
Ruby
mit
5,199
master
343
class TimestampExampleMongoid include Mongoid::Document include AASM field :status, type: String field :opened_at, type: Time aasm column: :status, timestamps: true do state :opened state :closed event :open do transitions to: :opened end event :close do transitions to: :cl...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/validator_mongoid.rb
Ruby
mit
5,199
master
1,986
class ValidatorMongoid include Mongoid::Document include AASM field :name field :status attr_accessor :invalid validate do |model| errors.add(:validator, "invalid") if invalid end include AASM aasm :column => :status, :whiny_persistence => true do before_all_transactions :before_all_trans...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/invalid_persistor_mongoid.rb
Ruby
mit
5,199
master
865
class InvalidPersistorMongoid include Mongoid::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 :sle...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/silent_persistor_mongoid.rb
Ruby
mit
5,199
master
853
class SilentPersistorMongoid include Mongoid::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 ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/simple_mongoid.rb
Ruby
mit
5,199
master
412
class SimpleMongoid include Mongoid::Document include AASM field :status, :type => String aasm column: :status do state :unknown_scope, :another_unknown_scope state :new end end class SimpleMongoidMultiple include Mongoid::Document include AASM field :status, :type => String aasm :left, c...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/simple_new_dsl_mongoid.rb
Ruby
mit
5,199
master
438
class SimpleNewDslMongoid include Mongoid::Document include AASM field :status, :type => String aasm :column => :status aasm do state :unknown_scope, :initial => true state :new end end class SimpleNewDslMongoidMultiple include Mongoid::Document include AASM field :status, :type => String ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/no_scope_mongoid.rb
Ruby
mit
5,199
master
392
class NoScopeMongoid include Mongoid::Document include AASM field :status, :type => String aasm :create_scopes => false, :column => :status do state :ignored_scope end end class NoScopeMongoidMultiple include Mongoid::Document include AASM field :status, :type => String aasm :left, :create_sc...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/mongoid_relationships.rb
Ruby
mit
5,199
master
393
class Parent include Mongoid::Document include AASM field :status, :type => String has_many :childs aasm column: :status do state :unknown_scope state :new end end class Child include Mongoid::Document include AASM field :parent_id field :status, :type => String belongs_to :parent a...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/mongoid/complex_mongoid_example.rb
Ruby
mit
5,199
master
816
class ComplexMongoidExample include Mongoid::Document include AASM field :left, :type => String field :right, :type => String aasm :left, :column => 'left' do state :one, :initial => true state :two state :three event :increment do transitions :from => :one, :to => :two transiti...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/not_auto_loaded/process.rb
Ruby
mit
5,199
master
324
module Models class Process include AASM aasm do state :sleeping state :running state :suspended event :start do transitions :from => :sleeping, :to => :running end event :stop do transitions :from => :running, :to => :suspended end end end e...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/dynamoid/complex_dynamoid_example.rb
Ruby
mit
5,199
master
784
class ComplexDynamoidExample include Dynamoid::Document include AASM field :left field :right aasm :left, :column => 'left' do state :one, :initial => true state :two state :three event :increment do transitions :from => :one, :to => :two transitions :from => :two, :to => :three...
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/dynamoid/dynamoid_simple.rb
Ruby
mit
5,199
master
318
class DynamoidSimple include Dynamoid::Document include AASM field :status attr_accessor :default aasm :column => :status aasm do state :alpha, :initial => true state :beta state :gamma event :release do transitions :from => [:alpha, :beta, :gamma], :to => :beta end end end
github
aasm/aasm
https://github.com/aasm/aasm
spec/models/dynamoid/dynamoid_multiple.rb
Ruby
mit
5,199
master
333
class DynamoidMultiple include Dynamoid::Document include AASM field :status attr_accessor :default aasm :left, :column => :status aasm :left do state :alpha, :initial => true state :beta state :gamma event :release do transitions :from => [:alpha, :beta, :gamma], :to => :beta e...
github
aasm/aasm
https://github.com/aasm/aasm
spec/spec_helpers/sequel.rb
Ruby
mit
5,199
master
227
# encoding: utf-8 begin require 'sequel' puts "sequel #{Sequel::VERSION} gem found, running Sequel specs \e[32m#{'✔'}\e[0m" rescue LoadError puts "sequel gem not found, not running Sequel specs \e[31m#{'✖'}\e[0m" end
github
aasm/aasm
https://github.com/aasm/aasm
spec/spec_helpers/active_record.rb
Ruby
mit
5,199
master
275
# encoding: utf-8 begin require 'active_record' puts "active_record #{ActiveRecord::VERSION::STRING} gem found, running ActiveRecord specs \e[32m#{'✔'}\e[0m" rescue LoadError puts "active_record gem not found, not running ActiveRecord specs \e[31m#{'✖'}\e[0m" end
github
aasm/aasm
https://github.com/aasm/aasm
spec/spec_helpers/nobrainer.rb
Ruby
mit
5,199
master
407
# encoding: utf-8 begin require 'nobrainer' NoBrainer.configure do |config| config.app_name = :aasm config.environment = :test config.warn_on_active_record = false end puts "nobrainer #{Gem.loaded_specs['nobrainer'].version} gem found, running nobrainer specs \e[32m#{'✔'}\e[0m" rescue LoadError ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/spec_helpers/mongoid.rb
Ruby
mit
5,199
master
740
# encoding: utf-8 begin require 'mongoid' require 'rails' puts "mongoid #{Mongoid::VERSION} gem found, running mongoid specs \e[32m#{'✔'}\e[0m" if Mongoid::VERSION.to_f <= 5 Mongoid::Config.sessions = { default: { database: "mongoid_#{Process.pid}", hosts: ["#{ENV['MONGODB_HOST'] || ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/spec_helpers/dynamoid.rb
Ruby
mit
5,199
master
1,109
# encoding: utf-8 begin require 'dynamoid' puts "dynamoid #{Dynamoid::VERSION} gem found, running Dynamoid specs \e[32m#{'✔'}\e[0m" if Gem::Version.new(Dynamoid::VERSION) >= Gem::Version.new('3.0.0') require 'aws-sdk-dynamodb' else require 'aws-sdk-resources' end ENV['ACCESS_KEY'] ||= 'abcd' ENV...
github
aasm/aasm
https://github.com/aasm/aasm
spec/spec_helpers/redis.rb
Ruby
mit
5,199
master
534
# encoding: utf-8 begin require 'redis-objects' require 'redis/objects/version' puts "redis-objects #{Redis::Objects::VERSION} gem found, running Redis specs \e[32m#{'✔'}\e[0m" redis = Redis.new(host: (ENV['REDIS_HOST'] || '127.0.0.1'), port: (ENV['REDIS_PORT'] || 6379)) Redis::Objects.redis = redis RSpe...
github
aasm/aasm
https://github.com/aasm/aasm
spec/generators/mongoid_generator_spec.rb
Ruby
mit
5,199
master
887
require 'spec_helper' if defined?(Mongoid::Document) require 'generator_spec' require 'generators/mongoid/aasm_generator' describe Mongoid::Generators::AASMGenerator, type: :generator do destination File.expand_path("../../../tmp", __FILE__) before(:all) do prepare_destination end it "cr...
github
aasm/aasm
https://github.com/aasm/aasm
spec/generators/no_brainer_generator_spec.rb
Ruby
mit
5,199
master
891
require 'spec_helper' if defined?(NoBrainer::Document) require 'generator_spec' require 'generators/nobrainer/aasm_generator' describe NoBrainer::Generators::AASMGenerator, type: :generator do destination File.expand_path('../../../tmp', __FILE__) before(:all) do prepare_destination end ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/generators/active_record_generator_spec.rb
Ruby
mit
5,199
master
1,689
require 'spec_helper' if defined?(ActiveRecord) require 'generator_spec' require 'generators/active_record/aasm_generator' describe ActiveRecord::Generators::AASMGenerator, type: :generator do destination File.expand_path("../../../tmp", __FILE__) before(:all) do prepare_destination end ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/callback_multiple_spec.rb
Ruby
mit
5,199
master
12,578
require 'spec_helper' Dir[File.dirname(__FILE__) + "/../models/callbacks/*.rb"].sort.each { |f| require File.expand_path(f) } describe 'callbacks for the new DSL' do it "be called in order" do show_debug_log = false callback = Callbacks::BasicMultiple.new(:log => show_debug_log) callback.aasm(:left).cu...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/invoker_spec.rb
Ruby
mit
5,199
master
5,186
require 'spec_helper' describe AASM::Core::Invoker do let(:target) { nil } let(:record) { double } let(:args) { [] } subject { described_class.new(target, record, args) } describe '#with_options' do context 'when passing array as a subject' do context 'and "guard" option is set to true' do ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/complex_example_spec.rb
Ruby
mit
5,199
master
2,924
require 'spec_helper' describe 'on initialization' do let(:auth) {ComplexExample.new} it 'should be in the pending state' do expect(auth.aasm.current_state).to eq(:pending) end it 'should have an activation code' do expect(auth.has_activation_code?).to be_truthy expect(auth.activation_code).not_t...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/simple_example_spec.rb
Ruby
mit
5,199
master
1,892
require 'spec_helper' describe 'state machine' do let(:simple) { SimpleExample.new } it 'starts with an initial state' do expect(simple.aasm.current_state).to eq(:initialised) expect(simple).to respond_to(:initialised?) expect(simple).to be_initialised end it 'allows transitions to other states' ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/guard_without_from_specified_spec.rb
Ruby
mit
5,199
master
298
require 'spec_helper' describe "transitions without from specified" do let(:guardian) { GuardianWithoutFromSpecified.new } it "allows the transitions if guard succeeds" do expect { guardian.use_guards_where_the_first_fails! }.to_not raise_error expect(guardian).to be_gamma end end
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/inspection_spec.rb
Ruby
mit
5,199
master
5,042
require 'spec_helper' describe 'inspection for common cases' do it 'should support the new DSL' do expect(Foo.aasm).to respond_to(:states) expect(Foo.aasm.states).to include(:open) expect(Foo.aasm.states).to include(:closed) expect(Foo.aasm).to respond_to(:initial_state) expect(Foo.aasm.initial_...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/guard_multiple_spec.rb
Ruby
mit
5,199
master
2,083
require 'spec_helper' describe "per-transition guards" do let(:guardian) { GuardianMultiple.new } it "allows the transition if the guard succeeds" do expect { guardian.use_one_guard_that_succeeds! }.to_not raise_error expect(guardian).to be_beta end it "stops the transition if the guard fails" do ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/states_on_one_line_example_spec.rb
Ruby
mit
5,199
master
438
require 'spec_helper' describe StatesOnOneLineExample do let(:example) { StatesOnOneLineExample.new } describe 'on initialize' do it 'should be in the initial state' do expect(example.aasm(:one_line).current_state).to eql :initial end end describe 'states' do it 'should have all 3 states def...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/api_spec.rb
Ruby
mit
5,199
master
2,718
require 'spec_helper' if defined?(ActiveRecord) require 'models/default_state.rb' require 'models/provided_state.rb' require 'models/active_record/persisted_state.rb' require 'models/active_record/provided_and_persisted_state.rb' load_schema describe "reading the current state" do it "uses the AASM d...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/guard_with_params_spec.rb
Ruby
mit
5,199
master
390
require 'spec_helper' describe "guards with params" do let(:guard) { GuardWithParams.new } let(:user) {GuardParamsClass.new} it "list permitted states" do expect(guard.aasm.states({:permitted => true}, user).map(&:name)).to eql [:reviewed] end it "list no states if user is blank" do expect(guard.aa...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/abstract_class_spec.rb
Ruby
mit
5,199
master
706
require 'spec_helper' if defined?(ActiveRecord) require 'models/active_record/person' load_schema describe 'Abstract subclassing' do it 'should have the parent states' do Person.aasm.states.each do |state| expect(Base.aasm.states).to include(state) end expect(Person.aasm.states).to...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/inspection_multiple_spec.rb
Ruby
mit
5,199
master
7,279
require 'spec_helper' describe 'inspection for common cases' do it 'should support the new DSL' do # 1st state machine expect(FooMultiple.aasm(:left)).to respond_to(:states) expect(FooMultiple.aasm(:left).states.size).to eql 3 expect(FooMultiple.aasm(:left).states).to include(:open) expect(FooMul...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/simple_custom_example_spec.rb
Ruby
mit
5,199
master
1,012
require 'spec_helper' describe 'Custom AASM::Base' do context 'when aasm_with invoked with SimpleCustomExample' do let(:simple_custom) { SimpleCustomExample.new } subject do simple_custom.fill_out! simple_custom.authorise end it 'has invoked authorizable?' do expect { subject }.to...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/callbacks_spec.rb
Ruby
mit
5,199
master
22,163
require 'spec_helper' Dir[File.dirname(__FILE__) + "/../models/callbacks/*.rb"].sort.each { |f| require File.expand_path(f) } shared_examples 'an implemented callback that accepts error' do context 'with callback defined' do it "should run error_callback if an exception is raised and always return false" do ...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/readme_spec.rb
Ruby
mit
5,199
master
818
require 'spec_helper' describe 'testing the README examples' do it 'Usage' do class Job include AASM aasm do state :sleeping, :initial => true state :running, :cleaning event :run do transitions :from => :sleeping, :to => :running end event :clean...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/multiple_transitions_that_differ_only_by_guard_spec.rb
Ruby
mit
5,199
master
377
require 'spec_helper' describe "multiple transitions that differ only by guard" do let(:job) { MultipleTransitionsThatDifferOnlyByGuard.new } it 'does not follow the first transition if its guard fails' do expect{job.go}.not_to raise_error end it 'executes the second transition\'s callbacks' do job.g...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/complex_multiple_example_spec.rb
Ruby
mit
5,199
master
3,514
require 'spec_helper' describe 'on initialization' do let(:auth) {ComplexExampleMultiple.new} it 'should be in the initial state' do expect(auth.aasm(:left).current_state).to eq(:pending) expect(auth.aasm(:right).current_state).to eq(:pending) end it 'should have an activation code' do expect(aut...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/timestamps_spec.rb
Ruby
mit
5,199
master
1,211
require 'spec_helper' describe 'timestamps option' do it 'calls a timestamp setter based on the state name when entering a new state' do object = TimestampsExample.new expect { object.open }.to change { object.opened_at }.from(nil).to(instance_of(::Time)) end it 'overwrites any previous timestamp if a s...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/edge_cases_spec.rb
Ruby
mit
5,199
master
546
require 'spec_helper' describe "edge cases" do describe "for classes with multiple state machines" do it "allows accessing a multiple state machine class without state machine name" do # it's like starting to define a new state machine within the # requested class expect(SimpleMultipleExample.a...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/simple_multiple_example_spec.rb
Ruby
mit
5,199
master
3,122
require 'spec_helper' describe 'state machine' do let(:simple) { SimpleMultipleExample.new } it 'starts with an initial state' do expect(simple.aasm(:move).current_state).to eq(:standing) expect(simple).to respond_to(:standing?) expect(simple).to be_standing expect(simple.aasm(:work).current_stat...
github
aasm/aasm
https://github.com/aasm/aasm
spec/unit/exception_spec.rb
Ruby
mit
5,199
master
327
require 'spec_helper' describe AASM::InvalidTransition do it 'should not be lazy detecting originating state' do process = ProcessWithNewDsl.new expect { process.stop! }.to raise_error do |err| process.start expect(err.message).to eql("Event 'stop' cannot transition from 'sleeping'.") end e...