From 8204eec9ac2256a93457d436693dd03af643f57a Mon Sep 17 00:00:00 2001 From: Arthur Shagall Date: Mon, 19 Jan 2015 00:19:11 -0600 Subject: [PATCH] Updating dependencies to support Rails 4.1. --- enum_state_machine.gemspec | 8 +- test/functional/state_machine_test.rb | 54 ++--- test/test_helper.rb | 14 +- test/unit/assertions_test.rb | 8 +- test/unit/branch_test.rb | 102 ++++---- test/unit/callback_test.rb | 58 ++--- test/unit/error_test.rb | 10 +- test/unit/eval_helpers_test.rb | 4 +- test/unit/event_collection_test.rb | 20 +- test/unit/event_test.rb | 108 ++++----- test/unit/graph_test.rb | 12 +- test/unit/helper_module_test.rb | 2 +- test/unit/integrations/active_model_test.rb | 8 +- test/unit/integrations/active_record_test.rb | 14 +- test/unit/integrations/base_test.rb | 4 +- test/unit/integrations_test.rb | 6 +- test/unit/invalid_event_test.rb | 2 +- test/unit/invalid_parallel_transition_test.rb | 2 +- test/unit/invalid_transition_test.rb | 6 +- test/unit/machine_collection_test.rb | 36 +-- test/unit/machine_test.rb | 223 +++++++++--------- test/unit/matcher_helpers_test.rb | 6 +- test/unit/matcher_test.rb | 14 +- test/unit/node_collection_test.rb | 44 ++-- test/unit/path_collection_test.rb | 22 +- test/unit/path_test.rb | 28 +-- test/unit/state_collection_test.rb | 24 +- test/unit/state_context_test.rb | 42 ++-- test/unit/state_enum_test.rb | 2 +- test/unit/state_machine_test.rb | 4 +- test/unit/state_test.rb | 106 ++++----- test/unit/transition_collection_test.rb | 90 +++---- test/unit/transition_test.rb | 90 +++---- 33 files changed, 593 insertions(+), 580 deletions(-) diff --git a/enum_state_machine.gemspec b/enum_state_machine.gemspec index 8d2c37a..a1d9752 100644 --- a/enum_state_machine.gemspec +++ b/enum_state_machine.gemspec @@ -17,19 +17,17 @@ Gem::Specification.new do |s| s.extra_rdoc_files = %w(README.md CHANGELOG.md LICENSE) s.license = 'MIT' - s.add_dependency "rails", "~> 4.0.13" + s.add_dependency "rails", "~> 4.0", "< 4.2" s.add_dependency "sqlite3", "~> 1.3.9" - s.add_dependency "activemodel", "~> 4.0.5" - s.add_dependency "activerecord", "~> 4.0.5" s.add_dependency "activerecord-deprecated_finders", "~> 1.0.3" s.add_dependency "protected_attributes", "~> 1.0.7" - s.add_dependency "rails-observers", "~> 0.1.2" + #s.add_dependency "rails-observers", "~> 0.1.2" s.add_dependency "power_enum", "~> 2.7" s.add_dependency "ruby-graphviz", "~> 1.0.9" s.add_development_dependency "rake" - s.add_development_dependency "minitest", "~> 4.7.5" + s.add_development_dependency "minitest", "~> 5.1" s.add_development_dependency "simplecov" s.add_development_dependency "yard" end diff --git a/test/functional/state_machine_test.rb b/test/functional/state_machine_test.rb index d16c0b6..7db7705 100644 --- a/test/functional/state_machine_test.rb +++ b/test/functional/state_machine_test.rb @@ -241,7 +241,7 @@ def color(transform = :to_s) end end -class VehicleTest < Test::Unit::TestCase +class VehicleTest < MiniTest::Test def setup @vehicle = Vehicle.new end @@ -259,7 +259,7 @@ def test_should_have_human_state_event_names end end -class VehicleUnsavedTest < Test::Unit::TestCase +class VehicleUnsavedTest < MiniTest::Test def setup @vehicle = Vehicle.new end @@ -269,12 +269,12 @@ def test_should_be_in_parked_state end def test_should_raise_exception_if_checking_invalid_state - assert_raise(IndexError) { @vehicle.state?(:invalid) } + assert_raises(IndexError) { @vehicle.state?(:invalid) } end def test_should_raise_exception_if_getting_name_of_invalid_state @vehicle.state = 'invalid' - assert_raise(ArgumentError) { @vehicle.state_name } + assert_raises(ArgumentError) { @vehicle.state_name } end def test_should_be_parked @@ -318,7 +318,7 @@ def test_should_be_able_to_ignite def test_should_have_a_transition_for_ignite transition = @vehicle.ignite_transition - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'idling', transition.to assert_equal :ignite, transition.event @@ -357,7 +357,7 @@ def test_should_allow_skipping_action_through_generic_event_runner end def test_should_raise_error_with_invalid_event_through_generic_event_runer - assert_raise(IndexError) { @vehicle.fire_state_event(:invalid) } + assert_raises(IndexError) { @vehicle.fire_state_event(:invalid) } end def test_should_allow_ignite @@ -438,7 +438,7 @@ def test_should_not_allow_cancelling_insurance end end -class VehicleParkedTest < Test::Unit::TestCase +class VehicleParkedTest < MiniTest::Test def setup @vehicle = Vehicle.new end @@ -481,7 +481,7 @@ def test_should_not_allow_repair end def test_should_raise_exception_if_repair_not_allowed! - exception = assert_raise(EnumStateMachine::InvalidTransition) {@vehicle.repair!} + exception = assert_raises(EnumStateMachine::InvalidTransition) {@vehicle.repair!} assert_equal @vehicle, exception.object assert_equal Vehicle.state_machine(:state), exception.machine assert_equal :repair, exception.event @@ -489,7 +489,7 @@ def test_should_raise_exception_if_repair_not_allowed! end end -class VehicleIdlingTest < Test::Unit::TestCase +class VehicleIdlingTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.ignite @@ -508,7 +508,7 @@ def test_should_have_seatbelt_on end def test_should_track_time_elapsed - assert_not_nil @vehicle.time_elapsed + refute_nil @vehicle.time_elapsed end def test_should_allow_park @@ -546,7 +546,7 @@ def test_should_not_allow_repair end end -class VehicleFirstGearTest < Test::Unit::TestCase +class VehicleFirstGearTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.ignite @@ -586,7 +586,7 @@ def test_should_not_allow_repair end end -class VehicleSecondGearTest < Test::Unit::TestCase +class VehicleSecondGearTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.ignite @@ -626,7 +626,7 @@ def test_should_not_allow_repair end end -class VehicleThirdGearTest < Test::Unit::TestCase +class VehicleThirdGearTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.ignite @@ -666,7 +666,7 @@ def test_should_not_allow_repair end end -class VehicleStalledTest < Test::Unit::TestCase +class VehicleStalledTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.ignite @@ -729,7 +729,7 @@ def test_should_not_allow_repair_if_auto_shop_is_available end end -class VehicleRepairedTest < Test::Unit::TestCase +class VehicleRepairedTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.ignite @@ -747,7 +747,7 @@ def test_should_not_have_a_busy_auto_shop end end -class VehicleLockedTest < Test::Unit::TestCase +class VehicleLockedTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.state = 'locked' @@ -774,7 +774,7 @@ def test_should_be_parked_after_shift_down end end -class VehicleWithParallelEventsTest < Test::Unit::TestCase +class VehicleWithParallelEventsTest < MiniTest::Test def setup @vehicle = Vehicle.new end @@ -793,7 +793,7 @@ def test_should_not_save_if_skipping_action end def test_should_raise_exception_if_any_event_cannot_transition_on_bang - exception = assert_raise(EnumStateMachine::InvalidParallelTransition) { @vehicle.fire_events!(:ignite, :cancel_insurance) } + exception = assert_raises(EnumStateMachine::InvalidParallelTransition) { @vehicle.fire_events!(:ignite, :cancel_insurance) } assert_equal @vehicle, exception.object assert_equal [:ignite, :cancel_insurance], exception.events end @@ -808,7 +808,7 @@ def test_should_not_save_if_skipping_action_on_bang end end -class VehicleWithEventAttributesTest < Test::Unit::TestCase +class VehicleWithEventAttributesTest < MiniTest::Test def setup @vehicle = Vehicle.new @vehicle.state_event = 'ignite' @@ -836,7 +836,7 @@ def test_should_transition_state_on_success end end -class MotorcycleTest < Test::Unit::TestCase +class MotorcycleTest < MiniTest::Test def setup @motorcycle = Motorcycle.new end @@ -880,7 +880,7 @@ def test_should_use_decibels_defined_in_state end end -class CarTest < Test::Unit::TestCase +class CarTest < MiniTest::Test def setup @car = Car.new end @@ -927,7 +927,7 @@ def test_should_allow_reverse end end -class CarBackingUpTest < Test::Unit::TestCase +class CarBackingUpTest < MiniTest::Test def setup @car = Car.new @car.reverse @@ -970,7 +970,7 @@ def test_should_not_allow_reverse end end -class AutoShopAvailableTest < Test::Unit::TestCase +class AutoShopAvailableTest < MiniTest::Test def setup @auto_shop = AutoShop.new end @@ -988,7 +988,7 @@ def test_should_not_allow_fix_vehicle end end -class AutoShopBusyTest < Test::Unit::TestCase +class AutoShopBusyTest < MiniTest::Test def setup @auto_shop = AutoShop.new @auto_shop.tow_vehicle @@ -1011,7 +1011,7 @@ def test_should_allow_fix_vehicle end end -class TrafficLightStopTest < Test::Unit::TestCase +class TrafficLightStopTest < MiniTest::Test def setup @light = TrafficLight.new @light.state = 'stop' @@ -1035,7 +1035,7 @@ def test_should_use_stop_capture_violations end end -class TrafficLightProceedTest < Test::Unit::TestCase +class TrafficLightProceedTest < MiniTest::Test def setup @light = TrafficLight.new @light.state = 'proceed' @@ -1050,7 +1050,7 @@ def test_should_use_proceed_capture_violations end end -class TrafficLightCautionTest < Test::Unit::TestCase +class TrafficLightCautionTest < MiniTest::Test def setup @light = TrafficLight.new @light.state = 'caution' diff --git a/test/test_helper.rb b/test/test_helper.rb index 9ab3e88..bf4c379 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,5 +3,17 @@ SimpleCov.start { add_filter '/test/' } end -require 'test/unit' +#require 'test/unit' +require 'minitest' +require "minitest/autorun" require 'enum_state_machine' + +class MiniTest::Test + def assert_nothing_raised + yield + rescue => ex + assert_nil ex + end + + alias_method :assert_nothing_thrown, :assert_nothing_raised +end diff --git a/test/unit/assertions_test.rb b/test/unit/assertions_test.rb index ffd8950..5a51f93 100644 --- a/test/unit/assertions_test.rb +++ b/test/unit/assertions_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class AssertionsBaseTest < Test::Unit::TestCase +class AssertionsBaseTest < MiniTest::Test include EnumStateMachine::Assertions def default_test @@ -13,7 +13,7 @@ def test_should_not_raise_exception_if_key_is_valid end def test_should_raise_exception_if_key_is_invalid - exception = assert_raise(ArgumentError) { assert_valid_keys({:name => 'foo', :value => 'bar', :invalid => true}, :name, :value, :force) } + exception = assert_raises(ArgumentError) { assert_valid_keys({:name => 'foo', :value => 'bar', :invalid => true}, :name, :value, :force) } assert_equal 'Invalid key(s): invalid', exception.message end end @@ -29,12 +29,12 @@ def test_should_not_raise_exception_if_one_key_found end def test_should_raise_exception_if_two_keys_found - exception = assert_raise(ArgumentError) { assert_exclusive_keys({:only => :parked, :except => :parked}, :only, :except) } + exception = assert_raises(ArgumentError) { assert_exclusive_keys({:only => :parked, :except => :parked}, :only, :except) } assert_equal 'Conflicting keys: only, except', exception.message end def test_should_raise_exception_if_multiple_keys_found - exception = assert_raise(ArgumentError) { assert_exclusive_keys({:only => :parked, :except => :parked, :on => :park}, :only, :except, :with) } + exception = assert_raises(ArgumentError) { assert_exclusive_keys({:only => :parked, :except => :parked, :on => :park}, :only, :except, :with) } assert_equal 'Conflicting keys: only, except', exception.message end end diff --git a/test/unit/branch_test.rb b/test/unit/branch_test.rb index ac16e89..804ed1d 100644 --- a/test/unit/branch_test.rb +++ b/test/unit/branch_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class BranchTest < Test::Unit::TestCase +class BranchTest < MiniTest::Test def setup @branch = EnumStateMachine::Branch.new(:from => :parked, :to => :idling) end @@ -22,12 +22,12 @@ def test_should_have_a_state_requirement end def test_should_raise_an_exception_if_invalid_match_option_specified - exception = assert_raise(ArgumentError) { @branch.match(Object.new, :invalid => true) } + exception = assert_raises(ArgumentError) { @branch.match(Object.new, :invalid => true) } assert_equal 'Invalid key(s): invalid', exception.message end end -class BranchWithNoRequirementsTest < Test::Unit::TestCase +class BranchWithNoRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new @@ -62,7 +62,7 @@ def test_should_include_all_requirements_in_match end end -class BranchWithFromRequirementTest < Test::Unit::TestCase +class BranchWithFromRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:from => :parked) @@ -106,7 +106,7 @@ def test_should_include_requirement_in_match end end -class BranchWithMultipleFromRequirementsTest < Test::Unit::TestCase +class BranchWithMultipleFromRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:from => [:idling, :parked]) @@ -125,7 +125,7 @@ def test_should_be_included_in_known_states end end -class BranchWithFromMatcherRequirementTest < Test::Unit::TestCase +class BranchWithFromMatcherRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:from => EnumStateMachine::BlacklistMatcher.new([:idling, :parked])) @@ -144,7 +144,7 @@ def test_include_values_in_known_states end end -class BranchWithToRequirementTest < Test::Unit::TestCase +class BranchWithToRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:to => :idling) @@ -188,7 +188,7 @@ def test_should_include_requirement_in_match end end -class BranchWithMultipleToRequirementsTest < Test::Unit::TestCase +class BranchWithMultipleToRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:to => [:idling, :parked]) @@ -207,7 +207,7 @@ def test_should_be_included_in_known_states end end -class BranchWithToMatcherRequirementTest < Test::Unit::TestCase +class BranchWithToMatcherRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:to => EnumStateMachine::BlacklistMatcher.new([:idling, :parked])) @@ -226,7 +226,7 @@ def test_include_values_in_known_states end end -class BranchWithOnRequirementTest < Test::Unit::TestCase +class BranchWithOnRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:on => :ignite) @@ -270,7 +270,7 @@ def test_should_include_requirement_in_match end end -class BranchWithMultipleOnRequirementsTest < Test::Unit::TestCase +class BranchWithMultipleOnRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:on => [:ignite, :park]) @@ -285,7 +285,7 @@ def test_should_not_match_if_not_included end end -class BranchWithOnMatcherRequirementTest < Test::Unit::TestCase +class BranchWithOnMatcherRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:on => EnumStateMachine::BlacklistMatcher.new([:ignite, :park])) @@ -300,7 +300,7 @@ def test_should_not_match_if_not_included end end -class BranchWithExceptFromRequirementTest < Test::Unit::TestCase +class BranchWithExceptFromRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:except_from => :parked) @@ -335,7 +335,7 @@ def test_should_be_included_in_known_states end end -class BranchWithMultipleExceptFromRequirementsTest < Test::Unit::TestCase +class BranchWithMultipleExceptFromRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:except_from => [:idling, :parked]) @@ -354,14 +354,14 @@ def test_should_be_included_in_known_states end end -class BranchWithExceptFromMatcherRequirementTest < Test::Unit::TestCase +class BranchWithExceptFromMatcherRequirementTest < MiniTest::Test def test_should_raise_an_exception - exception = assert_raise(ArgumentError) { EnumStateMachine::Branch.new(:except_from => EnumStateMachine::AllMatcher.instance) } + exception = assert_raises(ArgumentError) { EnumStateMachine::Branch.new(:except_from => EnumStateMachine::AllMatcher.instance) } assert_equal ':except_from option cannot use matchers; use :from instead', exception.message end end -class BranchWithExceptToRequirementTest < Test::Unit::TestCase +class BranchWithExceptToRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:except_to => :idling) @@ -396,7 +396,7 @@ def test_should_be_included_in_known_states end end -class BranchWithMultipleExceptToRequirementsTest < Test::Unit::TestCase +class BranchWithMultipleExceptToRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:except_to => [:idling, :parked]) @@ -415,14 +415,14 @@ def test_should_be_included_in_known_states end end -class BranchWithExceptToMatcherRequirementTest < Test::Unit::TestCase +class BranchWithExceptToMatcherRequirementTest < MiniTest::Test def test_should_raise_an_exception - exception = assert_raise(ArgumentError) { EnumStateMachine::Branch.new(:except_to => EnumStateMachine::AllMatcher.instance) } + exception = assert_raises(ArgumentError) { EnumStateMachine::Branch.new(:except_to => EnumStateMachine::AllMatcher.instance) } assert_equal ':except_to option cannot use matchers; use :to instead', exception.message end end -class BranchWithExceptOnRequirementTest < Test::Unit::TestCase +class BranchWithExceptOnRequirementTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:except_on => :ignite) @@ -457,14 +457,14 @@ def test_should_not_be_included_in_known_states end end -class BranchWithExceptOnMatcherRequirementTest < Test::Unit::TestCase +class BranchWithExceptOnMatcherRequirementTest < MiniTest::Test def test_should_raise_an_exception - exception = assert_raise(ArgumentError) { EnumStateMachine::Branch.new(:except_on => EnumStateMachine::AllMatcher.instance) } + exception = assert_raises(ArgumentError) { EnumStateMachine::Branch.new(:except_on => EnumStateMachine::AllMatcher.instance) } assert_equal ':except_on option cannot use matchers; use :on instead', exception.message end end -class BranchWithMultipleExceptOnRequirementsTest < Test::Unit::TestCase +class BranchWithMultipleExceptOnRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:except_on => [:ignite, :park]) @@ -479,28 +479,28 @@ def test_should_not_match_if_included end end -class BranchWithConflictingFromRequirementsTest < Test::Unit::TestCase +class BranchWithConflictingFromRequirementsTest < MiniTest::Test def test_should_raise_an_exception - exception = assert_raise(ArgumentError) { EnumStateMachine::Branch.new(:from => :parked, :except_from => :parked) } + exception = assert_raises(ArgumentError) { EnumStateMachine::Branch.new(:from => :parked, :except_from => :parked) } assert_equal 'Conflicting keys: from, except_from', exception.message end end -class BranchWithConflictingToRequirementsTest < Test::Unit::TestCase +class BranchWithConflictingToRequirementsTest < MiniTest::Test def test_should_raise_an_exception - exception = assert_raise(ArgumentError) { EnumStateMachine::Branch.new(:to => :idling, :except_to => :idling) } + exception = assert_raises(ArgumentError) { EnumStateMachine::Branch.new(:to => :idling, :except_to => :idling) } assert_equal 'Conflicting keys: to, except_to', exception.message end end -class BranchWithConflictingOnRequirementsTest < Test::Unit::TestCase +class BranchWithConflictingOnRequirementsTest < MiniTest::Test def test_should_raise_an_exception - exception = assert_raise(ArgumentError) { EnumStateMachine::Branch.new(:on => :ignite, :except_on => :ignite) } + exception = assert_raises(ArgumentError) { EnumStateMachine::Branch.new(:on => :ignite, :except_on => :ignite) } assert_equal 'Conflicting keys: on, except_on', exception.message end end -class BranchWithDifferentRequirementsTest < Test::Unit::TestCase +class BranchWithDifferentRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:from => :parked, :to => :idling, :on => :ignite) @@ -540,7 +540,7 @@ def test_should_not_duplicate_known_statse end end -class BranchWithNilRequirementsTest < Test::Unit::TestCase +class BranchWithNilRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:from => nil, :to => nil) @@ -567,7 +567,7 @@ def test_should_include_all_known_states end end -class BranchWithImplicitRequirementTest < Test::Unit::TestCase +class BranchWithImplicitRequirementTest < MiniTest::Test def setup @branch = EnumStateMachine::Branch.new(:parked => :idling, :on => :ignite) end @@ -586,7 +586,7 @@ def test_should_use_a_whitelist_to_matcher end end -class BranchWithMultipleImplicitRequirementsTest < Test::Unit::TestCase +class BranchWithMultipleImplicitRequirementsTest < MiniTest::Test def setup @object = Object.new @branch = EnumStateMachine::Branch.new(:parked => :idling, :idling => :first_gear, :on => :ignite) @@ -638,7 +638,7 @@ def test_should_not_duplicate_known_statse end end -class BranchWithImplicitFromRequirementMatcherTest < Test::Unit::TestCase +class BranchWithImplicitFromRequirementMatcherTest < MiniTest::Test def setup @matcher = EnumStateMachine::BlacklistMatcher.new(:parked) @branch = EnumStateMachine::Branch.new(@matcher => :idling) @@ -653,7 +653,7 @@ def test_should_convert_to_to_whitelist_matcher end end -class BranchWithImplicitToRequirementMatcherTest < Test::Unit::TestCase +class BranchWithImplicitToRequirementMatcherTest < MiniTest::Test def setup @matcher = EnumStateMachine::BlacklistMatcher.new(:idling) @branch = EnumStateMachine::Branch.new(:parked => @matcher) @@ -668,7 +668,7 @@ def test_should_not_convert_to_to_whitelist_matcher end end -class BranchWithImplicitAndExplicitRequirementsTest < Test::Unit::TestCase +class BranchWithImplicitAndExplicitRequirementsTest < MiniTest::Test def setup @branch = EnumStateMachine::Branch.new(:parked => :idling, :from => :parked) end @@ -690,14 +690,14 @@ def test_should_create_implicit_requirements_for_explicit_options end end -class BranchWithIfConditionalTest < Test::Unit::TestCase +class BranchWithIfConditionalTest < MiniTest::Test def setup @object = Object.new end def test_should_have_an_if_condition branch = EnumStateMachine::Branch.new(:if => lambda {true}) - assert_not_nil branch.if_condition + refute_nil branch.if_condition end def test_should_match_if_true @@ -716,7 +716,7 @@ def test_should_be_nil_if_unmatched end end -class BranchWithMultipleIfConditionalsTest < Test::Unit::TestCase +class BranchWithMultipleIfConditionalsTest < MiniTest::Test def setup @object = Object.new end @@ -735,14 +735,14 @@ def test_should_not_match_if_any_are_false end end -class BranchWithUnlessConditionalTest < Test::Unit::TestCase +class BranchWithUnlessConditionalTest < MiniTest::Test def setup @object = Object.new end def test_should_have_an_unless_condition branch = EnumStateMachine::Branch.new(:unless => lambda {true}) - assert_not_nil branch.unless_condition + refute_nil branch.unless_condition end def test_should_match_if_false @@ -761,7 +761,7 @@ def test_should_be_nil_if_unmatched end end -class BranchWithMultipleUnlessConditionalsTest < Test::Unit::TestCase +class BranchWithMultipleUnlessConditionalsTest < MiniTest::Test def setup @object = Object.new end @@ -780,7 +780,7 @@ def test_should_not_match_if_any_are_true end end -class BranchWithConflictingConditionalsTest < Test::Unit::TestCase +class BranchWithConflictingConditionalsTest < MiniTest::Test def setup @object = Object.new end @@ -806,7 +806,7 @@ def test_should_not_match_if_if_is_true_and_unless_is_true end end -class BranchWithoutGuardsTest < Test::Unit::TestCase +class BranchWithoutGuardsTest < MiniTest::Test def setup @object = Object.new end @@ -836,7 +836,7 @@ def test_should_match_if_unless_is_true # Load library require 'graphviz' - class BranchDrawingTest < Test::Unit::TestCase + class BranchDrawingTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) states = [:parked, :idling] @@ -866,7 +866,7 @@ def test_should_use_event_name_as_label end end - class BranchDrawingWithFromRequirementTest < Test::Unit::TestCase + class BranchDrawingWithFromRequirementTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) states = [:parked, :idling, :first_gear] @@ -887,7 +887,7 @@ def test_should_generate_edges_for_each_valid_from_state end end - class BranchDrawingWithExceptFromRequirementTest < Test::Unit::TestCase + class BranchDrawingWithExceptFromRequirementTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) states = [:parked, :idling, :first_gear] @@ -908,7 +908,7 @@ def test_should_generate_edges_for_each_valid_from_state end end - class BranchDrawingWithoutFromRequirementTest < Test::Unit::TestCase + class BranchDrawingWithoutFromRequirementTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) states = [:parked, :idling, :first_gear] @@ -929,7 +929,7 @@ def test_should_generate_edges_for_each_valid_from_state end end - class BranchDrawingWithoutToRequirementTest < Test::Unit::TestCase + class BranchDrawingWithoutToRequirementTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @@ -947,7 +947,7 @@ def test_should_create_loopback_edge end end - class BranchDrawingWithNilStateTest < Test::Unit::TestCase + class BranchDrawingWithNilStateTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) diff --git a/test/unit/callback_test.rb b/test/unit/callback_test.rb index 1651197..33536ab 100644 --- a/test/unit/callback_test.rb +++ b/test/unit/callback_test.rb @@ -1,8 +1,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class CallbackTest < Test::Unit::TestCase +class CallbackTest < MiniTest::Test def test_should_raise_exception_if_invalid_type_specified - exception = assert_raise(ArgumentError) { EnumStateMachine::Callback.new(:invalid) {} } + exception = assert_raises(ArgumentError) { EnumStateMachine::Callback.new(:invalid) {} } assert_equal 'Type must be :before, :after, :around, or :failure', exception.message end @@ -23,7 +23,7 @@ def test_should_not_raise_exception_if_using_failure_type end def test_should_raise_exception_if_no_methods_specified - exception = assert_raise(ArgumentError) { EnumStateMachine::Callback.new(:before) } + exception = assert_raises(ArgumentError) { EnumStateMachine::Callback.new(:before) } assert_equal 'Method(s) for callback must be specified', exception.message end @@ -52,7 +52,7 @@ def test_should_not_have_a_terminator end end -class CallbackByDefaultTest < Test::Unit::TestCase +class CallbackByDefaultTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before) {} end @@ -76,7 +76,7 @@ def test_should_not_have_any_known_states end end -class CallbackWithMethodArgumentTest < Test::Unit::TestCase +class CallbackWithMethodArgumentTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, lambda {|*args| @args = args}) @@ -93,7 +93,7 @@ def test_should_call_with_empty_context end end -class CallbackWithMultipleMethodArgumentsTest < Test::Unit::TestCase +class CallbackWithMultipleMethodArgumentsTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, :run_1, :run_2) @@ -121,7 +121,7 @@ def test_should_call_each_callback_in_order end end -class CallbackWithDoMethodTest < Test::Unit::TestCase +class CallbackWithDoMethodTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, :do => lambda {|*args| @args = args}) @@ -138,7 +138,7 @@ def test_should_call_with_empty_context end end -class CallbackWithMultipleDoMethodsTest < Test::Unit::TestCase +class CallbackWithMultipleDoMethodsTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, :do => [:run_1, :run_2]) @@ -166,7 +166,7 @@ def test_should_call_each_callback_in_order end end -class CallbackWithBlockTest < Test::Unit::TestCase +class CallbackWithBlockTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before) do |*args| @args = args @@ -185,7 +185,7 @@ def test_should_call_with_empty_context end end -class CallbackWithMixedMethodsTest < Test::Unit::TestCase +class CallbackWithMixedMethodsTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, :run_argument, :do => :run_do) do |object| object.callbacks << :block @@ -215,7 +215,7 @@ def test_should_call_each_callback_in_order end end -class CallbackWithExplicitRequirementsTest < Test::Unit::TestCase +class CallbackWithExplicitRequirementsTest < MiniTest::Test def setup @object = Object.new @callback = EnumStateMachine::Callback.new(:before, :from => :parked, :to => :idling, :on => :ignite, :do => lambda {}) @@ -246,7 +246,7 @@ def test_should_include_in_known_states end end -class CallbackWithImplicitRequirementsTest < Test::Unit::TestCase +class CallbackWithImplicitRequirementsTest < MiniTest::Test def setup @object = Object.new @callback = EnumStateMachine::Callback.new(:before, :parked => :idling, :on => :ignite, :do => lambda {}) @@ -277,7 +277,7 @@ def test_should_include_in_known_states end end -class CallbackWithIfConditionTest < Test::Unit::TestCase +class CallbackWithIfConditionTest < MiniTest::Test def setup @object = Object.new end @@ -293,7 +293,7 @@ def test_should_not_call_if_false end end -class CallbackWithUnlessConditionTest < Test::Unit::TestCase +class CallbackWithUnlessConditionTest < MiniTest::Test def setup @object = Object.new end @@ -309,7 +309,7 @@ def test_should_not_call_if_true end end -class CallbackWithoutTerminatorTest < Test::Unit::TestCase +class CallbackWithoutTerminatorTest < MiniTest::Test def setup @object = Object.new end @@ -320,7 +320,7 @@ def test_should_not_halt_if_result_is_false end end -class CallbackWithTerminatorTest < Test::Unit::TestCase +class CallbackWithTerminatorTest < MiniTest::Test def setup @object = Object.new end @@ -341,7 +341,7 @@ def test_should_halt_if_terminator_matches_any_method end end -class CallbackWithoutArgumentsTest < Test::Unit::TestCase +class CallbackWithoutArgumentsTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, :do => lambda {|object| @arg = object}) @@ -354,7 +354,7 @@ def test_should_call_method_with_object_as_argument end end -class CallbackWithArgumentsTest < Test::Unit::TestCase +class CallbackWithArgumentsTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, :do => lambda {|*args| @args = args}) @@ -367,7 +367,7 @@ def test_should_call_method_with_all_arguments end end -class CallbackWithUnboundMethodTest < Test::Unit::TestCase +class CallbackWithUnboundMethodTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:before, :do => lambda {|*args| @context = args.unshift(self)}) @@ -380,7 +380,7 @@ def test_should_call_method_outside_the_context_of_the_object end end -class CallbackWithBoundMethodTest < Test::Unit::TestCase +class CallbackWithBoundMethodTest < MiniTest::Test def setup @object = Object.new end @@ -414,7 +414,7 @@ def test_should_ignore_option_for_string_methods end end -class CallbackWithMultipleBoundMethodsTest < Test::Unit::TestCase +class CallbackWithMultipleBoundMethodsTest < MiniTest::Test def setup @object = Object.new @@ -434,7 +434,7 @@ def test_should_call_each_method_within_the_context_of_the_object end end -class CallbackWithApplicationBoundObjectTest < Test::Unit::TestCase +class CallbackWithApplicationBoundObjectTest < MiniTest::Test def setup @original_bind_to_object = EnumStateMachine::Callback.bind_to_object EnumStateMachine::Callback.bind_to_object = true @@ -456,7 +456,7 @@ def teardown end end -class CallbackWithBoundMethodAndArgumentsTest < Test::Unit::TestCase +class CallbackWithBoundMethodAndArgumentsTest < MiniTest::Test def setup @object = Object.new end @@ -483,7 +483,7 @@ def test_should_include_arguments_if_splat_used end end -class CallbackWithApplicationTerminatorTest < Test::Unit::TestCase +class CallbackWithApplicationTerminatorTest < MiniTest::Test def setup @original_terminator = EnumStateMachine::Callback.terminator EnumStateMachine::Callback.terminator = lambda {|result| result == false} @@ -506,7 +506,7 @@ def teardown end end -class CallbackWithAroundTypeAndBlockTest < Test::Unit::TestCase +class CallbackWithAroundTypeAndBlockTest < MiniTest::Test def setup @object = Object.new @callbacks = [] @@ -549,7 +549,7 @@ def test_should_halt_if_block_halts end end -class CallbackWithAroundTypeAndMultipleMethodsTest < Test::Unit::TestCase +class CallbackWithAroundTypeAndMultipleMethodsTest < MiniTest::Test def setup @callback = EnumStateMachine::Callback.new(:around, :run_1, :run_2) @@ -641,7 +641,7 @@ def run_2 end end -class CallbackWithAroundTypeAndArgumentsTest < Test::Unit::TestCase +class CallbackWithAroundTypeAndArgumentsTest < MiniTest::Test def setup @object = Object.new end @@ -665,7 +665,7 @@ def test_should_include_arguments_if_splat_used end end -class CallbackWithAroundTypeAndTerminatorTest < Test::Unit::TestCase +class CallbackWithAroundTypeAndTerminatorTest < MiniTest::Test def setup @object = Object.new end @@ -681,7 +681,7 @@ def test_should_not_halt_if_terminator_matches end end -class CallbackWithAroundTypeAndBoundMethodTest < Test::Unit::TestCase +class CallbackWithAroundTypeAndBoundMethodTest < MiniTest::Test def setup @object = Object.new end diff --git a/test/unit/error_test.rb b/test/unit/error_test.rb index 735c100..2802a9d 100644 --- a/test/unit/error_test.rb +++ b/test/unit/error_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class ErrorByDefaultTest < Test::Unit::TestCase +class ErrorByDefaultTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(@machine) @@ -20,24 +20,24 @@ def test_should_index_by_name end end -class ErrorWithMessageTest < Test::Unit::TestCase +class ErrorWithMessageTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(@machine) end def test_should_raise_exception_if_invalid_option_specified - exception = assert_raise(ArgumentError) { EnumStateMachine::NodeCollection.new(@machine, :invalid => true) } + exception = assert_raises(ArgumentError) { EnumStateMachine::NodeCollection.new(@machine, :invalid => true) } assert_equal 'Invalid key(s): invalid', exception.message end def test_should_raise_exception_on_lookup_if_invalid_index_specified - exception = assert_raise(ArgumentError) { @collection[:something, :invalid] } + exception = assert_raises(ArgumentError) { @collection[:something, :invalid] } assert_equal 'Invalid index: :invalid', exception.message end def test_should_raise_exception_on_fetch_if_invalid_index_specified - exception = assert_raise(ArgumentError) { @collection.fetch(:something, :invalid) } + exception = assert_raises(ArgumentError) { @collection.fetch(:something, :invalid) } assert_equal 'Invalid index: :invalid', exception.message end end diff --git a/test/unit/eval_helpers_test.rb b/test/unit/eval_helpers_test.rb index f8019ad..cdd9ce8 100644 --- a/test/unit/eval_helpers_test.rb +++ b/test/unit/eval_helpers_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class EvalHelpersBaseTest < Test::Unit::TestCase +class EvalHelpersBaseTest < MiniTest::Test include EnumStateMachine::EvalHelpers def default_test @@ -13,7 +13,7 @@ def setup end def test_should_raise_exception_if_method_is_not_symbol_string_or_proc - exception = assert_raise(ArgumentError) { evaluate_method(@object, 1) } + exception = assert_raises(ArgumentError) { evaluate_method(@object, 1) } assert_match(/Methods must/, exception.message) end end diff --git a/test/unit/event_collection_test.rb b/test/unit/event_collection_test.rb index b82a9c9..c2c4db8 100644 --- a/test/unit/event_collection_test.rb +++ b/test/unit/event_collection_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class EventCollectionByDefaultTest < Test::Unit::TestCase +class EventCollectionByDefaultTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -25,7 +25,7 @@ def test_should_not_have_any_transitions_for_an_object end end -class EventCollectionTest < Test::Unit::TestCase +class EventCollectionTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new, :namespace => 'alarm') @events = EnumStateMachine::EventCollection.new(machine) @@ -55,7 +55,7 @@ def test_should_index_by_string_qualified_name end end -class EventStringCollectionTest < Test::Unit::TestCase +class EventStringCollectionTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new, :namespace => 'alarm') @events = EnumStateMachine::EventCollection.new(machine) @@ -85,7 +85,7 @@ def test_should_index_by_symbol_qualified_name end end -class EventCollectionWithEventsWithTransitionsTest < Test::Unit::TestCase +class EventCollectionWithEventsWithTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -160,7 +160,7 @@ def test_should_allow_finding_valid_transitions_without_guards end end -class EventCollectionWithMultipleEventsTest < Test::Unit::TestCase +class EventCollectionWithMultipleEventsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -185,7 +185,7 @@ def test_should_only_include_all_valid_events_for_an_object end end -class EventCollectionWithoutMachineActionTest < Test::Unit::TestCase +class EventCollectionWithoutMachineActionTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -201,7 +201,7 @@ def test_should_not_have_an_attribute_transition end end -class EventCollectionAttributeWithMachineActionTest < Test::Unit::TestCase +class EventCollectionAttributeWithMachineActionTest < MiniTest::Test def setup @klass = Class.new do def save @@ -262,7 +262,7 @@ def test_should_use_transition_cache_if_both_event_and_transition_are_present end end -class EventCollectionAttributeWithNamespacedMachineTest < Test::Unit::TestCase +class EventCollectionAttributeWithNamespacedMachineTest < MiniTest::Test def setup @klass = Class.new do def save @@ -297,7 +297,7 @@ def test_should_have_valid_transition_if_event_can_be_fired end end -class EventCollectionWithValidationsTest < Test::Unit::TestCase +class EventCollectionWithValidationsTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base @@ -367,7 +367,7 @@ def teardown end end -class EventCollectionWithCustomMachineAttributeTest < Test::Unit::TestCase +class EventCollectionWithCustomMachineAttributeTest < MiniTest::Test def setup @klass = Class.new do def save diff --git a/test/unit/event_test.rb b/test/unit/event_test.rb index 07ae519..5d55faf 100644 --- a/test/unit/event_test.rb +++ b/test/unit/event_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class EventByDefaultTest < Test::Unit::TestCase +class EventByDefaultTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -58,7 +58,7 @@ def test_should_define_a_bang_action end end -class EventTest < Test::Unit::TestCase +class EventTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.events << @event = EnumStateMachine::Event.new(@machine, :ignite) @@ -91,7 +91,7 @@ def test_should_use_pretty_inspect end end -class EventWithHumanNameTest < Test::Unit::TestCase +class EventWithHumanNameTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -103,7 +103,7 @@ def test_should_use_custom_human_name end end -class EventWithDynamicHumanNameTest < Test::Unit::TestCase +class EventWithDynamicHumanNameTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -123,11 +123,11 @@ def test_should_allow_custom_class_to_be_passed_through end def test_should_not_cache_value - assert_not_same @event.human_name, @event.human_name + refute_same @event.human_name, @event.human_name end end -class EventWithConflictingHelpersBeforeDefinitionTest < Test::Unit::TestCase +class EventWithConflictingHelpersBeforeDefinitionTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -184,7 +184,7 @@ def teardown end end -class EventWithConflictingHelpersAfterDefinitionTest < Test::Unit::TestCase +class EventWithConflictingHelpersAfterDefinitionTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -249,7 +249,7 @@ def ignite! assert_equal false, @object.can_ignite? assert_equal nil, @object.ignite_transition assert_equal false, @object.ignite - assert_raise(EnumStateMachine::InvalidTransition) { @object.ignite! } + assert_raises(EnumStateMachine::InvalidTransition) { @object.ignite! } end def test_should_not_output_warning @@ -261,7 +261,7 @@ def teardown end end -class EventWithConflictingMachineTest < Test::Unit::TestCase +class EventWithConflictingMachineTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -308,7 +308,7 @@ def teardown end end -class EventWithNamespaceTest < Test::Unit::TestCase +class EventWithNamespaceTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :namespace => 'alarm') @@ -341,7 +341,7 @@ def test_should_namespace_bang_action end end -class EventContextTest < Test::Unit::TestCase +class EventContextTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -355,7 +355,7 @@ def test_should_evaluate_within_the_event end end -class EventTransitionsTest < Test::Unit::TestCase +class EventTransitionsTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.events << @event = EnumStateMachine::Event.new(@machine, :ignite) @@ -366,7 +366,7 @@ def test_should_not_raise_exception_if_implicit_option_specified end def test_should_not_allow_on_option - exception = assert_raise(ArgumentError) {@event.transition(:on => :ignite)} + exception = assert_raises(ArgumentError) {@event.transition(:on => :ignite)} assert_equal 'Invalid key(s): on', exception.message end @@ -377,7 +377,7 @@ def test_should_automatically_set_on_option end def test_should_not_allow_except_on_option - exception = assert_raise(ArgumentError) {@event.transition(:except_on => :ignite)} + exception = assert_raises(ArgumentError) {@event.transition(:except_on => :ignite)} assert_equal 'Invalid key(s): except_on', exception.message end @@ -415,7 +415,7 @@ def test_should_have_transitions end end -class EventAfterBeingCopiedTest < Test::Unit::TestCase +class EventAfterBeingCopiedTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.events << @event = EnumStateMachine::Event.new(@machine, :ignite) @@ -423,15 +423,15 @@ def setup end def test_should_not_have_the_same_collection_of_branches - assert_not_same @event.branches, @copied_event.branches + refute_same @event.branches, @copied_event.branches end def test_should_not_have_the_same_collection_of_known_states - assert_not_same @event.known_states, @copied_event.known_states + refute_same @event.known_states, @copied_event.known_states end end -class EventWithoutTransitionsTest < Test::Unit::TestCase +class EventWithoutTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -457,7 +457,7 @@ def test_should_not_change_the_current_state end end -class EventWithTransitionsTest < Test::Unit::TestCase +class EventWithTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -487,7 +487,7 @@ def test_should_use_pretty_inspect end end -class EventWithoutMatchingTransitionsTest < Test::Unit::TestCase +class EventWithoutMatchingTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -513,7 +513,7 @@ def test_should_not_have_a_transition end def test_should_have_a_transition_with_custom_from_state - assert_not_nil @event.transition_for(@object, :from => :parked) + refute_nil @event.transition_for(@object, :from => :parked) end def test_should_not_fire @@ -526,7 +526,7 @@ def test_should_not_change_the_current_state end end -class EventWithMatchingDisabledTransitionsTest < Test::Unit::TestCase +class EventWithMatchingDisabledTransitionsTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base @@ -567,7 +567,7 @@ def test_should_not_have_a_transition end def test_should_have_a_transition_with_disabled_guards - assert_not_nil @event.transition_for(@object, :guard => false) + refute_nil @event.transition_for(@object, :guard => false) end def test_should_not_fire @@ -624,7 +624,7 @@ def test_should_run_failure_callbacks object, transition = callback_args assert_equal @object, object - assert_not_nil transition + refute_nil transition assert_equal @object, transition.object assert_equal @machine, transition.machine assert_equal :ignite, transition.event @@ -637,7 +637,7 @@ def teardown end end -class EventWithMatchingEnabledTransitionsTest < Test::Unit::TestCase +class EventWithMatchingEnabledTransitionsTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base @@ -671,7 +671,7 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'idling', transition.to assert_equal :ignite, transition.event @@ -708,7 +708,7 @@ def teardown end end -class EventWithTransitionWithoutToStateTest < Test::Unit::TestCase +class EventWithTransitionWithoutToStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -727,7 +727,7 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'parked', transition.to assert_equal :park, transition.event @@ -743,7 +743,7 @@ def test_should_not_change_the_current_state end end -class EventWithTransitionWithNilToStateTest < Test::Unit::TestCase +class EventWithTransitionWithNilToStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -762,7 +762,7 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'idling', transition.from assert_equal nil, transition.to assert_equal :park, transition.event @@ -778,7 +778,7 @@ def test_should_not_change_the_current_state end end -class EventWithTransitionWithLoopbackStateTest < Test::Unit::TestCase +class EventWithTransitionWithLoopbackStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -797,7 +797,7 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'parked', transition.to assert_equal :park, transition.event @@ -813,7 +813,7 @@ def test_should_not_change_the_current_state end end -class EventWithTransitionWithBlacklistedToStateTest < Test::Unit::TestCase +class EventWithTransitionWithBlacklistedToStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -832,7 +832,7 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'first_gear', transition.to assert_equal :ignite, transition.event @@ -843,7 +843,7 @@ def test_should_allow_loopback_first_when_possible @object.state = 'second_gear' transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'second_gear', transition.from assert_equal 'second_gear', transition.to assert_equal :ignite, transition.event @@ -852,7 +852,7 @@ def test_should_allow_loopback_first_when_possible def test_should_allow_specific_transition_selection_using_to transition = @event.transition_for(@object, :from => :parked, :to => :second_gear) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'second_gear', transition.to assert_equal :ignite, transition.event @@ -873,7 +873,7 @@ def test_should_change_the_current_state end end -class EventWithTransitionWithWhitelistedToStateTest < Test::Unit::TestCase +class EventWithTransitionWithWhitelistedToStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -892,7 +892,7 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'first_gear', transition.to assert_equal :ignite, transition.event @@ -901,7 +901,7 @@ def test_should_have_a_transition def test_should_allow_specific_transition_selection_using_to transition = @event.transition_for(@object, :from => :parked, :to => :second_gear) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'second_gear', transition.to assert_equal :ignite, transition.event @@ -922,7 +922,7 @@ def test_should_change_the_current_state end end -class EventWithMultipleTransitionsTest < Test::Unit::TestCase +class EventWithMultipleTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -943,7 +943,7 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'idling', transition.to assert_equal :ignite, transition.event @@ -952,7 +952,7 @@ def test_should_have_a_transition def test_should_allow_specific_transition_selection_using_from transition = @event.transition_for(@object, :from => :idling) - assert_not_nil transition + refute_nil transition assert_equal 'idling', transition.from assert_equal 'idling', transition.to assert_equal :ignite, transition.event @@ -961,14 +961,14 @@ def test_should_allow_specific_transition_selection_using_from def test_should_allow_specific_transition_selection_using_to transition = @event.transition_for(@object, :from => :parked, :to => :parked) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'parked', transition.to assert_equal :ignite, transition.event end def test_should_not_allow_specific_transition_selection_using_on - exception = assert_raise(ArgumentError) { @event.transition_for(@object, :on => :park) } + exception = assert_raises(ArgumentError) { @event.transition_for(@object, :on => :park) } assert_equal 'Invalid key(s): on', exception.message end @@ -982,7 +982,7 @@ def test_should_change_the_current_state end end -class EventWithMachineActionTest < Test::Unit::TestCase +class EventWithMachineActionTest < MiniTest::Test def setup @klass = Class.new do attr_reader :saved @@ -1013,7 +1013,7 @@ def test_should_not_run_action_if_configured_to_skip end end -class EventWithInvalidCurrentStateTest < Test::Unit::TestCase +class EventWithInvalidCurrentStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -1027,22 +1027,22 @@ def setup end def test_should_raise_exception_when_checking_availability - exception = assert_raise(ArgumentError) { @event.can_fire?(@object) } + exception = assert_raises(ArgumentError) { @event.can_fire?(@object) } assert_equal '"invalid" is not a known state value', exception.message end def test_should_raise_exception_when_finding_transition - exception = assert_raise(ArgumentError) { @event.transition_for(@object) } + exception = assert_raises(ArgumentError) { @event.transition_for(@object) } assert_equal '"invalid" is not a known state value', exception.message end def test_should_raise_exception_when_firing - exception = assert_raise(ArgumentError) { @event.fire(@object) } + exception = assert_raises(ArgumentError) { @event.fire(@object) } assert_equal '"invalid" is not a known state value', exception.message end end -class EventOnFailureTest < Test::Unit::TestCase +class EventOnFailureTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base @@ -1081,7 +1081,7 @@ def test_should_run_failure_callbacks object, transition = callback_args assert_equal @object, object - assert_not_nil transition + refute_nil transition assert_equal @object, transition.object assert_equal @machine, transition.machine assert_equal :ignite, transition.event @@ -1094,7 +1094,7 @@ def teardown end end -class EventWithMarshallingTest < Test::Unit::TestCase +class EventWithMarshallingTest < MiniTest::Test def setup @klass = Class.new do def save @@ -1143,7 +1143,7 @@ def teardown # Load library require 'graphviz' - class EventDrawingTest < Test::Unit::TestCase + class EventDrawingTest < MiniTest::Test def setup states = [:parked, :idling, :first_gear] @@ -1170,7 +1170,7 @@ def test_should_use_event_name_for_edge_label end end - class EventDrawingWithHumanNameTest < Test::Unit::TestCase + class EventDrawingWithHumanNameTest < MiniTest::Test def setup states = [:parked, :idling] diff --git a/test/unit/graph_test.rb b/test/unit/graph_test.rb index 31e714e..5a4d336 100644 --- a/test/unit/graph_test.rb +++ b/test/unit/graph_test.rb @@ -8,7 +8,7 @@ def font (RUBY_PLATFORM =~ /darwin/) ? 'ArialMT' : 'Arial' end - class GraphDefaultTest < Test::Unit::TestCase + class GraphDefaultTest < MiniTest::Test def setup @graph = EnumStateMachine::Graph.new('test') end @@ -30,14 +30,14 @@ def test_should_have_a_default_orientation end end - class GraphNodesTest < Test::Unit::TestCase + class GraphNodesTest < MiniTest::Test def setup @graph = EnumStateMachine::Graph.new('test') @node = @graph.add_nodes('parked', :shape => 'ellipse') end def test_should_return_generated_node - assert_not_nil @node + refute_nil @node end def test_should_use_specified_name @@ -53,7 +53,7 @@ def test_should_set_default_font end end - class GraphEdgesTest < Test::Unit::TestCase + class GraphEdgesTest < MiniTest::Test def setup @graph = EnumStateMachine::Graph.new('test') @graph.add_nodes('parked', :shape => 'ellipse') @@ -62,7 +62,7 @@ def setup end def test_should_return_generated_edge - assert_not_nil @edge + refute_nil @edge end def test_should_use_specified_nodes @@ -79,7 +79,7 @@ def test_should_set_default_font end end - class GraphOutputTest < Test::Unit::TestCase + class GraphOutputTest < MiniTest::Test def setup @graph_name = "test_#{rand(1000000)}" @graph = EnumStateMachine::Graph.new(@graph_name) diff --git a/test/unit/helper_module_test.rb b/test/unit/helper_module_test.rb index 09399e0..97d5103 100644 --- a/test/unit/helper_module_test.rb +++ b/test/unit/helper_module_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class HelperModuleTest < Test::Unit::TestCase +class HelperModuleTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) diff --git a/test/unit/integrations/active_model_test.rb b/test/unit/integrations/active_model_test.rb index a5267fc..5401cfc 100644 --- a/test/unit/integrations/active_model_test.rb +++ b/test/unit/integrations/active_model_test.rb @@ -10,7 +10,7 @@ require 'active_support/all' module ActiveModelTest - class BaseTestCase < Test::Unit::TestCase + class BaseTestCase < MiniTest::Test def default_test end @@ -101,7 +101,7 @@ def test_should_have_no_defaults end def test_should_have_a_locale_path - assert_not_nil EnumStateMachine::Integrations::ActiveModel.locale_path + refute_nil EnumStateMachine::Integrations::ActiveModel.locale_path end end @@ -191,7 +191,7 @@ def test_should_have_an_attribute_predicate end def test_should_raise_exception_for_predicate_without_parameters - assert_raise(ArgumentError) { @record.state? } + assert_raises(ArgumentError) { @record.state? } end def test_should_return_false_for_predicate_if_does_not_match_current_value @@ -203,7 +203,7 @@ def test_should_return_true_for_predicate_if_matches_current_value end def test_should_raise_exception_for_predicate_if_invalid_state_specified - assert_raise(IndexError) { @record.state?(:invalid) } + assert_raises(IndexError) { @record.state?(:invalid) } end end diff --git a/test/unit/integrations/active_record_test.rb b/test/unit/integrations/active_record_test.rb index d48352a..2ef1d79 100644 --- a/test/unit/integrations/active_record_test.rb +++ b/test/unit/integrations/active_record_test.rb @@ -97,7 +97,7 @@ def test_should_have_defaults end def test_should_have_a_locale_path - assert_not_nil EnumStateMachine::Integrations::ActiveRecord.locale_path + refute_nil EnumStateMachine::Integrations::ActiveRecord.locale_path end end @@ -608,7 +608,7 @@ def test_should_return_true_for_predicate_if_matches_current_value end def test_should_raise_exception_for_predicate_if_invalid_state_specified - assert_raise(IndexError) { @record.state?(:invalid) } + assert_raises(IndexError) { @record.state?(:invalid) } end end @@ -670,7 +670,7 @@ def test_should_return_true_for_predicate_if_matches_current_value end def test_should_raise_exception_for_predicate_if_invalid_state_specified - assert_raise(IndexError) { @record.status?(:invalid) } + assert_raises(IndexError) { @record.status?(:invalid) } end def test_should_set_initial_state_on_created_object @@ -710,7 +710,7 @@ def setup end def test_should_not_delegate_attribute_predicate_with_different_attribute - assert_raise(ArgumentError) { @record.public_state? } + assert_raises(ArgumentError) { @record.public_state? } end def teardown @@ -800,7 +800,7 @@ def test_should_not_update_record end else def test_should_update_record - assert_not_equal @timestamp, @record.updated_at + refute_equal @timestamp, @record.updated_at end end end @@ -1775,12 +1775,12 @@ def setup def test_should_fail_if_event_is_invalid @record.state_event = 'invalid' - assert_raise(ActiveRecord::RecordInvalid) { @record.save! } + assert_raises(ActiveRecord::RecordInvalid) { @record.save! } end def test_should_fail_if_event_has_no_transition @record.state = 'idling' - assert_raise(ActiveRecord::RecordInvalid) { @record.save! } + assert_raises(ActiveRecord::RecordInvalid) { @record.save! } end def test_should_be_successful_if_event_has_transition diff --git a/test/unit/integrations/base_test.rb b/test/unit/integrations/base_test.rb index 9e2bbea..808f85b 100644 --- a/test/unit/integrations/base_test.rb +++ b/test/unit/integrations/base_test.rb @@ -4,7 +4,7 @@ require 'rubygems' module BaseTest - class IntegrationTest < Test::Unit::TestCase + class IntegrationTest < MiniTest::Test def test_should_have_an_integration_name assert_equal :base, EnumStateMachine::Integrations::Base.integration_name end @@ -26,7 +26,7 @@ def test_should_not_have_a_locale_path end end - class IncludedTest < Test::Unit::TestCase + class IncludedTest < MiniTest::Test def setup @integration = Module.new EnumStateMachine::Integrations.const_set('Custom', @integration) diff --git a/test/unit/integrations_test.rb b/test/unit/integrations_test.rb index e81a122..8680871 100644 --- a/test/unit/integrations_test.rb +++ b/test/unit/integrations_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class IntegrationMatcherTest < Test::Unit::TestCase +class IntegrationMatcherTest < MiniTest::Test def setup superclass = Class.new self.class.const_set('Vehicle', superclass) @@ -51,7 +51,7 @@ def teardown end end -class IntegrationFinderTest < Test::Unit::TestCase +class IntegrationFinderTest < MiniTest::Test def test_should_find_base assert_equal EnumStateMachine::Integrations::Base, EnumStateMachine::Integrations.find_by_name(:base) end @@ -65,7 +65,7 @@ def test_should_find_active_record end def test_should_raise_an_exception_if_invalid - exception = assert_raise(EnumStateMachine::IntegrationNotFound) { EnumStateMachine::Integrations.find_by_name(:invalid) } + exception = assert_raises(EnumStateMachine::IntegrationNotFound) { EnumStateMachine::Integrations.find_by_name(:invalid) } assert_equal ':invalid is an invalid integration', exception.message end end diff --git a/test/unit/invalid_event_test.rb b/test/unit/invalid_event_test.rb index 8023f0a..64481e3 100644 --- a/test/unit/invalid_event_test.rb +++ b/test/unit/invalid_event_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class InvalidEventTest < Test::Unit::TestCase +class InvalidEventTest < MiniTest::Test def setup @object = Object.new @invalid_event = EnumStateMachine::InvalidEvent.new(@object, :invalid) diff --git a/test/unit/invalid_parallel_transition_test.rb b/test/unit/invalid_parallel_transition_test.rb index 9edca02..d8ea49e 100644 --- a/test/unit/invalid_parallel_transition_test.rb +++ b/test/unit/invalid_parallel_transition_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class InvalidParallelTransitionTest < Test::Unit::TestCase +class InvalidParallelTransitionTest < MiniTest::Test def setup @object = Object.new @events = [:ignite, :disable_alarm] diff --git a/test/unit/invalid_transition_test.rb b/test/unit/invalid_transition_test.rb index 00b11d6..2060a5c 100644 --- a/test/unit/invalid_transition_test.rb +++ b/test/unit/invalid_transition_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class InvalidTransitionTest < Test::Unit::TestCase +class InvalidTransitionTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -46,7 +46,7 @@ def test_should_generate_a_message end end -class InvalidTransitionWithNamespaceTest < Test::Unit::TestCase +class InvalidTransitionWithNamespaceTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :namespace => 'alarm') @@ -76,7 +76,7 @@ def test_should_have_a_qualified_from_name end end -class InvalidTransitionWithIntegrationTest < Test::Unit::TestCase +class InvalidTransitionWithIntegrationTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base diff --git a/test/unit/machine_collection_test.rb b/test/unit/machine_collection_test.rb index 3fc1224..8c34f83 100644 --- a/test/unit/machine_collection_test.rb +++ b/test/unit/machine_collection_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class MachineCollectionByDefaultTest < Test::Unit::TestCase +class MachineCollectionByDefaultTest < MiniTest::Test def setup @machines = EnumStateMachine::MachineCollection.new end @@ -10,7 +10,7 @@ def test_should_not_have_any_machines end end -class MachineCollectionStateInitializationTest < Test::Unit::TestCase +class MachineCollectionStateInitializationTest < MiniTest::Test def setup @machines = EnumStateMachine::MachineCollection.new @@ -32,7 +32,7 @@ def initialize end def test_should_raise_exception_if_invalid_option_specified - assert_raise(ArgumentError) {@machines.initialize_states(@object, :invalid => true)} + assert_raises(ArgumentError) {@machines.initialize_states(@object, :invalid => true)} end def test_should_only_initialize_static_states_prior_to_block @@ -110,7 +110,7 @@ def test_should_not_initialize_existing_dynamic_states_if_not_forced end end -class MachineCollectionFireTest < Test::Unit::TestCase +class MachineCollectionFireTest < MiniTest::Test def setup @machines = EnumStateMachine::MachineCollection.new @@ -144,10 +144,10 @@ def save end def test_should_raise_exception_if_invalid_event_specified - exception = assert_raise(EnumStateMachine::InvalidEvent) { @machines.fire_events(@object, :invalid) } + exception = assert_raises(EnumStateMachine::InvalidEvent) { @machines.fire_events(@object, :invalid) } assert_equal :invalid, exception.event - exception = assert_raise(EnumStateMachine::InvalidEvent) { @machines.fire_events(@object, :ignite, :invalid) } + exception = assert_raises(EnumStateMachine::InvalidEvent) { @machines.fire_events(@object, :ignite, :invalid) } assert_equal :invalid, exception.event end @@ -189,7 +189,7 @@ def test_should_not_save_if_skipping_action end end -class MachineCollectionFireWithTransactionsTest < Test::Unit::TestCase +class MachineCollectionFireWithTransactionsTest < MiniTest::Test def setup @machines = EnumStateMachine::MachineCollection.new @@ -263,7 +263,7 @@ def teardown end end -class MachineCollectionFireWithValidationsTest < Test::Unit::TestCase +class MachineCollectionFireWithValidationsTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base @@ -331,7 +331,7 @@ def teardown end end -class MachineCollectionTransitionsWithoutEventsTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithoutEventsTest < MiniTest::Test def setup @klass = Class.new @@ -355,7 +355,7 @@ def test_should_perform end end -class MachineCollectionTransitionsWithBlankEventsTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithBlankEventsTest < MiniTest::Test def setup @klass = Class.new @@ -379,7 +379,7 @@ def test_should_perform end end -class MachineCollectionTransitionsWithInvalidEventsTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithInvalidEventsTest < MiniTest::Test def setup @klass = Class.new @@ -403,7 +403,7 @@ def test_should_not_perform end end -class MachineCollectionTransitionsWithoutTransitionTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithoutTransitionTest < MiniTest::Test def setup @klass = Class.new @@ -428,7 +428,7 @@ def test_should_not_perform end end -class MachineCollectionTransitionsWithTransitionTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithTransitionTest < MiniTest::Test def setup @klass = Class.new @@ -452,7 +452,7 @@ def test_should_perform end end -class MachineCollectionTransitionsWithSameActionsTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithSameActionsTest < MiniTest::Test def setup @klass = Class.new @@ -481,7 +481,7 @@ def test_should_perform end end -class MachineCollectionTransitionsWithDifferentActionsTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithDifferentActionsTest < MiniTest::Test def setup @klass = Class.new @@ -506,7 +506,7 @@ def test_should_only_select_matching_actions end end -class MachineCollectionTransitionsWithExisitingTransitionsTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithExisitingTransitionsTest < MiniTest::Test def setup @klass = Class.new @@ -530,7 +530,7 @@ def test_should_perform end end -class MachineCollectionTransitionsWithCustomOptionsTest < Test::Unit::TestCase +class MachineCollectionTransitionsWithCustomOptionsTest < MiniTest::Test def setup @klass = Class.new @@ -549,7 +549,7 @@ def test_should_use_custom_options end end -class MachineCollectionFireAttributesWithValidationsTest < Test::Unit::TestCase +class MachineCollectionFireAttributesWithValidationsTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :errors diff --git a/test/unit/machine_test.rb b/test/unit/machine_test.rb index 8df1c21..ee757e5 100644 --- a/test/unit/machine_test.rb +++ b/test/unit/machine_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class MachineByDefaultTest < Test::Unit::TestCase +class MachineByDefaultTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -24,7 +24,7 @@ def test_should_prefix_custom_attributes_with_attribute end def test_should_have_an_initial_state - assert_not_nil @machine.initial_state(@object) + refute_nil @machine.initial_state(@object) end def test_should_have_a_nil_initial_state @@ -171,7 +171,7 @@ def test_should_define_state_machines_reader end end -class MachineWithCustomNameTest < Test::Unit::TestCase +class MachineWithCustomNameTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :status) @@ -227,7 +227,7 @@ def test_should_define_a_human_event_name_reader_for_the_attribute end end -class MachineWithoutInitializationTest < Test::Unit::TestCase +class MachineWithoutInitializationTest < MiniTest::Test def setup @klass = Class.new do def initialize(attributes = {}) @@ -257,7 +257,7 @@ def initialize(attributes = {}) end end -class MachineWithStaticInitialStateTest < Test::Unit::TestCase +class MachineWithStaticInitialStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -316,7 +316,7 @@ def test_should_be_included_in_known_states end end -class MachineWithDynamicInitialStateTest < Test::Unit::TestCase +class MachineWithDynamicInitialStateTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :initial_state @@ -380,7 +380,7 @@ def test_should_not_be_included_in_known_states end end -class MachineStateInitializationTest < Test::Unit::TestCase +class MachineStateInitializationTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :state, :initial => :parked, :initialize => false) @@ -434,7 +434,7 @@ def test_should_not_write_to_object_if_writing_to_hash end end -class MachineWithCustomActionTest < Test::Unit::TestCase +class MachineWithCustomActionTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new, :action => :save) end @@ -444,7 +444,7 @@ def test_should_use_the_custom_action end end -class MachineWithNilActionTest < Test::Unit::TestCase +class MachineWithNilActionTest < MiniTest::Test def setup integration = Module.new do include EnumStateMachine::Integrations::Base @@ -464,7 +464,7 @@ def teardown end end -class MachineWithoutIntegrationTest < Test::Unit::TestCase +class MachineWithoutIntegrationTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -493,7 +493,7 @@ def test_errors_for_should_be_empty end end -class MachineWithCustomIntegrationTest < Test::Unit::TestCase +class MachineWithCustomIntegrationTest < MiniTest::Test def setup integration = Module.new do include EnumStateMachine::Integrations::Base @@ -561,7 +561,7 @@ def teardown end end -class MachineWithIntegrationTest < Test::Unit::TestCase +class MachineWithIntegrationTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base @@ -628,7 +628,7 @@ def teardown end end -class MachineWithActionUndefinedTest < Test::Unit::TestCase +class MachineWithActionUndefinedTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :action => :save) @@ -660,7 +660,7 @@ def test_should_not_mark_action_hook_as_defined end end -class MachineWithActionDefinedInClassTest < Test::Unit::TestCase +class MachineWithActionDefinedInClassTest < MiniTest::Test def setup @klass = Class.new do def save @@ -696,7 +696,7 @@ def test_should_not_mark_action_hook_as_defined end end -class MachineWithActionDefinedInIncludedModuleTest < Test::Unit::TestCase +class MachineWithActionDefinedInIncludedModuleTest < MiniTest::Test def setup @mod = mod = Module.new do def save @@ -740,7 +740,7 @@ def test_should_mark_action_hook_as_defined end end -class MachineWithActionDefinedInSuperclassTest < Test::Unit::TestCase +class MachineWithActionDefinedInSuperclassTest < MiniTest::Test def setup @superclass = Class.new do def save @@ -781,7 +781,7 @@ def test_should_mark_action_hook_as_defined end end -class MachineWithPrivateActionTest < Test::Unit::TestCase +class MachineWithPrivateActionTest < MiniTest::Test def setup @superclass = Class.new do private @@ -823,7 +823,7 @@ def test_should_mark_action_hook_as_defined end end -class MachineWithActionAlreadyOverriddenTest < Test::Unit::TestCase +class MachineWithActionAlreadyOverriddenTest < MiniTest::Test def setup @superclass = Class.new do def save @@ -845,7 +845,7 @@ def test_should_mark_action_hook_as_defined end end -class MachineWithCustomPluralTest < Test::Unit::TestCase +class MachineWithCustomPluralTest < MiniTest::Test def setup @integration = Module.new do include EnumStateMachine::Integrations::Base @@ -893,7 +893,7 @@ def teardown end end -class MachineWithCustomInvalidationTest < Test::Unit::TestCase +class MachineWithCustomInvalidationTest < MiniTest::Test def setup @integration = Module.new do include EnumStateMachine::Integrations::Base @@ -929,9 +929,9 @@ def teardown end end -class MachineTest < Test::Unit::TestCase +class MachineTest < MiniTest::Test def test_should_raise_exception_if_invalid_option_specified - assert_raise(ArgumentError) {EnumStateMachine::Machine.new(Class.new, :invalid => true)} + assert_raises(ArgumentError) {EnumStateMachine::Machine.new(Class.new, :invalid => true)} end def test_should_not_raise_exception_if_custom_messages_specified @@ -958,7 +958,7 @@ def test_should_provide_matcher_helpers_during_initialization end end -class MachineAfterBeingCopiedTest < Test::Unit::TestCase +class MachineAfterBeingCopiedTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new, :state, :initial => :parked) @machine.event(:ignite) {} @@ -971,11 +971,11 @@ def setup end def test_should_not_have_the_same_collection_of_states - assert_not_same @copied_machine.states, @machine.states + refute_same @copied_machine.states, @machine.states end def test_should_copy_each_state - assert_not_same @copied_machine.states[:parked], @machine.states[:parked] + refute_same @copied_machine.states[:parked], @machine.states[:parked] end def test_should_update_machine_for_each_state @@ -987,11 +987,11 @@ def test_should_not_update_machine_for_original_state end def test_should_not_have_the_same_collection_of_events - assert_not_same @copied_machine.events, @machine.events + refute_same @copied_machine.events, @machine.events end def test_should_copy_each_event - assert_not_same @copied_machine.events[:ignite], @machine.events[:ignite] + refute_same @copied_machine.events[:ignite], @machine.events[:ignite] end def test_should_update_machine_for_each_event @@ -1003,23 +1003,23 @@ def test_should_not_update_machine_for_original_event end def test_should_not_have_the_same_callbacks - assert_not_same @copied_machine.callbacks, @machine.callbacks + refute_same @copied_machine.callbacks, @machine.callbacks end def test_should_not_have_the_same_before_callbacks - assert_not_same @copied_machine.callbacks[:before], @machine.callbacks[:before] + refute_same @copied_machine.callbacks[:before], @machine.callbacks[:before] end def test_should_not_have_the_same_after_callbacks - assert_not_same @copied_machine.callbacks[:after], @machine.callbacks[:after] + refute_same @copied_machine.callbacks[:after], @machine.callbacks[:after] end def test_should_not_have_the_same_failure_callbacks - assert_not_same @copied_machine.callbacks[:failure], @machine.callbacks[:failure] + refute_same @copied_machine.callbacks[:failure], @machine.callbacks[:failure] end end -class MachineAfterChangingOwnerClassTest < Test::Unit::TestCase +class MachineAfterChangingOwnerClassTest < MiniTest::Test def setup @original_class = Class.new @machine = EnumStateMachine::Machine.new(@original_class) @@ -1048,7 +1048,7 @@ def test_should_not_change_the_associated_machine_in_the_original_class end end -class MachineAfterChangingInitialState < Test::Unit::TestCase +class MachineAfterChangingInitialState < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -1074,7 +1074,7 @@ def test_should_set_new_state_to_initial end end -class MachineWithHelpersTest < Test::Unit::TestCase +class MachineWithHelpersTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -1082,11 +1082,11 @@ def setup end def test_should_throw_exception_with_invalid_scope - assert_raise(RUBY_VERSION < '1.9' ? IndexError : KeyError) { @machine.define_helper(:invalid, :park) {} } + assert_raises(RUBY_VERSION < '1.9' ? IndexError : KeyError) { @machine.define_helper(:invalid, :park) {} } end end -class MachineWithInstanceHelpersTest < Test::Unit::TestCase +class MachineWithInstanceHelpersTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -1269,7 +1269,7 @@ def park end end -class MachineWithClassHelpersTest < Test::Unit::TestCase +class MachineWithClassHelpersTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -1451,7 +1451,7 @@ def states end end -class MachineWithConflictingHelpersBeforeDefinitionTest < Test::Unit::TestCase +class MachineWithConflictingHelpersBeforeDefinitionTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -1625,7 +1625,7 @@ def teardown end end -class MachineWithConflictingHelpersAfterDefinitionTest < Test::Unit::TestCase +class MachineWithConflictingHelpersAfterDefinitionTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -1868,7 +1868,7 @@ def teardown end end -class MachineWithSuperclassConflictingHelpersAfterDefinitionTest < Test::Unit::TestCase +class MachineWithSuperclassConflictingHelpersAfterDefinitionTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -1902,7 +1902,7 @@ def teardown end end -class MachineWithoutInitializeTest < Test::Unit::TestCase +class MachineWithoutInitializeTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -1914,7 +1914,7 @@ def test_should_initialize_state end end -class MachineWithInitializeWithoutSuperTest < Test::Unit::TestCase +class MachineWithInitializeWithoutSuperTest < MiniTest::Test def setup @klass = Class.new do def initialize @@ -1929,7 +1929,7 @@ def test_should_not_initialize_state end end -class MachineWithInitializeAndSuperTest < Test::Unit::TestCase +class MachineWithInitializeAndSuperTest < MiniTest::Test def setup @klass = Class.new do def initialize @@ -1945,7 +1945,7 @@ def test_should_initialize_state end end -class MachineWithInitializeArgumentsAndBlockTest < Test::Unit::TestCase +class MachineWithInitializeArgumentsAndBlockTest < MiniTest::Test def setup @superclass = Class.new do attr_reader :args @@ -1974,7 +1974,7 @@ def test_should_preserve_block end end -class MachineWithCustomInitializeTest < Test::Unit::TestCase +class MachineWithCustomInitializeTest < MiniTest::Test def setup @klass = Class.new do def initialize(state = nil, options = {}) @@ -1997,7 +1997,7 @@ def test_should_allow_custom_options end end -class MachinePersistenceTest < Test::Unit::TestCase +class MachinePersistenceTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :state_event @@ -2023,7 +2023,7 @@ def test_should_allow_reading_custom_instance_variables end @object.state_value = 1 - assert_raise(NoMethodError) { @machine.read(@object, :value) } + assert_raises(NoMethodError) { @machine.read(@object, :value) } assert_equal 1, @machine.read(@object, :value, true) end @@ -2042,14 +2042,14 @@ def test_should_allow_writing_custom_instance_variables attr_reader :state_value end - assert_raise(NoMethodError) { @machine.write(@object, :value, 1) } + assert_raises(NoMethodError) { @machine.write(@object, :value, 1) } assert_equal 1, @machine.write(@object, :value, 1, true) assert_equal 1, @object.state_value end end -class MachineWithStatesTest < Test::Unit::TestCase +class MachineWithStatesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2075,7 +2075,7 @@ def test_should_allow_human_state_name_lookup end def test_should_raise_exception_on_invalid_human_state_name_lookup - exception = assert_raise(IndexError) {@klass.human_state_name(:invalid)} + exception = assert_raises(IndexError) {@klass.human_state_name(:invalid)} assert_equal ':invalid is an invalid name', exception.message end @@ -2088,12 +2088,12 @@ def test_should_not_use_custom_matcher end def test_should_raise_exception_if_invalid_option_specified - exception = assert_raise(ArgumentError) {@machine.state(:first_gear, :invalid => true)} + exception = assert_raises(ArgumentError) {@machine.state(:first_gear, :invalid => true)} assert_equal 'Invalid key(s): invalid', exception.message end def test_should_raise_exception_if_conflicting_type_used_for_name - exception = assert_raise(ArgumentError) { @machine.state 'first_gear' } + exception = assert_raises(ArgumentError) { @machine.state 'first_gear' } assert_equal '"first_gear" state defined as String, :parked defined as Symbol; all states must be consistent', exception.message end @@ -2102,7 +2102,7 @@ def test_should_not_raise_exception_if_conflicting_type_is_nil_for_name end end -class MachineWithStatesWithCustomValuesTest < Test::Unit::TestCase +class MachineWithStatesWithCustomValuesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2121,7 +2121,7 @@ def test_should_allow_lookup_by_custom_value end end -class MachineWithStatesWithCustomHumanNamesTest < Test::Unit::TestCase +class MachineWithStatesWithCustomHumanNamesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2137,7 +2137,7 @@ def test_should_allow_human_state_name_lookup end end -class MachineWithStatesWithRuntimeDependenciesTest < Test::Unit::TestCase +class MachineWithStatesWithRuntimeDependenciesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2154,7 +2154,7 @@ def test_should_not_evaluate_if_not_initial_state end end -class MachineWithStateWithMatchersTest < Test::Unit::TestCase +class MachineWithStateWithMatchersTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2165,13 +2165,13 @@ def setup end def test_should_use_custom_matcher - assert_not_nil @state.matcher + refute_nil @state.matcher assert @state.matches?(1) assert !@state.matches?(nil) end end -class MachineWithCachedStateTest < Test::Unit::TestCase +class MachineWithCachedStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -2189,7 +2189,7 @@ def test_use_same_value_across_multiple_objects end end -class MachineWithStatesWithBehaviorsTest < Test::Unit::TestCase +class MachineWithStatesWithBehaviorsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2202,16 +2202,16 @@ def speed end def test_should_define_behaviors_for_each_state - assert_not_nil @parked.context_methods[:speed] - assert_not_nil @idling.context_methods[:speed] + refute_nil @parked.context_methods[:speed] + refute_nil @idling.context_methods[:speed] end def test_should_define_different_behaviors_for_each_state - assert_not_equal @parked.context_methods[:speed], @idling.context_methods[:speed] + refute_equal @parked.context_methods[:speed], @idling.context_methods[:speed] end end -class MachineWithExistingStateTest < Test::Unit::TestCase +class MachineWithExistingStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2236,7 +2236,7 @@ def test_should_be_able_to_look_up_state_by_new_value end end -class MachineWithStateMatchersTest < Test::Unit::TestCase +class MachineWithStateMatchersTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2251,7 +2251,7 @@ def test_should_return_referenced_states_for_blacklist_matcher end def test_should_not_allow_configurations - exception = assert_raise(ArgumentError) { @machine.state(EnumStateMachine::BlacklistMatcher.new([:parked]), :human_name => 'Parked') } + exception = assert_raises(ArgumentError) { @machine.state(EnumStateMachine::BlacklistMatcher.new([:parked]), :human_name => 'Parked') } assert_equal 'Cannot configure states when using matchers (using {:human_name=>"Parked"})', exception.message end @@ -2275,7 +2275,7 @@ def test_should_eval_context_for_matching_states end end -class MachineWithOtherStates < Test::Unit::TestCase +class MachineWithOtherStates < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -2295,7 +2295,7 @@ def test_should_not_create_matcher end end -class MachineWithEventsTest < Test::Unit::TestCase +class MachineWithEventsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2335,18 +2335,18 @@ def test_should_allow_human_state_name_lookup end def test_should_raise_exception_on_invalid_human_state_event_name_lookup - exception = assert_raise(IndexError) {@klass.human_state_event_name(:invalid)} + exception = assert_raises(IndexError) {@klass.human_state_event_name(:invalid)} assert_equal ':invalid is an invalid name', exception.message end def test_should_raise_exception_if_conflicting_type_used_for_name @machine.event :park - exception = assert_raise(ArgumentError) { @machine.event 'ignite' } + exception = assert_raises(ArgumentError) { @machine.event 'ignite' } assert_equal '"ignite" event defined as String, :park defined as Symbol; all events must be consistent', exception.message end end -class MachineWithExistingEventTest < Test::Unit::TestCase +class MachineWithExistingEventTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @event = @machine.event(:ignite) @@ -2362,7 +2362,7 @@ def test_should_allow_accessing_event_without_block end end -class MachineWithEventsWithCustomHumanNamesTest < Test::Unit::TestCase +class MachineWithEventsWithCustomHumanNamesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2378,7 +2378,7 @@ def test_should_allow_human_state_name_lookup end end -class MachineWithEventMatchersTest < Test::Unit::TestCase +class MachineWithEventMatchersTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2393,7 +2393,7 @@ def test_should_return_referenced_events_for_blacklist_matcher end def test_should_not_allow_configurations - exception = assert_raise(ArgumentError) { @machine.event(EnumStateMachine::BlacklistMatcher.new([:park]), :human_name => 'Park') } + exception = assert_raises(ArgumentError) { @machine.event(EnumStateMachine::BlacklistMatcher.new([:park]), :human_name => 'Park') } assert_equal 'Cannot configure events when using matchers (using {:human_name=>"Park"})', exception.message end @@ -2417,7 +2417,7 @@ def test_should_eval_context_for_matching_events end end -class MachineWithEventsWithTransitionsTest < Test::Unit::TestCase +class MachineWithEventsWithTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -2452,7 +2452,7 @@ def test_should_track_state_from_new_events end end -class MachineWithMultipleEventsTest < Test::Unit::TestCase +class MachineWithMultipleEventsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -2482,19 +2482,19 @@ def test_should_transition_the_same_for_each_event end end -class MachineWithTransitionsTest < Test::Unit::TestCase +class MachineWithTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) end def test_should_require_on_event - exception = assert_raise(ArgumentError) { @machine.transition(:parked => :idling) } + exception = assert_raises(ArgumentError) { @machine.transition(:parked => :idling) } assert_equal 'Must specify :on event', exception.message end def test_should_not_allow_except_on_option - exception = assert_raise(ArgumentError) {@machine.transition(:except_on => :ignite, :on => :ignite)} + exception = assert_raises(ArgumentError) {@machine.transition(:except_on => :ignite, :on => :ignite)} assert_equal 'Invalid key(s): except_on', exception.message end @@ -2568,7 +2568,7 @@ def test_should_not_modify_options end end -class MachineWithTransitionCallbacksTest < Test::Unit::TestCase +class MachineWithTransitionCallbacksTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :callbacks @@ -2588,7 +2588,7 @@ def test_should_not_raise_exception_if_implicit_option_specified end def test_should_raise_exception_if_method_not_specified - exception = assert_raise(ArgumentError) {@machine.before_transition :to => :idling} + exception = assert_raises(ArgumentError) {@machine.before_transition :to => :idling} assert_equal 'Method(s) for callback must be specified', exception.message end @@ -2711,7 +2711,7 @@ def test_should_define_predicates_for_each_state end end -class MachineWithFailureCallbacksTest < Test::Unit::TestCase +class MachineWithFailureCallbacksTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :callbacks @@ -2725,12 +2725,12 @@ def setup end def test_should_raise_exception_if_implicit_option_specified - exception = assert_raise(ArgumentError) {@machine.after_failure :invalid => :valid, :do => lambda {}} + exception = assert_raises(ArgumentError) {@machine.after_failure :invalid => :valid, :do => lambda {}} assert_equal 'Invalid key(s): invalid', exception.message end def test_should_raise_exception_if_method_not_specified - exception = assert_raise(ArgumentError) {@machine.after_failure :on => :ignite} + exception = assert_raises(ArgumentError) {@machine.after_failure :on => :ignite} assert_equal 'Method(s) for callback must be specified', exception.message end @@ -2757,7 +2757,7 @@ def test_should_allow_multiple_callbacks_with_requirements end end -class MachineWithPathsTest < Test::Unit::TestCase +class MachineWithPathsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2781,7 +2781,7 @@ def test_should_allow_requirement_configuration end end -class MachineWithOwnerSubclassTest < Test::Unit::TestCase +class MachineWithOwnerSubclassTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -2789,7 +2789,7 @@ def setup end def test_should_have_a_different_collection_of_state_machines - assert_not_same @klass.state_machines, @subclass.state_machines + refute_same @klass.state_machines, @subclass.state_machines end def test_should_have_the_same_attribute_associated_state_machines @@ -2797,7 +2797,7 @@ def test_should_have_the_same_attribute_associated_state_machines end end -class MachineWithExistingMachinesOnOwnerClassTest < Test::Unit::TestCase +class MachineWithExistingMachinesOnOwnerClassTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -2816,7 +2816,7 @@ def test_should_initialize_state_for_both_machines end end -class MachineWithExistingMachinesWithSameAttributesOnOwnerClassTest < Test::Unit::TestCase +class MachineWithExistingMachinesWithSameAttributesOnOwnerClassTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -2885,7 +2885,7 @@ def test_should_copy_all_existing_states_to_new_machines end end -class MachineWithExistingMachinesWithSameAttributesOnOwnerSubclassTest < Test::Unit::TestCase +class MachineWithExistingMachinesWithSameAttributesOnOwnerSubclassTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -2903,7 +2903,7 @@ def test_should_not_copy_sibling_machines_to_subclass_after_initialization def test_should_copy_sibling_machines_to_subclass_after_new_state subclass_machine = @subclass.state_machine(:state) {} subclass_machine.state :first_gear - assert_not_equal @klass.state_machine(:public_state), @subclass.state_machine(:public_state) + refute_equal @klass.state_machine(:public_state), @subclass.state_machine(:public_state) end def test_should_copy_new_states_to_sibling_machines @@ -2915,7 +2915,7 @@ def test_should_copy_new_states_to_sibling_machines end end -class MachineWithNamespaceTest < Test::Unit::TestCase +class MachineWithNamespaceTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :namespace => 'alarm', :initial => :active) do @@ -2961,7 +2961,7 @@ def test_should_namespace_bang_events end end -class MachineWithCustomAttributeTest < Test::Unit::TestCase +class MachineWithCustomAttributeTest < MiniTest::Test def setup EnumStateMachine::Integrations.const_set('Custom', Module.new do include EnumStateMachine::Integrations::Base @@ -3056,7 +3056,7 @@ def teardown end end -class MachineFinderWithoutExistingMachineTest < Test::Unit::TestCase +class MachineFinderWithoutExistingMachineTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.find_or_create(@klass) @@ -3072,7 +3072,7 @@ def test_should_accept_a_block end def test_should_create_a_new_machine - assert_not_nil @machine + refute_nil @machine end def test_should_use_default_state @@ -3080,7 +3080,7 @@ def test_should_use_default_state end end -class MachineFinderWithExistingOnSameClassTest < Test::Unit::TestCase +class MachineFinderWithExistingOnSameClassTest < MiniTest::Test def setup @klass = Class.new @existing_machine = EnumStateMachine::Machine.new(@klass) @@ -3101,7 +3101,7 @@ def test_should_not_create_a_new_machine end end -class MachineFinderWithExistingMachineOnSuperclassTest < Test::Unit::TestCase +class MachineFinderWithExistingMachineOnSuperclassTest < MiniTest::Test def setup integration = Module.new do include EnumStateMachine::Integrations::Base @@ -3141,13 +3141,13 @@ def test_should_not_create_a_new_machine_if_no_block_or_options def test_should_create_a_new_machine_if_given_options machine = EnumStateMachine::Machine.find_or_create(@klass, :status, :initial => :parked) - assert_not_nil machine - assert_not_same machine, @base_machine + refute_nil machine + refute_same machine, @base_machine end def test_should_create_a_new_machine_if_given_block - assert_not_nil @machine - assert_not_same @machine, @base_machine + refute_nil @machine + refute_same @machine, @base_machine end def test_should_copy_the_base_attribute @@ -3180,7 +3180,7 @@ def teardown end end -class MachineFinderCustomOptionsTest < Test::Unit::TestCase +class MachineFinderCustomOptionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.find_or_create(@klass, :status, :initial => :parked) @@ -3200,7 +3200,7 @@ def test_should_set_custom_initial_state # Load library require 'graphviz' - class MachineDrawingTest < Test::Unit::TestCase + class MachineDrawingTest < MiniTest::Test def setup @klass = Class.new do def self.name; @name ||= "Vehicle_#{rand(1000000)}"; end @@ -3212,7 +3212,7 @@ def self.name; @name ||= "Vehicle_#{rand(1000000)}"; end end def test_should_raise_exception_if_invalid_option_specified - assert_raise(ArgumentError) {@machine.draw(:invalid => true)} + assert_raises(ArgumentError) {@machine.draw(:invalid => true)} end def test_should_save_file_with_class_name_by_default @@ -3269,7 +3269,7 @@ def teardown end end - class MachineDrawingWithIntegerStatesTest < Test::Unit::TestCase + class MachineDrawingWithIntegerStatesTest < MiniTest::Test def setup @klass = Class.new do def self.name; @name ||= "Vehicle_#{rand(1000000)}"; end @@ -3300,7 +3300,7 @@ def teardown end end - class MachineDrawingWithNilStatesTest < Test::Unit::TestCase + class MachineDrawingWithNilStatesTest < MiniTest::Test def setup @klass = Class.new do def self.name; @name ||= "Vehicle_#{rand(1000000)}"; end @@ -3330,7 +3330,7 @@ def teardown end end - class MachineDrawingWithDynamicStatesTest < Test::Unit::TestCase + class MachineDrawingWithDynamicStatesTest < MiniTest::Test def setup @klass = Class.new do def self.name; @name ||= "Vehicle_#{rand(1000000)}"; end @@ -3360,7 +3360,10 @@ def teardown end end - class MachineClassDrawingTest < Test::Unit::TestCase + class MachineClassDrawingTest < MiniTest::Test + # Needed explicitly because of Simplecov weirdness + require File.expand_path("#{File.dirname(__FILE__)}/../files/switch") + def setup @klass = Class.new do def self.name; @name ||= "Vehicle_#{rand(1000000)}"; end @@ -3372,7 +3375,7 @@ def self.name; @name ||= "Vehicle_#{rand(1000000)}"; end end def test_should_raise_exception_if_no_class_names_specified - exception = assert_raise(ArgumentError) {EnumStateMachine::Machine.draw(nil)} + exception = assert_raises(ArgumentError) {EnumStateMachine::Machine.draw(nil)} assert_equal 'At least one class must be specified', exception.message end @@ -3383,11 +3386,11 @@ def test_should_load_files def test_should_allow_path_and_format_to_be_customized EnumStateMachine::Machine.draw('Switch', :file => File.expand_path("#{File.dirname(__FILE__)}/../files/switch.rb"), :path => "#{File.dirname(__FILE__)}/", :format => 'jpg') - assert File.exist?("#{File.dirname(__FILE__)}/#{Switch.name}_state.jpg") + assert File.exist?("#{File.dirname(__FILE__)}/#{::Switch.name}_state.jpg") end def teardown - FileUtils.rm Dir["{.,#{File.dirname(__FILE__)}}/#{Switch.name}_state.{jpg,png}"] + FileUtils.rm Dir["{.,#{File.dirname(__FILE__)}}/#{::Switch.name}_state.{jpg,png}"] end end rescue LoadError diff --git a/test/unit/matcher_helpers_test.rb b/test/unit/matcher_helpers_test.rb index 5fab21c..8d0b350 100644 --- a/test/unit/matcher_helpers_test.rb +++ b/test/unit/matcher_helpers_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class MatcherHelpersAllTest < Test::Unit::TestCase +class MatcherHelpersAllTest < MiniTest::Test include EnumStateMachine::MatcherHelpers def setup @@ -12,7 +12,7 @@ def test_should_build_an_all_matcher end end -class MatcherHelpersAnyTest < Test::Unit::TestCase +class MatcherHelpersAnyTest < MiniTest::Test include EnumStateMachine::MatcherHelpers def setup @@ -24,7 +24,7 @@ def test_should_build_an_all_matcher end end -class MatcherHelpersSameTest < Test::Unit::TestCase +class MatcherHelpersSameTest < MiniTest::Test include EnumStateMachine::MatcherHelpers def setup diff --git a/test/unit/matcher_test.rb b/test/unit/matcher_test.rb index e88d201..6a826a8 100644 --- a/test/unit/matcher_test.rb +++ b/test/unit/matcher_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class MatcherByDefaultTest < Test::Unit::TestCase +class MatcherByDefaultTest < MiniTest::Test def setup @matcher = EnumStateMachine::Matcher.new end @@ -14,7 +14,7 @@ def test_should_filter_all_values end end -class MatcherWithValueTest < Test::Unit::TestCase +class MatcherWithValueTest < MiniTest::Test def setup @matcher = EnumStateMachine::Matcher.new(nil) end @@ -28,7 +28,7 @@ def test_should_filter_unknown_values end end -class MatcherWithMultipleValuesTest < Test::Unit::TestCase +class MatcherWithMultipleValuesTest < MiniTest::Test def setup @matcher = EnumStateMachine::Matcher.new([:parked, :idling]) end @@ -42,7 +42,7 @@ def test_should_filter_unknown_values end end -class AllMatcherTest < Test::Unit::TestCase +class AllMatcherTest < MiniTest::Test def setup @matcher = EnumStateMachine::AllMatcher.instance end @@ -70,7 +70,7 @@ def test_should_have_a_description end end -class WhitelistMatcherTest < Test::Unit::TestCase +class WhitelistMatcherTest < MiniTest::Test def setup @matcher = EnumStateMachine::WhitelistMatcher.new([:parked, :idling]) end @@ -99,7 +99,7 @@ def test_should_have_a_description end end -class BlacklistMatcherTest < Test::Unit::TestCase +class BlacklistMatcherTest < MiniTest::Test def setup @matcher = EnumStateMachine::BlacklistMatcher.new([:parked, :idling]) end @@ -128,7 +128,7 @@ def test_should_have_a_description end end -class LoopbackMatcherTest < Test::Unit::TestCase +class LoopbackMatcherTest < MiniTest::Test def setup @matcher = EnumStateMachine::LoopbackMatcher.instance end diff --git a/test/unit/node_collection_test.rb b/test/unit/node_collection_test.rb index 46f500d..15d2645 100644 --- a/test/unit/node_collection_test.rb +++ b/test/unit/node_collection_test.rb @@ -6,7 +6,7 @@ def context end end -class NodeCollectionByDefaultTest < Test::Unit::TestCase +class NodeCollectionByDefaultTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(@machine) @@ -26,29 +26,29 @@ def test_should_index_by_name end end -class NodeCollectionTest < Test::Unit::TestCase +class NodeCollectionTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(@machine) end def test_should_raise_exception_if_invalid_option_specified - exception = assert_raise(ArgumentError) { EnumStateMachine::NodeCollection.new(@machine, :invalid => true) } + exception = assert_raises(ArgumentError) { EnumStateMachine::NodeCollection.new(@machine, :invalid => true) } assert_equal 'Invalid key(s): invalid', exception.message end def test_should_raise_exception_on_lookup_if_invalid_index_specified - exception = assert_raise(ArgumentError) { @collection[:something, :invalid] } + exception = assert_raises(ArgumentError) { @collection[:something, :invalid] } assert_equal 'Invalid index: :invalid', exception.message end def test_should_raise_exception_on_fetch_if_invalid_index_specified - exception = assert_raise(ArgumentError) { @collection.fetch(:something, :invalid) } + exception = assert_raises(ArgumentError) { @collection.fetch(:something, :invalid) } assert_equal 'Invalid index: :invalid', exception.message end end -class NodeCollectionAfterBeingCopiedTest < Test::Unit::TestCase +class NodeCollectionAfterBeingCopiedTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine) @@ -74,7 +74,7 @@ def test_should_not_modify_the_indices end def test_should_copy_each_node - assert_not_same @parked, @copied_collection[:parked] + refute_same @parked, @copied_collection[:parked] end def test_should_not_run_contexts @@ -92,7 +92,7 @@ def test_should_copy_contexts end end -class NodeCollectionWithoutIndicesTest < Test::Unit::TestCase +class NodeCollectionWithoutIndicesTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine, :index => {}) @@ -104,24 +104,24 @@ def test_should_allow_adding_node end def test_should_not_allow_keys_retrieval - exception = assert_raise(ArgumentError) { @collection.keys } + exception = assert_raises(ArgumentError) { @collection.keys } assert_equal 'No indices configured', exception.message end def test_should_not_allow_lookup @collection << Object.new - exception = assert_raise(ArgumentError) { @collection[0] } + exception = assert_raises(ArgumentError) { @collection[0] } assert_equal 'No indices configured', exception.message end def test_should_not_allow_fetching @collection << Object.new - exception = assert_raise(ArgumentError) { @collection.fetch(0) } + exception = assert_raises(ArgumentError) { @collection.fetch(0) } assert_equal 'No indices configured', exception.message end end -class NodeCollectionWithIndicesTest < Test::Unit::TestCase +class NodeCollectionWithIndicesTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine, :index => [:name, :value]) @@ -150,18 +150,18 @@ def test_should_allow_customizing_index_on_lookup def test_should_use_first_index_by_default_on_fetch assert_equal @object, @collection.fetch(:parked) - exception = assert_raise(IndexError) { @collection.fetch(1) } + exception = assert_raises(IndexError) { @collection.fetch(1) } assert_equal '1 is an invalid name', exception.message end def test_should_allow_customizing_index_on_fetch assert_equal @object, @collection.fetch(1, :value) - exception = assert_raise(IndexError) { @collection.fetch(:parked, :value) } + exception = assert_raises(IndexError) { @collection.fetch(:parked, :value) } assert_equal ':parked is an invalid value', exception.message end end -class NodeCollectionWithNodesTest < Test::Unit::TestCase +class NodeCollectionWithNodesTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(@machine) @@ -205,7 +205,7 @@ def test_should_deep_copy_machine_changes end end -class NodeCollectionAfterUpdateTest < Test::Unit::TestCase +class NodeCollectionAfterUpdateTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine, :index => [:name, :value]) @@ -239,7 +239,7 @@ def test_should_remove_each_old_indexed_key end end -class NodeCollectionWithStringIndexTest < Test::Unit::TestCase +class NodeCollectionWithStringIndexTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine, :index => [:name, :value]) @@ -257,7 +257,7 @@ def test_should_index_by_string_name end end -class NodeCollectionWithSymbolIndexTest < Test::Unit::TestCase +class NodeCollectionWithSymbolIndexTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine, :index => [:name, :value]) @@ -275,7 +275,7 @@ def test_should_index_by_symbol_name end end -class NodeCollectionWithNumericIndexTest < Test::Unit::TestCase +class NodeCollectionWithNumericIndexTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine, :index => [:name, :value]) @@ -297,7 +297,7 @@ def test_should_index_by_symbol_name end end -class NodeCollectionWithPredefinedContextsTest < Test::Unit::TestCase +class NodeCollectionWithPredefinedContextsTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine) @@ -318,7 +318,7 @@ def test_should_not_run_contexts_if_not_matched end end -class NodeCollectionWithPostdefinedContextsTest < Test::Unit::TestCase +class NodeCollectionWithPostdefinedContextsTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine) @@ -338,7 +338,7 @@ def test_should_not_run_contexts_if_not_matched end end -class NodeCollectionWithMatcherContextsTest < Test::Unit::TestCase +class NodeCollectionWithMatcherContextsTest < MiniTest::Test def setup machine = EnumStateMachine::Machine.new(Class.new) @collection = EnumStateMachine::NodeCollection.new(machine) diff --git a/test/unit/path_collection_test.rb b/test/unit/path_collection_test.rb index 82e2194..5e95101 100644 --- a/test/unit/path_collection_test.rb +++ b/test/unit/path_collection_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class PathCollectionByDefaultTest < Test::Unit::TestCase +class PathCollectionByDefaultTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -45,7 +45,7 @@ def test_should_have_no_paths end end -class PathCollectionTest < Test::Unit::TestCase +class PathCollectionTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -53,22 +53,22 @@ def setup end def test_should_raise_exception_if_invalid_option_specified - exception = assert_raise(ArgumentError) {EnumStateMachine::PathCollection.new(@object, @machine, :invalid => true)} + exception = assert_raises(ArgumentError) {EnumStateMachine::PathCollection.new(@object, @machine, :invalid => true)} assert_equal 'Invalid key(s): invalid', exception.message end def test_should_raise_exception_if_invalid_from_state_specified - exception = assert_raise(IndexError) {EnumStateMachine::PathCollection.new(@object, @machine, :from => :invalid)} + exception = assert_raises(IndexError) {EnumStateMachine::PathCollection.new(@object, @machine, :from => :invalid)} assert_equal ':invalid is an invalid name', exception.message end def test_should_raise_exception_if_invalid_to_state_specified - exception = assert_raise(IndexError) {EnumStateMachine::PathCollection.new(@object, @machine, :to => :invalid)} + exception = assert_raises(IndexError) {EnumStateMachine::PathCollection.new(@object, @machine, :to => :invalid)} assert_equal ':invalid is an invalid name', exception.message end end -class PathCollectionWithPathsTest < Test::Unit::TestCase +class PathCollectionWithPathsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -114,7 +114,7 @@ def test_should_have_no_events end end -class PathWithGuardedPathsTest < Test::Unit::TestCase +class PathWithGuardedPathsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -139,7 +139,7 @@ def test_should_enumerate_paths_if_guard_disabled end end -class PathCollectionWithDuplicateNodesTest < Test::Unit::TestCase +class PathCollectionWithDuplicateNodesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -169,7 +169,7 @@ def test_should_not_include_duplicates_in_events end end -class PathCollectionWithFromStateTest < Test::Unit::TestCase +class PathCollectionWithFromStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -195,7 +195,7 @@ def test_should_have_a_from_name end end -class PathCollectionWithToStateTest < Test::Unit::TestCase +class PathCollectionWithToStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -223,7 +223,7 @@ def test_should_stop_paths_once_target_state_reached end end -class PathCollectionWithDeepPathsTest < Test::Unit::TestCase +class PathCollectionWithDeepPathsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) diff --git a/test/unit/path_test.rb b/test/unit/path_test.rb index 555c6ac..c1ba77a 100644 --- a/test/unit/path_test.rb +++ b/test/unit/path_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class PathByDefaultTest < Test::Unit::TestCase +class PathByDefaultTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -52,7 +52,7 @@ def test_should_not_be_complete end end -class PathTest < Test::Unit::TestCase +class PathTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -60,12 +60,12 @@ def setup end def test_should_raise_exception_if_invalid_option_specified - exception = assert_raise(ArgumentError) {EnumStateMachine::Path.new(@object, @machine, :invalid => true)} + exception = assert_raises(ArgumentError) {EnumStateMachine::Path.new(@object, @machine, :invalid => true)} assert_equal 'Invalid key(s): invalid', exception.message end end -class PathWithoutTransitionsTest < Test::Unit::TestCase +class PathWithoutTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -87,7 +87,7 @@ def test_should_not_be_able_to_walk_anywhere end end -class PathWithTransitionsTest < Test::Unit::TestCase +class PathWithTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -139,7 +139,7 @@ def test_should_be_complete end end -class PathWithDuplicatesTest < Test::Unit::TestCase +class PathWithDuplicatesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -170,7 +170,7 @@ def test_should_not_include_duplicates_in_events end end -class PathWithAvailableTransitionsTest < Test::Unit::TestCase +class PathWithAvailableTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -223,7 +223,7 @@ def test_should_not_modify_object_after_walking end end -class PathWithGuardedTransitionsTest < Test::Unit::TestCase +class PathWithGuardedTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -264,7 +264,7 @@ def test_should_not_walk_transitions_if_guard_disabled end end -class PathWithEncounteredTransitionsTest < Test::Unit::TestCase +class PathWithEncounteredTransitionsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -297,7 +297,7 @@ def test_should_not_be_able_to_walk end end -class PathWithUnreachedTargetTest < Test::Unit::TestCase +class PathWithUnreachedTargetTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -326,7 +326,7 @@ def test_should_not_be_able_to_walk end end -class PathWithReachedTargetTest < Test::Unit::TestCase +class PathWithReachedTargetTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -359,7 +359,7 @@ def test_should_not_be_able_to_walk end end -class PathWithAvailableTransitionsAfterReachingTargetTest < Test::Unit::TestCase +class PathWithAvailableTransitionsAfterReachingTargetTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -397,7 +397,7 @@ def test_should_be_able_to_walk end end -class PathWithDeepTargetTest < Test::Unit::TestCase +class PathWithDeepTargetTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -436,7 +436,7 @@ def test_should_be_able_to_walk end end -class PathWithDeepTargetReachedTest < Test::Unit::TestCase +class PathWithDeepTargetReachedTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) diff --git a/test/unit/state_collection_test.rb b/test/unit/state_collection_test.rb index 1e20ca0..a07f201 100644 --- a/test/unit/state_collection_test.rb +++ b/test/unit/state_collection_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class StateCollectionByDefaultTest < Test::Unit::TestCase +class StateCollectionByDefaultTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @states = EnumStateMachine::StateCollection.new(@machine) @@ -19,7 +19,7 @@ def test_should_be_empty_by_priority end end -class StateCollectionTest < Test::Unit::TestCase +class StateCollectionTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -67,7 +67,7 @@ def test_should_match_if_value_matches end def test_raise_exception_if_matching_invalid_state - assert_raise(IndexError) { @states.matches?(@object, :invalid) } + assert_raises(IndexError) { @states.matches?(@object, :invalid) } end def test_should_find_state_for_object_if_value_is_known @@ -87,12 +87,12 @@ def test_should_not_find_state_for_object_with_unknown_value def test_should_raise_exception_if_finding_bang_state_for_object_with_unknown_value @object.state = 'invalid' - exception = assert_raise(ArgumentError) { @states.match!(@object) } + exception = assert_raises(ArgumentError) { @states.match!(@object) } assert_equal '"invalid" is not a known state value', exception.message end end -class StateCollectionStringTest < Test::Unit::TestCase +class StateCollectionStringTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -126,7 +126,7 @@ def test_should_index_by_symbol_qualified_name end end -class StateCollectionWithNamespaceTest < Test::Unit::TestCase +class StateCollectionWithNamespaceTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :namespace => 'vehicle') @@ -145,7 +145,7 @@ def test_should_index_by_qualified_name end end -class StateCollectionWithCustomStateValuesTest < Test::Unit::TestCase +class StateCollectionWithCustomStateValuesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -172,7 +172,7 @@ def test_should_find_state_for_object_if_value_is_known end end -class StateCollectionWithStateMatchersTest < Test::Unit::TestCase +class StateCollectionWithStateMatchersTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -199,7 +199,7 @@ def test_should_find_state_for_object_if_value_is_known end end -class StateCollectionWithInitialStateTest < Test::Unit::TestCase +class StateCollectionWithInitialStateTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @states = EnumStateMachine::StateCollection.new(@machine) @@ -237,7 +237,7 @@ def test_should_order_state_before_callback_states end end -class StateCollectionWithStateBehaviorsTest < Test::Unit::TestCase +class StateCollectionWithStateBehaviorsTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @states = EnumStateMachine::StateCollection.new(@machine) @@ -275,7 +275,7 @@ def test_should_order_state_before_callback_states end end -class StateCollectionWithEventTransitionsTest < Test::Unit::TestCase +class StateCollectionWithEventTransitionsTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @states = EnumStateMachine::StateCollection.new(@machine) @@ -313,7 +313,7 @@ def test_should_order_state_before_callback_states end end -class StateCollectionWithTransitionCallbacksTest < Test::Unit::TestCase +class StateCollectionWithTransitionCallbacksTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @states = EnumStateMachine::StateCollection.new(@machine) diff --git a/test/unit/state_context_test.rb b/test/unit/state_context_test.rb index ea0929b..4deac67 100644 --- a/test/unit/state_context_test.rb +++ b/test/unit/state_context_test.rb @@ -9,7 +9,7 @@ def validate(*args, &block) end end -class StateContextTest < Test::Unit::TestCase +class StateContextTest < MiniTest::Test def setup @klass = Class.new(Validateable) @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -27,7 +27,7 @@ def test_should_have_a_state end end -class StateContextTransitionTest < Test::Unit::TestCase +class StateContextTransitionTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -37,37 +37,37 @@ def setup end def test_should_not_allow_except_to - exception = assert_raise(ArgumentError) { @state_context.transition(:except_to => :idling) } + exception = assert_raises(ArgumentError) { @state_context.transition(:except_to => :idling) } assert_equal 'Invalid key(s): except_to', exception.message end def test_should_not_allow_except_from - exception = assert_raise(ArgumentError) { @state_context.transition(:except_from => :idling) } + exception = assert_raises(ArgumentError) { @state_context.transition(:except_from => :idling) } assert_equal 'Invalid key(s): except_from', exception.message end def test_should_not_allow_implicit_transitions - exception = assert_raise(ArgumentError) { @state_context.transition(:parked => :idling) } + exception = assert_raises(ArgumentError) { @state_context.transition(:parked => :idling) } assert_equal 'Invalid key(s): parked', exception.message end def test_should_not_allow_except_on - exception = assert_raise(ArgumentError) { @state_context.transition(:except_on => :park) } + exception = assert_raises(ArgumentError) { @state_context.transition(:except_on => :park) } assert_equal 'Invalid key(s): except_on', exception.message end def test_should_require_on_event - exception = assert_raise(ArgumentError) { @state_context.transition(:to => :idling) } + exception = assert_raises(ArgumentError) { @state_context.transition(:to => :idling) } assert_equal 'Must specify :on event', exception.message end def test_should_not_allow_missing_from_and_to - exception = assert_raise(ArgumentError) { @state_context.transition(:on => :ignite) } + exception = assert_raises(ArgumentError) { @state_context.transition(:on => :ignite) } assert_equal 'Must specify either :to or :from state', exception.message end def test_should_not_allow_from_and_to - exception = assert_raise(ArgumentError) { @state_context.transition(:on => :ignite, :from => :parked, :to => :idling) } + exception = assert_raises(ArgumentError) { @state_context.transition(:on => :ignite, :from => :parked, :to => :idling) } assert_equal 'Must specify either :to or :from state', exception.message end @@ -130,7 +130,7 @@ def test_should_allow_multiple_events end end -class StateContextWithMatchingTransitionTest < Test::Unit::TestCase +class StateContextWithMatchingTransitionTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -149,14 +149,14 @@ def test_should_be_able_to_fire def test_should_have_a_transition transition = @event.transition_for(@object) - assert_not_nil transition + refute_nil transition assert_equal 'parked', transition.from assert_equal 'idling', transition.to assert_equal :ignite, transition.event end end -class StateContextProxyTest < Test::Unit::TestCase +class StateContextProxyTest < MiniTest::Test def setup @klass = Class.new(Validateable) machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -181,7 +181,7 @@ def test_should_pass_block_through_to_class end end -class StateContextProxyWithoutConditionsTest < Test::Unit::TestCase +class StateContextProxyWithoutConditionsTest < MiniTest::Test def setup @klass = Class.new(Validateable) machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -198,7 +198,7 @@ def test_should_have_options_configuration end def test_should_have_if_option - assert_not_nil @options[:if] + refute_nil @options[:if] end def test_should_be_false_if_state_is_different @@ -211,7 +211,7 @@ def test_should_be_true_if_state_matches end end -class StateContextProxyWithIfConditionTest < Test::Unit::TestCase +class StateContextProxyWithIfConditionTest < MiniTest::Test def setup @klass = Class.new(Validateable) machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -225,7 +225,7 @@ def setup end def test_should_have_if_option - assert_not_nil @options[:if] + refute_nil @options[:if] end def test_should_be_false_if_state_is_different @@ -274,7 +274,7 @@ def test_should_evaluate_string_condition end end -class StateContextProxyWithMultipleIfConditionsTest < Test::Unit::TestCase +class StateContextProxyWithMultipleIfConditionsTest < MiniTest::Test def setup @klass = Class.new(Validateable) machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -305,7 +305,7 @@ def test_should_be_false_if_any_condition_is_false end end -class StateContextProxyWithUnlessConditionTest < Test::Unit::TestCase +class StateContextProxyWithUnlessConditionTest < MiniTest::Test def setup @klass = Class.new(Validateable) machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -319,7 +319,7 @@ def setup end def test_should_have_if_option - assert_not_nil @options[:if] + refute_nil @options[:if] end def test_should_be_false_if_state_is_different @@ -368,7 +368,7 @@ def test_should_evaluate_string_condition end end -class StateContextProxyWithMultipleUnlessConditionsTest < Test::Unit::TestCase +class StateContextProxyWithMultipleUnlessConditionsTest < MiniTest::Test def setup @klass = Class.new(Validateable) machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) @@ -399,7 +399,7 @@ def test_should_be_false_if_any_condition_is_true end end -class StateContextProxyWithIfAndUnlessConditionsTest < Test::Unit::TestCase +class StateContextProxyWithIfAndUnlessConditionsTest < MiniTest::Test def setup @klass = Class.new(Validateable) machine = EnumStateMachine::Machine.new(@klass, :initial => :parked) diff --git a/test/unit/state_enum_test.rb b/test/unit/state_enum_test.rb index 6f902b9..a6fb78b 100644 --- a/test/unit/state_enum_test.rb +++ b/test/unit/state_enum_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class StateEnumTest < Test::Unit::TestCase +class StateEnumTest < MiniTest::Test def setup @klass = Class.new do def self.has_enumerated enum_attr, enum_opts diff --git a/test/unit/state_machine_test.rb b/test/unit/state_machine_test.rb index 13d2780..19b80fd 100644 --- a/test/unit/state_machine_test.rb +++ b/test/unit/state_machine_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class EnumStateMachineByDefaultTest < Test::Unit::TestCase +class EnumStateMachineByDefaultTest < MiniTest::Test def setup @klass = Class.new @machine = @klass.state_machine @@ -11,7 +11,7 @@ def test_should_use_state_attribute end end -class EnumStateMachineTest < Test::Unit::TestCase +class EnumStateMachineTest < MiniTest::Test def setup @klass = Class.new end diff --git a/test/unit/state_test.rb b/test/unit/state_test.rb index 98231f6..c8e5019 100644 --- a/test/unit/state_test.rb +++ b/test/unit/state_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class StateByDefaultTest < Test::Unit::TestCase +class StateByDefaultTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked) @@ -40,14 +40,14 @@ def test_should_not_have_any_methods end end -class StateTest < Test::Unit::TestCase +class StateTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked) end def test_should_raise_exception_if_invalid_option_specified - exception = assert_raise(ArgumentError) {EnumStateMachine::State.new(@machine, :parked, :invalid => true)} + exception = assert_raises(ArgumentError) {EnumStateMachine::State.new(@machine, :parked, :invalid => true)} assert_equal 'Invalid key(s): invalid', exception.message end @@ -83,7 +83,7 @@ def test_should_use_pretty_inspect end end -class StateWithoutNameTest < Test::Unit::TestCase +class StateWithoutNameTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -121,7 +121,7 @@ def test_should_have_a_description_using_human_name end end -class StateWithNameTest < Test::Unit::TestCase +class StateWithNameTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -163,7 +163,7 @@ def test_should_define_predicate end end -class StateWithNilValueTest < Test::Unit::TestCase +class StateWithNilValueTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -197,7 +197,7 @@ def test_should_define_predicate end end -class StateWithSymbolicValueTest < Test::Unit::TestCase +class StateWithSymbolicValueTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -228,7 +228,7 @@ def test_should_define_predicate end end -class StateWithIntegerValueTest < Test::Unit::TestCase +class StateWithIntegerValueTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -259,7 +259,7 @@ def test_should_define_predicate end end -class StateWithLambdaValueTest < Test::Unit::TestCase +class StateWithLambdaValueTest < MiniTest::Test def setup @klass = Class.new @args = nil @@ -295,7 +295,7 @@ def test_should_match_evaluated_value end end -class StateWithCachedLambdaValueTest < Test::Unit::TestCase +class StateWithCachedLambdaValueTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -323,7 +323,7 @@ def test_should_update_value_index_for_state_collection end end -class StateWithoutCachedLambdaValueTest < Test::Unit::TestCase +class StateWithoutCachedLambdaValueTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -337,7 +337,7 @@ def test_should_not_be_caching def test_should_evaluate_value_each_time value = @state.value - assert_not_same value, @state.value + refute_same value, @state.value end def test_should_not_update_value_index_for_state_collection @@ -347,7 +347,7 @@ def test_should_not_update_value_index_for_state_collection end end -class StateWithMatcherTest < Test::Unit::TestCase +class StateWithMatcherTest < MiniTest::Test def setup @klass = Class.new @args = nil @@ -364,7 +364,7 @@ def test_should_match_evaluated_block end end -class StateWithHumanNameTest < Test::Unit::TestCase +class StateWithHumanNameTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -376,7 +376,7 @@ def test_should_use_custom_human_name end end -class StateWithDynamicHumanNameTest < Test::Unit::TestCase +class StateWithDynamicHumanNameTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -396,11 +396,11 @@ def test_should_allow_custom_class_to_be_passed_through end def test_should_not_cache_value - assert_not_same @state.human_name, @state.human_name + refute_same @state.human_name, @state.human_name end end -class StateInitialTest < Test::Unit::TestCase +class StateInitialTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked, :initial => true) @@ -412,7 +412,7 @@ def test_should_be_initial end end -class StateNotInitialTest < Test::Unit::TestCase +class StateNotInitialTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked, :initial => false) @@ -424,7 +424,7 @@ def test_should_not_be_initial end end -class StateFinalTest < Test::Unit::TestCase +class StateFinalTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked) @@ -451,7 +451,7 @@ def test_should_be_final_with_loopback end end -class StateNotFinalTest < Test::Unit::TestCase +class StateNotFinalTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked) @@ -482,7 +482,7 @@ def test_should_not_be_final_with_outgoing_blacklist_transitions end end -class StateWithConflictingHelpersBeforeDefinitionTest < Test::Unit::TestCase +class StateWithConflictingHelpersBeforeDefinitionTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -511,7 +511,7 @@ def teardown end end -class StateWithConflictingHelpersAfterDefinitionTest < Test::Unit::TestCase +class StateWithConflictingHelpersAfterDefinitionTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -549,7 +549,7 @@ def teardown end end -class StateWithConflictingMachineTest < Test::Unit::TestCase +class StateWithConflictingMachineTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -585,7 +585,7 @@ def teardown end end -class StateWithConflictingMachineNameTest < Test::Unit::TestCase +class StateWithConflictingMachineNameTest < MiniTest::Test def setup require 'stringio' @original_stderr, $stderr = $stderr, StringIO.new @@ -604,7 +604,7 @@ def teardown end end -class StateWithNamespaceTest < Test::Unit::TestCase +class StateWithNamespaceTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :namespace => 'alarm') @@ -625,7 +625,7 @@ def test_should_namespace_predicate end end -class StateAfterBeingCopiedTest < Test::Unit::TestCase +class StateAfterBeingCopiedTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked) @@ -639,11 +639,11 @@ def test_should_not_have_the_context copied_state_context = nil @copied_state.context { copied_state_context = self } - assert_not_same state_context, copied_state_context + refute_same state_context, copied_state_context end end -class StateWithContextTest < Test::Unit::TestCase +class StateWithContextTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -677,7 +677,7 @@ def test_should_return_true end def test_should_include_new_module_in_owner_class - assert_not_equal @ancestors, @klass.ancestors + refute_equal @ancestors, @klass.ancestors assert_equal [@context], @klass.ancestors - @ancestors end @@ -690,8 +690,8 @@ def test_should_define_aliased_context_method_in_owner_class end def test_should_not_use_context_methods_as_owner_class_methods - assert_not_equal @speed_method, @state.context_methods[:speed] - assert_not_equal @rpm_method, @state.context_methods[:rpm] + refute_equal @speed_method, @state.context_methods[:speed] + refute_equal @rpm_method, @state.context_methods[:rpm] end def test_should_use_context_methods_as_aliased_owner_class_methods @@ -700,7 +700,7 @@ def test_should_use_context_methods_as_aliased_owner_class_methods end end -class StateWithMultipleContextsTest < Test::Unit::TestCase +class StateWithMultipleContextsTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -732,7 +732,7 @@ def rpm end def test_should_include_new_module_in_owner_class - assert_not_equal @ancestors, @klass.ancestors + refute_equal @ancestors, @klass.ancestors assert_equal [@context], @klass.ancestors - @ancestors end @@ -745,8 +745,8 @@ def test_should_define_aliased_context_method_in_owner_class end def test_should_not_use_context_methods_as_owner_class_methods - assert_not_equal @speed_method, @state.context_methods[:speed] - assert_not_equal @rpm_method, @state.context_methods[:rpm] + refute_equal @speed_method, @state.context_methods[:speed] + refute_equal @rpm_method, @state.context_methods[:rpm] end def test_should_use_context_methods_as_aliased_owner_class_methods @@ -755,7 +755,7 @@ def test_should_use_context_methods_as_aliased_owner_class_methods end end -class StateWithExistingContextMethodTest < Test::Unit::TestCase +class StateWithExistingContextMethodTest < MiniTest::Test def setup @klass = Class.new do def speed @@ -778,7 +778,7 @@ def test_should_not_override_method end end -class StateWithRedefinedContextMethodTest < Test::Unit::TestCase +class StateWithRedefinedContextMethodTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -818,7 +818,7 @@ def test_should_have_the_same_context end end -class StateWithInvalidMethodCallTest < Test::Unit::TestCase +class StateWithInvalidMethodCallTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -838,7 +838,7 @@ def test_should_call_method_missing_arg end end -class StateWithValidMethodCallForDifferentStateTest < Test::Unit::TestCase +class StateWithValidMethodCallForDifferentStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -858,7 +858,7 @@ def test_should_call_method_missing_arg end def test_should_raise_invalid_context_on_no_method_error - exception = assert_raise(EnumStateMachine::InvalidContext) do + exception = assert_raises(EnumStateMachine::InvalidContext) do @state.call(@object, :speed, :method_missing => lambda { raise NoMethodError.new('Invalid', :speed, [])}) end assert_equal @object, exception.object @@ -866,19 +866,19 @@ def test_should_raise_invalid_context_on_no_method_error end def test_should_raise_original_error_on_no_method_error_with_different_arguments - assert_raise(NoMethodError) do + assert_raises(NoMethodError) do @state.call(@object, :speed, :method_missing => lambda { raise NoMethodError.new('Invalid', :speed, [1])}) end end def test_should_raise_original_error_on_no_method_error_for_different_method - assert_raise(NoMethodError) do + assert_raises(NoMethodError) do @state.call(@object, :speed, :method_missing => lambda { raise NoMethodError.new('Invalid', :rpm, [])}) end end end -class StateWithValidMethodCallForCurrentStateTest < Test::Unit::TestCase +class StateWithValidMethodCallForCurrentStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :initial => :idling) @@ -911,7 +911,7 @@ def test_should_pass_both_arguments_and_blocks_through end if RUBY_VERSION > '1.8.7' - class StateWithValidInheritedMethodCallForCurrentStateTest < Test::Unit::TestCase + class StateWithValidInheritedMethodCallForCurrentStateTest < MiniTest::Test def setup @superclass = Class.new do def speed(arg = nil) @@ -955,7 +955,7 @@ def speed(arg = nil) # Load library require 'graphviz' - class StateDrawingTest < Test::Unit::TestCase + class StateDrawingTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked, :value => 1) @@ -985,7 +985,7 @@ def test_should_use_description_as_label end end - class StateDrawingInitialTest < Test::Unit::TestCase + class StateDrawingInitialTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked, :initial => true) @@ -1008,7 +1008,7 @@ def test_should_draw_edge_between_point_and_state end end - class StateDrawingNilNameTest < Test::Unit::TestCase + class StateDrawingNilNameTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, nil) @@ -1019,7 +1019,7 @@ def setup end def test_should_have_a_node - assert_not_nil @node + refute_nil @node end def test_should_use_description_as_label @@ -1027,7 +1027,7 @@ def test_should_use_description_as_label end end - class StateDrawingLambdaValueTest < Test::Unit::TestCase + class StateDrawingLambdaValueTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked, :value => lambda {}) @@ -1038,7 +1038,7 @@ def setup end def test_should_have_a_node - assert_not_nil @node + refute_nil @node end def test_should_use_description_as_label @@ -1046,7 +1046,7 @@ def test_should_use_description_as_label end end - class StateDrawingNonFinalTest < Test::Unit::TestCase + class StateDrawingNonFinalTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked) @@ -1064,7 +1064,7 @@ def test_should_use_ellipse_as_shape end end - class StateDrawingFinalTest < Test::Unit::TestCase + class StateDrawingFinalTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked) @@ -1079,7 +1079,7 @@ def test_should_use_doublecircle_as_shape end end - class StateDrawingWithHumanNameTest < Test::Unit::TestCase + class StateDrawingWithHumanNameTest < MiniTest::Test def setup @machine = EnumStateMachine::Machine.new(Class.new) @machine.states << @state = EnumStateMachine::State.new(@machine, :parked, :human_name => 'Parked') diff --git a/test/unit/transition_collection_test.rb b/test/unit/transition_collection_test.rb index cfb49ec..d80c50d 100644 --- a/test/unit/transition_collection_test.rb +++ b/test/unit/transition_collection_test.rb @@ -1,8 +1,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class TransitionCollectionTest < Test::Unit::TestCase +class TransitionCollectionTest < MiniTest::Test def test_should_raise_exception_if_invalid_option_specified - exception = assert_raise(ArgumentError) {EnumStateMachine::TransitionCollection.new([], :invalid => true)} + exception = assert_raises(ArgumentError) {EnumStateMachine::TransitionCollection.new([], :invalid => true)} assert_equal 'Invalid key(s): invalid', exception.message end @@ -15,7 +15,7 @@ def test_should_raise_exception_if_multiple_transitions_for_same_attribute_speci @object = @klass.new - exception = assert_raise(ArgumentError) do + exception = assert_raises(ArgumentError) do EnumStateMachine::TransitionCollection.new([ EnumStateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling), EnumStateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling) @@ -25,7 +25,7 @@ def test_should_raise_exception_if_multiple_transitions_for_same_attribute_speci end end -class TransitionCollectionByDefaultTest < Test::Unit::TestCase +class TransitionCollectionByDefaultTest < MiniTest::Test def setup @transitions = EnumStateMachine::TransitionCollection.new end @@ -47,7 +47,7 @@ def test_should_be_empty end end -class TransitionCollectionEmptyWithoutBlockTest < Test::Unit::TestCase +class TransitionCollectionEmptyWithoutBlockTest < MiniTest::Test def setup @transitions = EnumStateMachine::TransitionCollection.new @result = @transitions.perform @@ -59,13 +59,13 @@ def test_should_succeed end -class TransitionCollectionEmptyWithBlockTest < Test::Unit::TestCase +class TransitionCollectionEmptyWithBlockTest < MiniTest::Test def setup @transitions = EnumStateMachine::TransitionCollection.new end def test_should_raise_exception_if_perform_raises_exception - assert_raise(ArgumentError) { @transitions.perform { raise ArgumentError } } + assert_raises(ArgumentError) { @transitions.perform { raise ArgumentError } } end def test_should_use_block_result_if_non_boolean @@ -81,7 +81,7 @@ def test_should_use_block_reslut_if_nil end end -class TransitionCollectionInvalidTest < Test::Unit::TestCase +class TransitionCollectionInvalidTest < MiniTest::Test def setup @transitions = EnumStateMachine::TransitionCollection.new([false]) end @@ -101,7 +101,7 @@ def test_should_not_run_perform_block end end -class TransitionCollectionPartialInvalidTest < Test::Unit::TestCase +class TransitionCollectionPartialInvalidTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :ran_transaction @@ -169,7 +169,7 @@ def test_should_not_run_around_callbacks_after_yield end end -class TransitionCollectionValidTest < Test::Unit::TestCase +class TransitionCollectionValidTest < MiniTest::Test def setup @klass = Class.new do attr_reader :persisted @@ -225,7 +225,7 @@ def test_should_store_results_in_transitions end end -class TransitionCollectionWithoutTransactionsTest < Test::Unit::TestCase +class TransitionCollectionWithoutTransactionsTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :ran_transaction @@ -253,7 +253,7 @@ def test_should_not_run_within_transaction end end -class TransitionCollectionWithTransactionsTest < Test::Unit::TestCase +class TransitionCollectionWithTransactionsTest < MiniTest::Test def setup @klass = Class.new do attr_accessor :running_transaction, :cancelled_transaction @@ -317,7 +317,7 @@ def test_should_not_cancel_the_transaction_on_after_halt end end -class TransitionCollectionWithEmptyActionsTest < Test::Unit::TestCase +class TransitionCollectionWithEmptyActionsTest < MiniTest::Test def setup @klass = Class.new @@ -357,7 +357,7 @@ def test_should_store_results_in_transitions end end -class TransitionCollectionWithSkippedActionsTest < Test::Unit::TestCase +class TransitionCollectionWithSkippedActionsTest < MiniTest::Test def setup @klass = Class.new do attr_reader :actions @@ -425,7 +425,7 @@ def test_should_run_all_callbacks end end -class TransitionCollectionWithSkippedActionsAndBlockTest < Test::Unit::TestCase +class TransitionCollectionWithSkippedActionsAndBlockTest < MiniTest::Test def setup @klass = Class.new @@ -458,7 +458,7 @@ def test_should_store_results_in_transitions end end -class TransitionCollectionWithDuplicateActionsTest < Test::Unit::TestCase +class TransitionCollectionWithDuplicateActionsTest < MiniTest::Test def setup @klass = Class.new do attr_reader :actions @@ -505,7 +505,7 @@ def test_should_store_results_in_transitions end end -class TransitionCollectionWithDifferentActionsTest < Test::Unit::TestCase +class TransitionCollectionWithDifferentActionsTest < MiniTest::Test def setup @klass = Class.new do attr_reader :actions @@ -680,7 +680,7 @@ def save_status end end -class TransitionCollectionWithMixedActionsTest < Test::Unit::TestCase +class TransitionCollectionWithMixedActionsTest < MiniTest::Test def setup @klass = Class.new do def save @@ -720,7 +720,7 @@ def test_should_store_results_in_transitions end end -class TransitionCollectionWithBlockTest < Test::Unit::TestCase +class TransitionCollectionWithBlockTest < MiniTest::Test def setup @klass = Class.new do attr_reader :actions @@ -765,7 +765,7 @@ def test_should_use_result_as_transition_result end end -class TransitionCollectionWithActionFailedTest < Test::Unit::TestCase +class TransitionCollectionWithActionFailedTest < MiniTest::Test def setup @klass = Class.new do def save @@ -824,7 +824,7 @@ def test_should_run_failure_callbacks end end -class TransitionCollectionWithActionErrorTest < Test::Unit::TestCase +class TransitionCollectionWithActionErrorTest < MiniTest::Test def setup @klass = Class.new do def save @@ -889,7 +889,7 @@ def test_should_not_run_failure_callbacks end end -class TransitionCollectionWithCallbacksTest < Test::Unit::TestCase +class TransitionCollectionWithCallbacksTest < MiniTest::Test def setup @klass = Class.new do attr_reader :saved @@ -1023,7 +1023,7 @@ def test_should_run_after_callbacks_after_running_the_action end end -class TransitionCollectionWithBeforeCallbackHaltTest < Test::Unit::TestCase +class TransitionCollectionWithBeforeCallbackHaltTest < MiniTest::Test def setup @klass = Class.new do attr_reader :saved @@ -1073,7 +1073,7 @@ def test_should_not_run_after_callbacks end end -class TransitionCollectionWithAfterCallbackHaltTest < Test::Unit::TestCase +class TransitionCollectionWithAfterCallbackHaltTest < MiniTest::Test def setup @klass = Class.new do attr_reader :saved @@ -1119,7 +1119,7 @@ def test_should_not_run_further_after_callbacks end end -class TransitionCollectionWithSkippedAfterCallbacksTest < Test::Unit::TestCase +class TransitionCollectionWithSkippedAfterCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -1153,7 +1153,7 @@ def test_should_run_after_callbacks_on_subsequent_perform end if EnumStateMachine::Transition.pause_supported? - class TransitionCollectionWithSkippedAfterCallbacksAndAroundCallbacksTest < Test::Unit::TestCase + class TransitionCollectionWithSkippedAfterCallbacksAndAroundCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -1193,7 +1193,7 @@ def test_should_not_rerun_around_callbacks_before_yield_on_subsequent_perform end end else - class TransitionCollectionWithSkippedAfterCallbacksAndAroundCallbacksTest < Test::Unit::TestCase + class TransitionCollectionWithSkippedAfterCallbacksAndAroundCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -1212,12 +1212,12 @@ def setup end def test_should_raise_exception - assert_raise(ArgumentError) { @transitions.perform } + assert_raises(ArgumentError) { @transitions.perform } end end end -class TransitionCollectionWithActionHookBaseTest < Test::Unit::TestCase +class TransitionCollectionWithActionHookBaseTest < MiniTest::Test def setup @superclass = Class.new do def save @@ -1558,7 +1558,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionByDefaultTest < Test::Unit::TestCase +class AttributeTransitionCollectionByDefaultTest < MiniTest::Test def setup @transitions = EnumStateMachine::AttributeTransitionCollection.new end @@ -1580,7 +1580,7 @@ def test_should_be_empty end end -class AttributeTransitionCollectionWithEventsTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithEventsTest < MiniTest::Test def setup @klass = Class.new @@ -1623,7 +1623,7 @@ def test_should_not_write_event_transitions end end -class AttributeTransitionCollectionWithEventTransitionsTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithEventTransitionsTest < MiniTest::Test def setup @klass = Class.new @@ -1663,7 +1663,7 @@ def test_should_clear_event_transitions end end -class AttributeTransitionCollectionWithActionFailedTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithActionFailedTest < MiniTest::Test def setup @klass = Class.new @@ -1706,7 +1706,7 @@ def test_should_not_write_event_transitions end end -class AttributeTransitionCollectionWithActionErrorTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithActionErrorTest < MiniTest::Test def setup @klass = Class.new @@ -1746,7 +1746,7 @@ def test_should_not_write_event_transitions end end -class AttributeTransitionCollectionWithCallbacksTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -1813,7 +1813,7 @@ def test_should_not_have_event_transitions_during_after_callbacks end end -class AttributeTransitionCollectionWithBeforeCallbackHaltTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithBeforeCallbackHaltTest < MiniTest::Test def setup @klass = Class.new @@ -1845,7 +1845,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionWithBeforeCallbackErrorTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithBeforeCallbackErrorTest < MiniTest::Test def setup @klass = Class.new @@ -1873,7 +1873,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionWithAroundCallbackBeforeYieldHaltTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithAroundCallbackBeforeYieldHaltTest < MiniTest::Test def setup @klass = Class.new @@ -1905,7 +1905,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionWithAroundAfterYieldCallbackErrorTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithAroundAfterYieldCallbackErrorTest < MiniTest::Test def setup @klass = Class.new @@ -1933,7 +1933,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionWithSkippedAfterCallbacksTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithSkippedAfterCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -1974,7 +1974,7 @@ def test_should_not_write_event_transitions_if_failed end end -class AttributeTransitionCollectionWithAfterCallbackHaltTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithAfterCallbackHaltTest < MiniTest::Test def setup @klass = Class.new @@ -2006,7 +2006,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionWithAfterCallbackErrorTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithAfterCallbackErrorTest < MiniTest::Test def setup @klass = Class.new @@ -2034,7 +2034,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionWithAroundCallbackAfterYieldHaltTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithAroundCallbackAfterYieldHaltTest < MiniTest::Test def setup @klass = Class.new @@ -2066,7 +2066,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionWithAroundCallbackAfterYieldErrorTest < Test::Unit::TestCase +class AttributeTransitionCollectionWithAroundCallbackAfterYieldErrorTest < MiniTest::Test def setup @klass = Class.new @@ -2094,7 +2094,7 @@ def test_should_not_write_event_transition end end -class AttributeTransitionCollectionMarshallingTest < Test::Unit::TestCase +class AttributeTransitionCollectionMarshallingTest < MiniTest::Test def setup @klass = Class.new self.class.const_set('Example', @klass) diff --git a/test/unit/transition_test.rb b/test/unit/transition_test.rb index 11566d6..d4f4ebb 100644 --- a/test/unit/transition_test.rb +++ b/test/unit/transition_test.rb @@ -1,6 +1,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper') -class TransitionTest < Test::Unit::TestCase +class TransitionTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -95,7 +95,7 @@ def test_should_use_pretty_inspect end end -class TransitionWithInvalidNodesTest < Test::Unit::TestCase +class TransitionWithInvalidNodesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -107,23 +107,23 @@ def setup end def test_should_raise_exception_without_event - assert_raise(IndexError) { EnumStateMachine::Transition.new(@object, @machine, nil, :parked, :idling) } + assert_raises(IndexError) { EnumStateMachine::Transition.new(@object, @machine, nil, :parked, :idling) } end def test_should_raise_exception_with_invalid_event - assert_raise(IndexError) { EnumStateMachine::Transition.new(@object, @machine, :invalid, :parked, :idling) } + assert_raises(IndexError) { EnumStateMachine::Transition.new(@object, @machine, :invalid, :parked, :idling) } end def test_should_raise_exception_with_invalid_from_state - assert_raise(IndexError) { EnumStateMachine::Transition.new(@object, @machine, :ignite, :invalid, :idling) } + assert_raises(IndexError) { EnumStateMachine::Transition.new(@object, @machine, :ignite, :invalid, :idling) } end def test_should_raise_exception_with_invalid_to_state - assert_raise(IndexError) { EnumStateMachine::Transition.new(@object, @machine, :ignite, :parked, :invalid) } + assert_raises(IndexError) { EnumStateMachine::Transition.new(@object, @machine, :ignite, :parked, :invalid) } end end -class TransitionWithDynamicToValueTest < Test::Unit::TestCase +class TransitionWithDynamicToValueTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -141,7 +141,7 @@ def test_should_evaluate_to_value end end -class TransitionLoopbackTest < Test::Unit::TestCase +class TransitionLoopbackTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -158,7 +158,7 @@ def test_should_be_loopback end end -class TransitionWithDifferentStatesTest < Test::Unit::TestCase +class TransitionWithDifferentStatesTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -175,7 +175,7 @@ def test_should_not_be_loopback end end -class TransitionWithNamespaceTest < Test::Unit::TestCase +class TransitionWithNamespaceTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :namespace => 'alarm') @@ -221,7 +221,7 @@ def test_should_have_a_human_to_name end end -class TransitionWithCustomMachineAttributeTest < Test::Unit::TestCase +class TransitionWithCustomMachineAttributeTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :state, :attribute => :state_id) @@ -248,7 +248,7 @@ def test_should_rollback end end -class TransitionWithoutReadingStateTest < Test::Unit::TestCase +class TransitionWithoutReadingStateTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass) @@ -269,7 +269,7 @@ def test_should_have_to_value end end -class TransitionWithActionTest < Test::Unit::TestCase +class TransitionWithActionTest < MiniTest::Test def setup @klass = Class.new do def save @@ -295,7 +295,7 @@ def test_should_not_have_a_result end end -class TransitionAfterBeingPersistedTest < Test::Unit::TestCase +class TransitionAfterBeingPersistedTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :action => :save) @@ -340,7 +340,7 @@ def test_should_revert_to_from_state_on_rollback end end -class TransitionAfterBeingRolledBackTest < Test::Unit::TestCase +class TransitionAfterBeingRolledBackTest < MiniTest::Test def setup @klass = Class.new @machine = EnumStateMachine::Machine.new(@klass, :action => :save) @@ -374,7 +374,7 @@ def test_should_still_be_able_to_persist end end -class TransitionWithoutCallbacksTest < Test::Unit::TestCase +class TransitionWithoutCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -406,7 +406,7 @@ def test_should_track_block_result end end -class TransitionWithBeforeCallbacksTest < Test::Unit::TestCase +class TransitionWithBeforeCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -457,7 +457,7 @@ def test_should_catch_halts def test_should_not_catch_exceptions @machine.before_transition {raise ArgumentError} - assert_raise(ArgumentError) { @transition.run_callbacks } + assert_raises(ArgumentError) { @transition.run_callbacks } end def test_should_not_be_able_to_run_twice @@ -510,7 +510,7 @@ def test_should_succeed_if_block_success_is_true end end -class TransitionWithMultipleBeforeCallbacksTest < Test::Unit::TestCase +class TransitionWithMultipleBeforeCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -549,7 +549,7 @@ def test_should_fail_if_any_callback_halted end end -class TransitionWithAfterCallbacksTest < Test::Unit::TestCase +class TransitionWithAfterCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -613,7 +613,7 @@ def test_should_catch_halts def test_should_not_catch_exceptions @machine.after_transition {raise ArgumentError} - assert_raise(ArgumentError) { @transition.run_callbacks } + assert_raises(ArgumentError) { @transition.run_callbacks } end def test_should_not_be_able_to_run_twice @@ -642,7 +642,7 @@ def test_should_be_able_to_run_again_after_resetting end end -class TransitionWithMultipleAfterCallbacksTest < Test::Unit::TestCase +class TransitionWithMultipleAfterCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -681,7 +681,7 @@ def test_should_fail_if_any_callback_halted end end -class TransitionWithAroundCallbacksTest < Test::Unit::TestCase +class TransitionWithAroundCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -757,12 +757,12 @@ def test_should_catch_after_yield_halts def test_should_not_catch_before_yield @machine.around_transition {raise ArgumentError} - assert_raise(ArgumentError) { @transition.run_callbacks } + assert_raises(ArgumentError) { @transition.run_callbacks } end def test_should_not_catch_after_yield @machine.around_transition {|block| block.call; raise ArgumentError} - assert_raise(ArgumentError) { @transition.run_callbacks } + assert_raises(ArgumentError) { @transition.run_callbacks } end def test_should_fail_if_not_yielded @@ -824,7 +824,7 @@ def test_should_succeed_if_block_success_is_false end end -class TransitionWithMultipleAroundCallbacksTest < Test::Unit::TestCase +class TransitionWithMultipleAroundCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -937,7 +937,7 @@ def test_should_fail_if_any_fail_to_yield end end -class TransitionWithFailureCallbacksTest < Test::Unit::TestCase +class TransitionWithFailureCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -992,7 +992,7 @@ def test_should_catch_halts def test_should_not_catch_exceptions @machine.after_failure {raise ArgumentError} - assert_raise(ArgumentError) { @transition.run_callbacks {{:success => false}} } + assert_raises(ArgumentError) { @transition.run_callbacks {{:success => false}} } end def test_should_not_be_able_to_run_twice @@ -1021,7 +1021,7 @@ def test_should_be_able_to_run_again_after_resetting end end -class TransitionWithMultipleFailureCallbacksTest < Test::Unit::TestCase +class TransitionWithMultipleFailureCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -1060,7 +1060,7 @@ def test_should_fail_if_any_callback_halted end end -class TransitionWithMixedCallbacksTest < Test::Unit::TestCase +class TransitionWithMixedCallbacksTest < MiniTest::Test def setup @klass = Class.new @@ -1164,7 +1164,7 @@ def test_should_not_run_further_callbacks_if_after_callback_halts end end -class TransitionWithBeforeCallbacksSkippedTest < Test::Unit::TestCase +class TransitionWithBeforeCallbacksSkippedTest < MiniTest::Test def setup @klass = Class.new @@ -1193,7 +1193,7 @@ def test_should_run_failure_callbacks end end -class TransitionWithAfterCallbacksSkippedTest < Test::Unit::TestCase +class TransitionWithAfterCallbacksSkippedTest < MiniTest::Test def setup @klass = Class.new @@ -1305,7 +1305,7 @@ def test_should_raise_exceptions_during_around_callbacks_after_yield_in_second_e @machine.around_transition {|block| block.call; raise ArgumentError} assert_nothing_raised { @transition.run_callbacks(:after => false) } - assert_raise(ArgumentError) { @transition.run_callbacks } + assert_raises(ArgumentError) { @transition.run_callbacks } end else def test_should_raise_exception_on_second_call @@ -1314,12 +1314,12 @@ def test_should_raise_exception_on_second_call @machine.around_transition {|block| @callbacks << :before_around_2; block.call; @callbacks << :after_around_2} @machine.after_transition {@callbacks << :after} - assert_raise(ArgumentError) { @transition.run_callbacks(:after => false) } + assert_raises(ArgumentError) { @transition.run_callbacks(:after => false) } end end end -class TransitionAfterBeingPerformedTest < Test::Unit::TestCase +class TransitionAfterBeingPerformedTest < MiniTest::Test def setup @klass = Class.new do attr_reader :saved, :save_state @@ -1366,7 +1366,7 @@ def test_should_run_the_action_after_saving_the_state end end -class TransitionWithPerformArgumentsTest < Test::Unit::TestCase +class TransitionWithPerformArgumentsTest < MiniTest::Test def setup @klass = Class.new do attr_reader :saved @@ -1400,7 +1400,7 @@ def test_should_not_include_run_action_in_arguments end end -class TransitionWithoutRunningActionTest < Test::Unit::TestCase +class TransitionWithoutRunningActionTest < MiniTest::Test def setup @klass = Class.new do attr_reader :saved @@ -1446,7 +1446,7 @@ def test_should_run_after_callbacks end end -class TransitionWithTransactionsTest < Test::Unit::TestCase +class TransitionWithTransactionsTest < MiniTest::Test def setup @klass = Class.new do class << self @@ -1487,7 +1487,7 @@ def test_should_run_blocks_within_transaction_for_object end end -class TransitionTransientTest < Test::Unit::TestCase +class TransitionTransientTest < MiniTest::Test def setup @klass = Class.new @@ -1506,7 +1506,7 @@ def test_should_be_transient end end -class TransitionEqualityTest < Test::Unit::TestCase +class TransitionEqualityTest < MiniTest::Test def setup @klass = Class.new @@ -1530,29 +1530,29 @@ def test_should_not_be_equal_with_different_machines machine.event :ignite transition = EnumStateMachine::Transition.new(@object, machine, :ignite, :parked, :idling) - assert_not_equal transition, @transition + refute_equal transition, @transition end def test_should_not_be_equal_with_different_objects transition = EnumStateMachine::Transition.new(@klass.new, @machine, :ignite, :parked, :idling) - assert_not_equal transition, @transition + refute_equal transition, @transition end def test_should_not_be_equal_with_different_event_names @machine.event :park transition = EnumStateMachine::Transition.new(@object, @machine, :park, :parked, :idling) - assert_not_equal transition, @transition + refute_equal transition, @transition end def test_should_not_be_equal_with_different_from_state_names @machine.state :first_gear transition = EnumStateMachine::Transition.new(@object, @machine, :ignite, :first_gear, :idling) - assert_not_equal transition, @transition + refute_equal transition, @transition end def test_should_not_be_equal_with_different_to_state_names @machine.state :first_gear transition = EnumStateMachine::Transition.new(@object, @machine, :ignite, :idling, :first_gear) - assert_not_equal transition, @transition + refute_equal transition, @transition end end