class StateContextProxyWithoutConditionsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/state_context_test.rb, line 165 def setup @klass = Class.new(Validateable) machine = StateMachine::Machine.new(@klass, :initial => :parked) state = machine.state :parked @state_context = StateMachine::StateContext.new(state) @object = @klass.new @options = @state_context.validate[0] end
test_should_be_false_if_state_is_different()
click to toggle source
# File test/unit/state_context_test.rb, line 184 def test_should_be_false_if_state_is_different @object.state = nil assert !@options[:if].call(@object) end
test_should_be_true_if_state_matches()
click to toggle source
# File test/unit/state_context_test.rb, line 189 def test_should_be_true_if_state_matches assert @options[:if].call(@object) end
test_should_have_if_option()
click to toggle source
# File test/unit/state_context_test.rb, line 180 def test_should_have_if_option assert_not_nil @options[:if] end
test_should_have_options_configuration()
click to toggle source
# File test/unit/state_context_test.rb, line 176 def test_should_have_options_configuration assert_instance_of Hash, @options end