mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
deprecate usage of aasm_human_state (getter method)
This commit is contained in:
parent
399f73bc0e
commit
a4c39d5ade
4 changed files with 8 additions and 26 deletions
|
@ -13,6 +13,3 @@ require 'ostruct'
|
||||||
persistence
|
persistence
|
||||||
aasm
|
aasm
|
||||||
).each { |file| require File.join(File.dirname(__FILE__), 'aasm', file) }
|
).each { |file| require File.join(File.dirname(__FILE__), 'aasm', file) }
|
||||||
|
|
||||||
# load the deprecated methods and modules
|
|
||||||
Dir[File.join(File.dirname(__FILE__), 'aasm', 'deprecated', '*.rb')].sort.each { |f| require File.expand_path(f) }
|
|
||||||
|
|
|
@ -133,9 +133,9 @@ module AASM
|
||||||
aasm.events(state_name)
|
aasm.events(state_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# deprecated
|
# deprecated, remove this method in v4.0.0
|
||||||
def aasm_human_state
|
def aasm_human_state
|
||||||
# warn "#aasm_human_state is deprecated and will be removed in version 3.2.0; please use #aasm.human_state instead!"
|
warn "#aasm_human_state is deprecated and will be removed in version 4.0.0; please use #aasm.human_state instead!"
|
||||||
aasm.human_state
|
aasm.human_state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
module AASM
|
|
||||||
|
|
||||||
module ClassMethods
|
|
||||||
def human_event_name(*args)
|
|
||||||
warn "AASM.human_event_name is deprecated and will be removed in version 3.1.0; please use AASM.aasm_human_event_name instead!"
|
|
||||||
aasm_human_event_name(*args)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def human_state
|
|
||||||
warn "AASM#human_state is deprecated and will be removed in version 3.1.0; please use AASM#aasm_human_state instead!"
|
|
||||||
aasm_human_state
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -52,13 +52,13 @@ describe AASM::Localizer, "new style" do
|
||||||
let (:foo_opened) { LocalizerTestModel.new }
|
let (:foo_opened) { LocalizerTestModel.new }
|
||||||
let (:foo_closed) { LocalizerTestModel.new.tap { |x| x.aasm_state = :closed } }
|
let (:foo_closed) { LocalizerTestModel.new.tap { |x| x.aasm_state = :closed } }
|
||||||
|
|
||||||
context 'aasm_human_state' do
|
context 'aasm.human_state' do
|
||||||
it 'should return translated state value' do
|
it 'should return translated state value' do
|
||||||
foo_opened.aasm_human_state.should == "It's open now!"
|
foo_opened.aasm.human_state.should == "It's open now!"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return humanized value if not localized' do
|
it 'should return humanized value if not localized' do
|
||||||
foo_closed.aasm_human_state.should == "Closed"
|
foo_closed.aasm.human_state.should == "Closed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ describe AASM::Localizer, "deprecated style" do
|
||||||
let (:foo_opened) { LocalizerTestModel.new }
|
let (:foo_opened) { LocalizerTestModel.new }
|
||||||
let (:foo_closed) { LocalizerTestModel.new.tap { |x| x.aasm_state = :closed } }
|
let (:foo_closed) { LocalizerTestModel.new.tap { |x| x.aasm_state = :closed } }
|
||||||
|
|
||||||
context 'aasm_human_state' do
|
context 'aasm.human_state' do
|
||||||
it 'should return translated state value' do
|
it 'should return translated state value' do
|
||||||
foo_opened.aasm_human_state.should == "It's open now!"
|
foo_opened.aasm.human_state.should == "It's open now!"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return humanized value if not localized' do
|
it 'should return humanized value if not localized' do
|
||||||
foo_closed.aasm_human_state.should == "Closed"
|
foo_closed.aasm.human_state.should == "Closed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue