1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/unit/abstract_class_spec.rb

28 lines
706 B
Ruby
Raw Normal View History

2019-04-21 05:43:51 -04:00
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)
2019-04-21 05:43:51 -04:00
end
expect(Person.aasm.states).to eq(Base.aasm.states)
2019-04-21 05:43:51 -04:00
end
it 'should have the same events as its parent' do
expect(Base.aasm.events).to eq(Person.aasm.events)
2019-04-21 05:43:51 -04:00
end
it 'should not break aasm methods when super class is abstract_class' do
person = Person.new
person.status = 'active'
person.deactivate!
expect(person.aasm.current_state).to eq(:inactive)
end
end
end