mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
added test for issue #19
This commit is contained in:
parent
3458f17f06
commit
dc4abd783f
2 changed files with 27 additions and 2 deletions
|
@ -54,3 +54,14 @@ class Banker
|
|||
def initialize(balance = 0); self.balance = balance; end
|
||||
def rich?; self.balance >= RICH; end
|
||||
end
|
||||
|
||||
class Argument
|
||||
include AASM
|
||||
aasm_initial_state :invalid
|
||||
aasm_state :invalid
|
||||
aasm_state :valid
|
||||
|
||||
aasm_event :valid do
|
||||
transitions :to => :valid, :from => [:invalid]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,6 +27,20 @@ describe AASM, '- class level definitions' do
|
|||
|
||||
end
|
||||
|
||||
describe "naming" do
|
||||
it "work for valid" do
|
||||
Argument.aasm_states.should include(:invalid)
|
||||
Argument.aasm_states.should include(:valid)
|
||||
|
||||
argument = Argument.new
|
||||
argument.invalid?.should be_true
|
||||
argument.aasm_current_state.should == :invalid
|
||||
|
||||
argument.valid!
|
||||
argument.valid?.should be_true
|
||||
argument.aasm_current_state.should == :valid
|
||||
end
|
||||
end
|
||||
|
||||
describe AASM, '- subclassing' do
|
||||
it 'should have the parent states' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue