repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/work.rb
spec/models/active_record/work.rb
class Work < ActiveRecord::Base include AASM end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/transient.rb
spec/models/active_record/transient.rb
class Transient < ActiveRecord::Base def aasm_write_state_without_persistence(state) "fum" end include AASM end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/worker.rb
spec/models/active_record/worker.rb
class Worker < ActiveRecord::Base end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/simple_new_dsl.rb
spec/models/active_record/simple_new_dsl.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/localizer_test_model.rb
spec/models/active_record/localizer_test_model.rb
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(...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/basic_active_record_two_state_machines_example.rb
spec/models/active_record/basic_active_record_two_state_machines_example.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/gate.rb
spec/models/active_record/gate.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/person.rb
spec/models/active_record/person.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/with_enum_without_column.rb
spec/models/active_record/with_enum_without_column.rb
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 ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/generators/mongoid_generator_spec.rb
spec/generators/mongoid_generator_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/generators/active_record_generator_spec.rb
spec/generators/active_record_generator_spec.rb
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 ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/generators/no_brainer_generator_spec.rb
spec/generators/no_brainer_generator_spec.rb
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 ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/inspection_multiple_spec.rb
spec/unit/inspection_multiple_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/inspection_spec.rb
spec/unit/inspection_spec.rb
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_...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/callback_multiple_spec.rb
spec/unit/callback_multiple_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/exception_spec.rb
spec/unit/exception_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/callbacks_spec.rb
spec/unit/callbacks_spec.rb
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 ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/guard_with_params_multiple_spec.rb
spec/unit/guard_with_params_multiple_spec.rb
require 'spec_helper' describe "guards with params" do let(:guard) { GuardWithParamsMultiple.new } let(:user) {GuardParamsClass.new} it "list permitted states" do expect(guard.aasm(:left).states({:permitted => true}, user).map(&:name)).to eql [:reviewed] end end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/multiple_transitions_that_differ_only_by_guard_spec.rb
spec/unit/multiple_transitions_that_differ_only_by_guard_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/subclassing_spec.rb
spec/unit/subclassing_spec.rb
require 'spec_helper' describe 'subclassing' do it 'should have the parent states' do SuperClass.aasm.states.each do |state| expect(SubClassWithMoreStates.aasm.states).to include(state) end expect(SubClass.aasm.states).to eq(SuperClass.aasm.states) end it 'should not add the child states to t...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/api_spec.rb
spec/unit/api_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/edge_cases_spec.rb
spec/unit/edge_cases_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/initial_state_spec.rb
spec/unit/initial_state_spec.rb
require 'spec_helper' describe 'initial states' do it 'should use the first state defined if no initial state is given' do expect(NoInitialState.new.aasm.current_state).to eq(:read) end it 'should determine initial state from the Proc results' do expect(InitialStateProc.new(InitialStateProc::RICH - 1).a...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/namespaced_multiple_example_spec.rb
spec/unit/namespaced_multiple_example_spec.rb
require 'spec_helper' describe 'state machine' do let(:namespaced) { NamespacedMultipleExample.new } it 'starts with an initial state' do expect(namespaced.aasm(:status).current_state).to eq(:unapproved) expect(namespaced).to respond_to(:unapproved?) expect(namespaced).to be_unapproved expect(nam...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/guard_with_params_spec.rb
spec/unit/guard_with_params_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/initial_state_multiple_spec.rb
spec/unit/initial_state_multiple_spec.rb
require 'spec_helper' describe 'initial states' do it 'should use the first state defined if no initial state is given' do expect(NoInitialStateMultiple.new.aasm(:left).current_state).to eq(:read) end it 'should determine initial state from the Proc results' do balance = InitialStateProcMultiple::RICH -...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/class_with_keyword_arguments_spec.rb
spec/unit/class_with_keyword_arguments_spec.rb
require 'spec_helper' describe ClassWithKeywordArguments do let(:state_machine) { ClassWithKeywordArguments.new } let(:resource) { double('resource', value: 1) } context 'when using optional keyword arguments' do it 'changes state successfully to closed_temporarily' do expect(state_machine.close_tempo...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/complex_example_spec.rb
spec/unit/complex_example_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/invoker_spec.rb
spec/unit/invoker_spec.rb
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 ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/simple_custom_example_spec.rb
spec/unit/simple_custom_example_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/rspec_matcher_spec.rb
spec/unit/rspec_matcher_spec.rb
require 'spec_helper' describe 'state machine' do let(:simple) { SimpleExample.new } let(:multiple) { SimpleMultipleExample.new } describe 'transition_from' do it "works for simple state machines" do expect(simple).to transition_from(:initialised).to(:filled_out).on_event(:fill_out) expect(simpl...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/simple_multiple_example_spec.rb
spec/unit/simple_multiple_example_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/localizer_spec.rb
spec/unit/localizer_spec.rb
require 'spec_helper' if defined?(ActiveRecord) require 'models/active_record/localizer_test_model' load_schema describe AASM::Localizer, "new style" do before(:all) do I18n.load_path << 'spec/localizer_test_model_new_style.yml' I18n.reload! end after(:all) do I18n.load_path.delet...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/event_with_keyword_arguments_spec.rb
spec/unit/event_with_keyword_arguments_spec.rb
require 'spec_helper' describe EventWithKeywordArguments do let(:example) { EventWithKeywordArguments.new } context 'when using required keyword arguments' do it 'works with required keyword argument' do expect(example.close(key: 1)).to be_truthy end it 'works when required keyword argument is ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/complex_multiple_example_spec.rb
spec/unit/complex_multiple_example_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/subclassing_multiple_spec.rb
spec/unit/subclassing_multiple_spec.rb
require 'spec_helper' describe 'subclassing with multiple state machines' do it 'should have the parent states' do SuperClassMultiple.aasm(:left).states.each do |state| expect(SubClassWithMoreStatesMultiple.aasm(:left).states).to include(state) end expect(SubClassMultiple.aasm(:left).states).to eq...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/event_naming_spec.rb
spec/unit/event_naming_spec.rb
require 'spec_helper' describe "event naming" do let(:state_machine) { StateMachineWithFailedEvent.new } it "allows an event of failed without blowing the stack aka stack level too deep" do state_machine.failed expect { state_machine.failed }.to raise_error(AASM::InvalidTransition) end it "allows sen...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/guard_multiple_spec.rb
spec/unit/guard_multiple_spec.rb
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 ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/readme_spec.rb
spec/unit/readme_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/guard_without_from_specified_spec.rb
spec/unit/guard_without_from_specified_spec.rb
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
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/states_on_one_line_example_spec.rb
spec/unit/states_on_one_line_example_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/state_spec.rb
spec/unit/state_spec.rb
require 'spec_helper' describe AASM::Core::State do let(:state_machine) { AASM::StateMachine.new(:name) } before(:each) do @name = :astate @options = { :crazy_custom_key => 'key' } end def new_state(options={}) AASM::Core::State.new(@name, Conversation, state_machine, @options.merge(options)) ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/event_spec.rb
spec/unit/event_spec.rb
require 'spec_helper' describe 'adding an event' do let(:state_machine) { AASM::StateMachine.new(:name) } let(:event) do AASM::Core::Event.new(:close_order, state_machine, {:success => :success_callback}) do before :before_callback after :after_callback transitions :to => :closed, :from => [:...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/basic_two_state_machines_example_spec.rb
spec/unit/basic_two_state_machines_example_spec.rb
require 'spec_helper' describe 'on initialization' do let(:example) { BasicTwoStateMachinesExample.new } it 'should be in the initial state' do expect(example.aasm(:search).current_state).to eql :initialised expect(example.aasm(:sync).current_state).to eql :unsynced end end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/event_multiple_spec.rb
spec/unit/event_multiple_spec.rb
require 'spec_helper' describe 'current event' do let(:pe) {ParametrisedEventMultiple.new} it 'if no event has been triggered' do expect(pe.aasm(:left).current_event).to be_nil end it 'if a event has been triggered' do pe.wakeup expect(pe.aasm(:left).current_event).to eql :wakeup end it 'if ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/guard_arguments_check_spec.rb
spec/unit/guard_arguments_check_spec.rb
require 'spec_helper' describe "nil as first argument" do let(:guard) { GuardArgumentsCheck.new } it 'does not raise errors' do expect { guard.mark_as_reviewed(nil, 'second arg') }.not_to raise_error end end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/memory_leak_spec.rb
spec/unit/memory_leak_spec.rb
# require 'spec_helper' # describe "state machines" do # def number_of_objects(klass) # ObjectSpace.each_object(klass) {} # end # def machines # AASM::StateMachineStore.instance_variable_get("@stores") # end # it "should be created without memory leak" do # machines_count = machines.size # ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/simple_example_spec.rb
spec/unit/simple_example_spec.rb
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' ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/new_dsl_spec.rb
spec/unit/new_dsl_spec.rb
require 'spec_helper' describe "the new dsl" do let(:process) {ProcessWithNewDsl.new} it 'should not conflict with other event or state methods' do expect {ProcessWithNewDsl.state}.to raise_error(RuntimeError, "wrong state method") expect {ProcessWithNewDsl.event}.to raise_error(RuntimeError, "wrong even...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/abstract_class_spec.rb
spec/unit/abstract_class_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/reloading_spec.rb
spec/unit/reloading_spec.rb
require 'spec_helper' describe 'when redefining states' do let(:definer) { DoubleDefiner.new } it "allows extending states" do expect(definer).to receive(:do_enter) definer.finish end it "allows extending events" do expect(definer).to receive(:do_on_transition) definer.finish end end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/override_warning_spec.rb
spec/unit/override_warning_spec.rb
require 'spec_helper' describe 'warns when overrides a method' do before do AASM::Configuration.hide_warnings = false end after do AASM::Configuration.hide_warnings = true end module Clumsy def self.included base base.send :include, AASM base.aasm do state :valid ev...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/guard_spec.rb
spec/unit/guard_spec.rb
require 'spec_helper' describe "per-transition guards" do let(:guardian) { Guardian.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 expect ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/transition_spec.rb
spec/unit/transition_spec.rb
require 'spec_helper' describe 'transitions' do it 'should raise an exception when whiny' do process = ProcessWithNewDsl.new expect { process.stop! }.to raise_error do |err| expect(err.class).to eql(AASM::InvalidTransition) expect(err.message).to eql("Event 'stop' cannot transition from 'sleepin...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/timestamps_spec.rb
spec/unit/timestamps_spec.rb
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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/dynamoid_persistence_multiple_spec.rb
spec/unit/persistence/dynamoid_persistence_multiple_spec.rb
require 'spec_helper' if defined?(Dynamoid) describe 'dynamoid' do Dir[File.dirname(__FILE__) + "/../../models/dynamoid/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do @model = DynamoidMultiple end describe "instance methods" do let(:model) {@model.new...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/mongoid_persistence_multiple_spec.rb
spec/unit/persistence/mongoid_persistence_multiple_spec.rb
require 'spec_helper' if defined?(Mongoid::Document) describe 'mongoid' do Dir[File.dirname(__FILE__) + "/../../models/mongoid/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do # if you want to see the statements while running the spec enable the following line #...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/sequel_persistence_multiple_spec.rb
spec/unit/persistence/sequel_persistence_multiple_spec.rb
require 'spec_helper' if defined?(Sequel) describe 'sequel' do Dir[File.dirname(__FILE__) + "/../../models/sequel/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do @model = Sequel::Multiple end describe "instance methods" do let(:model) {@model.new} ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/redis_persistence_multiple_spec.rb
spec/unit/persistence/redis_persistence_multiple_spec.rb
require 'spec_helper' if defined?(Redis) describe 'redis' do Dir[File.dirname(__FILE__) + "/../../models/redis/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do @model = RedisMultiple end describe "instance methods" do let(:model) {@model.new} it ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/no_brainer_persistence_multiple_spec.rb
spec/unit/persistence/no_brainer_persistence_multiple_spec.rb
require 'spec_helper' if defined?(NoBrainer::Document) describe 'nobrainer' do Dir[File.dirname(__FILE__) + '/../../models/nobrainer/*.rb'].sort.each do |f| require File.expand_path(f) end before(:all) do # if you want to see the statements while running the spec enable the # following...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/sequel_persistence_spec.rb
spec/unit/persistence/sequel_persistence_spec.rb
require 'spec_helper' if defined?(Sequel) describe 'sequel' do Dir[File.dirname(__FILE__) + "/../../models/sequel/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do @model = Sequel::Simple end describe "instance methods" do let(:model) {@model.new} ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/active_record_persistence_multiple_spec.rb
spec/unit/persistence/active_record_persistence_multiple_spec.rb
require 'spec_helper' if defined?(ActiveRecord) Dir[File.dirname(__FILE__) + "/../../models/active_record/*.rb"].sort.each do |f| require File.expand_path(f) end load_schema # if you want to see the statements while running the spec enable the following line # require 'logger' # ActiveRecord::Base.l...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/mongoid_persistence_spec.rb
spec/unit/persistence/mongoid_persistence_spec.rb
require 'spec_helper' if defined?(Mongoid::Document) describe 'mongoid' do Dir[File.dirname(__FILE__) + "/../../models/mongoid/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do # if you want to see the statements while running the spec enable the following line #...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/active_record_persistence_spec.rb
spec/unit/persistence/active_record_persistence_spec.rb
require 'spec_helper' if defined?(ActiveRecord) Dir[File.dirname(__FILE__) + "/../../models/active_record/*.rb"].sort.each do |f| require File.expand_path(f) end load_schema # if you want to see the statements while running the spec enable the following line # require 'logger' # ActiveRecord::Base.l...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/dynamoid_persistence_spec.rb
spec/unit/persistence/dynamoid_persistence_spec.rb
require 'spec_helper' if defined?(Dynamoid) describe 'dynamoid' do Dir[File.dirname(__FILE__) + "/../../models/dynamoid/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do @model = DynamoidSimple end describe "instance methods" do let(:model) {@model.new} ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/redis_persistence_spec.rb
spec/unit/persistence/redis_persistence_spec.rb
require 'spec_helper' if defined?(Redis::Objects) describe 'redis' do Dir[File.dirname(__FILE__) + "/../../models/redis/*.rb"].sort.each do |f| require File.expand_path(f) end before(:all) do @model = RedisSimple end describe "instance methods" do let(:model) {@model.new} ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/persistence/no_brainer_persistence_spec.rb
spec/unit/persistence/no_brainer_persistence_spec.rb
require 'spec_helper' if defined?(NoBrainer::Document) describe 'nobrainer' do Dir[File.dirname(__FILE__) + '/../../models/nobrainer/*.rb'].sort.each do |f| require File.expand_path(f) end before(:all) do # if you want to see the statements while running the spec enable the # following...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/invokers/base_invoker_spec.rb
spec/unit/invokers/base_invoker_spec.rb
require 'spec_helper' describe AASM::Core::Invokers::BaseInvoker do let(:target) { double } let(:record) { double } let(:args) { [] } subject { described_class.new(target, record, args) } describe '#may_invoke?' do it 'then raises NoMethodError' do expect { subject.may_invoke? }.to raise_error(No...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/invokers/class_invoker_spec.rb
spec/unit/invokers/class_invoker_spec.rb
require 'spec_helper' describe AASM::Core::Invokers::ClassInvoker do let(:target) { Class.new { def call; end } } let(:record) { double } let(:args) { [] } subject { described_class.new(target, record, args) } describe '#may_invoke?' do context 'when subject is a Class and responds to #call' do i...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/invokers/literal_invoker_spec.rb
spec/unit/invokers/literal_invoker_spec.rb
require 'spec_helper' describe AASM::Core::Invokers::LiteralInvoker do let(:target) { nil } let(:record) { double } let(:args) { [] } subject { described_class.new(target, record, args) } describe '#may_invoke?' do context 'when subject is a Symbol' do let(:target) { :i_am_symbol } it 'the...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/unit/invokers/proc_invoker_spec.rb
spec/unit/invokers/proc_invoker_spec.rb
require 'spec_helper' describe AASM::Core::Invokers::ProcInvoker do let(:target) { Proc.new {} } let(:record) { double } let(:args) { [] } subject { described_class.new(target, record, args) } describe '#may_invoke?' do context 'when subject is a Proc' do it 'then returns "true"' do expec...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/spec_helpers/active_record.rb
spec/spec_helpers/active_record.rb
# 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
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/spec_helpers/redis.rb
spec/spec_helpers/redis.rb
# 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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/spec_helpers/dynamoid.rb
spec/spec_helpers/dynamoid.rb
# 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...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/spec_helpers/sequel.rb
spec/spec_helpers/sequel.rb
# 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
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/spec_helpers/mongoid.rb
spec/spec_helpers/mongoid.rb
# 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'] || ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/spec_helpers/remove_warnings.rb
spec/spec_helpers/remove_warnings.rb
AASM::Configuration.hide_warnings = true
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/spec_helpers/nobrainer.rb
spec/spec_helpers/nobrainer.rb
# 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 ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/motion-aasm.rb
lib/motion-aasm.rb
unless defined?(Motion::Project::App) raise "This must be required from within a RubyMotion Rakefile" end file_dependencies = { 'aasm/aasm.rb' => ['aasm/persistence.rb'], 'aasm/persistence.rb' => ['aasm/persistence/plain_persistence.rb', 'aasm/persistence/core_data_query_persistence.rb'], 'aasm/persistence/bas...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm.rb
lib/aasm.rb
require 'aasm/version' require 'aasm/errors' require 'aasm/configuration' require 'aasm/base' require 'aasm/dsl_helper' require 'aasm/instance_base' require 'aasm/core/transition' require 'aasm/core/event' require 'aasm/core/state' require 'aasm/core/invoker' require 'aasm/core/invokers/base_invoker' require 'aasm/core...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/generators/nobrainer/aasm_generator.rb
lib/generators/nobrainer/aasm_generator.rb
require 'rails/generators/named_base' require 'generators/aasm/orm_helpers' module NoBrainer module Generators class AASMGenerator < Rails::Generators::NamedBase include AASM::Generators::OrmHelpers namespace 'nobrainer:aasm' argument :column_name, type: :string, default: 'aasm_state' de...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/generators/mongoid/aasm_generator.rb
lib/generators/mongoid/aasm_generator.rb
require 'rails/generators/named_base' require 'generators/aasm/orm_helpers' module Mongoid module Generators class AASMGenerator < Rails::Generators::NamedBase include AASM::Generators::OrmHelpers namespace "mongoid:aasm" argument :column_name, type: :string, default: 'aasm_state' def ge...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/generators/aasm/orm_helpers.rb
lib/generators/aasm/orm_helpers.rb
module AASM module Generators module OrmHelpers def model_contents if column_name == 'aasm_state' <<RUBY include AASM aasm do end RUBY else <<RUBY include AASM aasm :column => '#{column_name}' do end RUBY end end private def column_exists? t...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/generators/aasm/aasm_generator.rb
lib/generators/aasm/aasm_generator.rb
require 'rails/generators/named_base' module AASM module Generators class AASMGenerator < Rails::Generators::NamedBase namespace "aasm" argument :column_name, type: :string, default: 'aasm_state' desc "Generates a model with the given NAME (if one does not exist) with aasm " << "block an...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/generators/active_record/aasm_generator.rb
lib/generators/active_record/aasm_generator.rb
require 'rails/generators/active_record' require 'generators/aasm/orm_helpers' module ActiveRecord module Generators class AASMGenerator < ActiveRecord::Generators::Base include AASM::Generators::OrmHelpers namespace "active_record:aasm" argument :column_name, type: :string, default: 'aasm_stat...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/generators/active_record/templates/migration_existing.rb
lib/generators/active_record/templates/migration_existing.rb
class Add<%= column_name.camelize %>To<%= table_name.camelize %> < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>] def change add_column :<%= table_name %>, :<%= column_name %>, :string end end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/generators/active_record/templates/migration.rb
lib/generators/active_record/templates/migration.rb
class AasmCreate<%= table_name.camelize %> < ActiveRecord::Migration[<%= ActiveRecord::VERSION::STRING.to_f %>] def change create_table(:<%= table_name %>) do |t| t.string :<%= column_name %> t.timestamps null: false end end end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/persistence.rb
lib/aasm/persistence.rb
module AASM module Persistence class << self def load_persistence(base) # Use a fancier auto-loading thingy, perhaps. When there are more persistence engines. hierarchy = base.ancestors.map {|klass| klass.to_s} if hierarchy.include?("ActiveRecord::Base") require_persiste...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/version.rb
lib/aasm/version.rb
module AASM VERSION = "5.5.2" end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/localizer.rb
lib/aasm/localizer.rb
module AASM class Localizer def human_event_name(klass, event) checklist = ancestors_list(klass).inject([]) do |list, ancestor| list << :"#{i18n_scope(klass)}.events.#{i18n_klass(ancestor)}.#{event}" list end translate_queue(checklist) || I18n.translate(checklist.shift, :default ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/state_machine.rb
lib/aasm/state_machine.rb
module AASM class StateMachine # the following four methods provide the storage of all state machines attr_accessor :states, :events, :initial_state, :config, :name, :global_callbacks def initialize(name) @initial_state = nil @states = [] @events = {} @global_callbacks = {} ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/errors.rb
lib/aasm/errors.rb
module AASM class UnknownStateMachineError < RuntimeError; end class InvalidTransition < RuntimeError attr_reader :object, :event_name, :originating_state, :failures, :state_machine_name def initialize(object, event_name, state_machine_name, failures = []) @object, @event_name, @originating_state, ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/minitest_spec.rb
lib/aasm/minitest_spec.rb
require 'aasm/minitest' module Minitest::Expectations AASM.infect_an_assertion :assert_transitions_from, :must_transition_from, :do_not_flip AASM.infect_an_assertion :refute_transitions_from, :wont_transition_from, :do_not_flip AASM.infect_an_assertion :assert_transition_to_allowed, :must_allow_transition_to, :...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/state_machine_store.rb
lib/aasm/state_machine_store.rb
require 'concurrent/map' module AASM class StateMachineStore @stores = Concurrent::Map.new class << self def stores @stores end # do not overwrite existing state machines, which could have been created by # inheritance, see AASM::ClassMethods method inherited def regis...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/instance_base.rb
lib/aasm/instance_base.rb
module AASM class InstanceBase attr_accessor :from_state, :to_state, :current_event def initialize(instance, name=:default) # instance of the class including AASM, name of the state machine @instance = instance @name = name end def current_state @instance.aasm_read_state(@name) ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/base.rb
lib/aasm/base.rb
require 'logger' module AASM class Base attr_reader :klass, :state_machine def initialize(klass, name, state_machine, options={}, &block) @klass = klass @name = name # @state_machine = klass.aasm(@name).state_machine @state_machine = state_machine @state_machine.config.column ...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/configuration.rb
lib/aasm/configuration.rb
module AASM class Configuration # for all persistence layers: which database column to use? attr_accessor :column # let's cry if the transition is invalid attr_accessor :whiny_transitions # for all persistence layers: create named scopes for each state attr_accessor :create_scopes # for...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/minitest.rb
lib/aasm/minitest.rb
Minitest = MiniTest unless defined? Minitest # relative-require all minitest_spec files Dir[File.dirname(__FILE__) + '/minitest/*.rb'].each do |file| require 'aasm/minitest/' + File.basename(file, File.extname(file)) end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/rspec.rb
lib/aasm/rspec.rb
# relative-require all rspec files Dir[File.dirname(__FILE__) + '/rspec/*.rb'].each do |file| require 'aasm/rspec/' + File.basename(file, File.extname(file)) end
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false
aasm/aasm
https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/lib/aasm/aasm.rb
lib/aasm/aasm.rb
module AASM # this is used internally as an argument default value to represent no value NO_VALUE = :_aasm_no_value # provide a state machine for the including class # make sure to load class methods as well # initialize persistence for the state machine def self.included(base) #:nodoc: base.extend AAS...
ruby
MIT
726a578808e0f403bfd24e505f9a45319670a6b7
2026-01-04T15:43:55.088186Z
false