class MachineWithConflictingHelpersAfterDefinitionTest
Public Class Methods
human_state_event_name()
click to toggle source
# File test/unit/machine_test.rb, line 1631 def self.human_state_event_name :human_state_event_name end
human_state_name()
click to toggle source
# File test/unit/machine_test.rb, line 1627 def self.human_state_name :human_state_name end
with_state()
click to toggle source
# File test/unit/machine_test.rb, line 1611 def self.with_state :with_state end
with_states()
click to toggle source
# File test/unit/machine_test.rb, line 1615 def self.with_states :with_states end
without_state()
click to toggle source
# File test/unit/machine_test.rb, line 1619 def self.without_state :without_state end
without_states()
click to toggle source
# File test/unit/machine_test.rb, line 1623 def self.without_states :without_states end
Public Instance Methods
create_with_scope(name)
click to toggle source
# File test/unit/machine_test.rb, line 1673 def create_with_scope(name) lambda {|klass, values| []} end
create_without_scope(name)
click to toggle source
# File test/unit/machine_test.rb, line 1677 def create_without_scope(name) lambda {|klass, values| []} end
human_state_name()
click to toggle source
# File test/unit/machine_test.rb, line 1653 def human_state_name 'parked' end
setup()
click to toggle source
# File test/unit/machine_test.rb, line 1606 def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @klass = Class.new do def self.with_state :with_state end def self.with_states :with_states end def self.without_state :without_state end def self.without_states :without_states end def self.human_state_name :human_state_name end def self.human_state_event_name :human_state_event_name end attr_accessor :status def state 'parked' end def state=(value) self.status = value end def state? true end def state_name :parked end def human_state_name 'parked' end def state_events [:ignite] end def state_transitions [{:parked => :idling}] end def state_paths [[{:parked => :idling}]] end end StateMachine::Integrations.const_set('Custom', Module.new do include StateMachine::Integrations::Base def create_with_scope(name) lambda {|klass, values| []} end def create_without_scope(name) lambda {|klass, values| []} end end) @machine = StateMachine::Machine.new(@klass, :integration => :custom) @machine.state :parked, :idling @machine.event :ignite @object = @klass.new end
state()
click to toggle source
# File test/unit/machine_test.rb, line 1637 def state 'parked' end
state=(value)
click to toggle source
# File test/unit/machine_test.rb, line 1641 def state=(value) self.status = value end
state?()
click to toggle source
# File test/unit/machine_test.rb, line 1645 def state? true end
state_events()
click to toggle source
# File test/unit/machine_test.rb, line 1657 def state_events [:ignite] end
state_name()
click to toggle source
# File test/unit/machine_test.rb, line 1649 def state_name :parked end
state_paths()
click to toggle source
# File test/unit/machine_test.rb, line 1665 def state_paths [[{:parked => :idling}]] end
state_transitions()
click to toggle source
# File test/unit/machine_test.rb, line 1661 def state_transitions [{:parked => :idling}] end
teardown()
click to toggle source
# File test/unit/machine_test.rb, line 1829 def teardown $stderr = @original_stderr StateMachine::Integrations.send(:remove_const, 'Custom') end
test_should_allow_super_chaining()
click to toggle source
# File test/unit/machine_test.rb, line 1745 def test_should_allow_super_chaining @klass.class_eval do def self.with_state(*states) super end def self.with_states(*states) super end def self.without_state(*states) super end def self.without_states(*states) super end def self.human_state_name(state) super end def self.human_state_event_name(event) super end attr_accessor :status def state super end def state=(value) super end def state?(state) super end def state_name super end def human_state_name super end def state_events super end def state_transitions super end def state_paths super end end assert_equal [], @klass.with_state assert_equal [], @klass.with_states assert_equal [], @klass.without_state assert_equal [], @klass.without_states assert_equal 'parked', @klass.human_state_name(:parked) assert_equal 'ignite', @klass.human_state_event_name(:ignite) assert_equal nil, @object.state @object.state = 'idling' assert_equal 'idling', @object.state assert_equal nil, @object.status assert_equal false, @object.state?(:parked) assert_equal :idling, @object.state_name assert_equal 'idling', @object.human_state_name assert_equal [], @object.state_events assert_equal [], @object.state_transitions assert_equal [], @object.state_paths end
test_should_not_define_attribute_predicate()
click to toggle source
# File test/unit/machine_test.rb, line 1721 def test_should_not_define_attribute_predicate assert @object.state? end
test_should_not_output_warning()
click to toggle source
# File test/unit/machine_test.rb, line 1825 def test_should_not_output_warning assert_equal '', $stderr.string end
test_should_not_redefine_attribute_events_reader()
click to toggle source
# File test/unit/machine_test.rb, line 1733 def test_should_not_redefine_attribute_events_reader assert_equal [:ignite], @object.state_events end
test_should_not_redefine_attribute_human_name_reader()
click to toggle source
# File test/unit/machine_test.rb, line 1729 def test_should_not_redefine_attribute_human_name_reader assert_equal 'parked', @object.human_state_name end
test_should_not_redefine_attribute_name_reader()
click to toggle source
# File test/unit/machine_test.rb, line 1725 def test_should_not_redefine_attribute_name_reader assert_equal :parked, @object.state_name end
test_should_not_redefine_attribute_paths_reader()
click to toggle source
# File test/unit/machine_test.rb, line 1741 def test_should_not_redefine_attribute_paths_reader assert_equal [[{:parked => :idling}]], @object.state_paths end
test_should_not_redefine_attribute_transitions_reader()
click to toggle source
# File test/unit/machine_test.rb, line 1737 def test_should_not_redefine_attribute_transitions_reader assert_equal [{:parked => :idling}], @object.state_transitions end
test_should_not_redefine_attribute_writer()
click to toggle source
# File test/unit/machine_test.rb, line 1712 def test_should_not_redefine_attribute_writer assert_equal 'parked', @object.state end
test_should_not_redefine_human_attribute_name_reader()
click to toggle source
# File test/unit/machine_test.rb, line 1704 def test_should_not_redefine_human_attribute_name_reader assert_equal :human_state_name, @klass.human_state_name end
test_should_not_redefine_human_event_name_reader()
click to toggle source
# File test/unit/machine_test.rb, line 1708 def test_should_not_redefine_human_event_name_reader assert_equal :human_state_event_name, @klass.human_state_event_name end
test_should_not_redefine_plural_with_scope()
click to toggle source
# File test/unit/machine_test.rb, line 1692 def test_should_not_redefine_plural_with_scope assert_equal :with_states, @klass.with_states end
test_should_not_redefine_plural_without_scope()
click to toggle source
# File test/unit/machine_test.rb, line 1700 def test_should_not_redefine_plural_without_scope assert_equal :without_states, @klass.without_states end
test_should_not_redefine_singular_with_scope()
click to toggle source
# File test/unit/machine_test.rb, line 1688 def test_should_not_redefine_singular_with_scope assert_equal :with_state, @klass.with_state end
test_should_not_redefine_singular_without_scope()
click to toggle source
# File test/unit/machine_test.rb, line 1696 def test_should_not_redefine_singular_without_scope assert_equal :without_state, @klass.without_state end