Sha256: 65924d9be4814d7c94506524d9bb6807127fc170176b62cded9d0fe2bb9d3aa4
Contents?: true
Size: 1.27 KB
Versions: 14
Compression:
Stored size: 1.27 KB
Contents
require_relative '../../test_helper' require 'stringio' class StateWithConflictingMachineTest < StateMachinesTest def setup @original_stderr, $stderr = $stderr, StringIO.new @klass = Class.new @state_machine = StateMachines::Machine.new(@klass, :state) @state_machine.states << @state = StateMachines::State.new(@state_machine, :parked) end def test_should_output_warning_if_using_different_attribute @status_machine = StateMachines::Machine.new(@klass, :status) @status_machine.states << @state = StateMachines::State.new(@status_machine, :parked) assert_equal "State :parked for :status is already defined in :state\n", $stderr.string end def test_should_not_output_warning_if_using_same_attribute @status_machine = StateMachines::Machine.new(@klass, :status, attribute: :state) @status_machine.states << @state = StateMachines::State.new(@status_machine, :parked) assert_equal '', $stderr.string end def test_should_not_output_warning_if_using_different_namespace @status_machine = StateMachines::Machine.new(@klass, :status, namespace: 'alarm') @status_machine.states << @state = StateMachines::State.new(@status_machine, :parked) assert_equal '', $stderr.string end def teardown $stderr = @original_stderr end end
Version data entries
14 entries across 14 versions & 2 rubygems