mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
let class names reflect its purpose (in tests)
This commit is contained in:
parent
c56583fb7a
commit
e607bd5c9d
4 changed files with 11 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
class AuthMachine
|
||||
class ComplexExample
|
||||
include AASM
|
||||
|
||||
attr_accessor :activation_code, :activated_at, :deleted_at
|
|
@ -1,4 +1,4 @@
|
|||
class Argument
|
||||
class ValidStateName
|
||||
include AASM
|
||||
aasm do
|
||||
state :invalid, :initial => true
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'on initialization' do
|
||||
let(:auth) {AuthMachine.new}
|
||||
let(:auth) {ComplexExample.new}
|
||||
|
||||
it 'should be in the pending state' do
|
||||
expect(auth.aasm.current_state).to eq(:pending)
|
||||
|
@ -14,7 +14,7 @@ describe 'on initialization' do
|
|||
end
|
||||
|
||||
describe 'when being unsuspended' do
|
||||
let(:auth) {AuthMachine.new}
|
||||
let(:auth) {ComplexExample.new}
|
||||
|
||||
it 'should be able to be unsuspended' do
|
||||
auth.activate!
|
||||
|
|
|
@ -62,11 +62,11 @@ describe 'inspection for common cases' do
|
|||
end
|
||||
|
||||
describe "special cases" do
|
||||
it "should support valid a state name" do
|
||||
expect(Argument.aasm.states).to include(:invalid)
|
||||
expect(Argument.aasm.states).to include(:valid)
|
||||
it "should support valid as state name" do
|
||||
expect(ValidStateName.aasm.states).to include(:invalid)
|
||||
expect(ValidStateName.aasm.states).to include(:valid)
|
||||
|
||||
argument = Argument.new
|
||||
argument = ValidStateName.new
|
||||
expect(argument.invalid?).to be_truthy
|
||||
expect(argument.aasm.current_state).to eq(:invalid)
|
||||
|
||||
|
@ -85,13 +85,13 @@ end
|
|||
|
||||
describe 'aasm.from_states_for_state' do
|
||||
it "should return all from states for a state" do
|
||||
expect(AuthMachine.aasm).to respond_to(:from_states_for_state)
|
||||
froms = AuthMachine.aasm.from_states_for_state(:active)
|
||||
expect(ComplexExample.aasm).to respond_to(:from_states_for_state)
|
||||
froms = ComplexExample.aasm.from_states_for_state(:active)
|
||||
[:pending, :passive, :suspended].each {|from| expect(froms).to include(from)}
|
||||
end
|
||||
|
||||
it "should return from states for a state for a particular transition only" do
|
||||
froms = AuthMachine.aasm.from_states_for_state(:active, :transition => :unsuspend)
|
||||
froms = ComplexExample.aasm.from_states_for_state(:active, :transition => :unsuspend)
|
||||
[:suspended].each {|from| expect(froms).to include(from)}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue