Skip to content

Commit

Permalink
Updating dependencies to support Rails 4.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
albertosaurus committed Jan 19, 2015
1 parent ce9de23 commit 8204eec
Show file tree
Hide file tree
Showing 33 changed files with 593 additions and 580 deletions.
8 changes: 3 additions & 5 deletions enum_state_machine.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
54 changes: 27 additions & 27 deletions test/functional/state_machine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -481,15 +481,15 @@ 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
assert_equal 'parked', exception.from
end
end

class VehicleIdlingTest < Test::Unit::TestCase
class VehicleIdlingTest < MiniTest::Test
def setup
@vehicle = Vehicle.new
@vehicle.ignite
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand Down
14 changes: 13 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions test/unit/assertions_test.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Loading

0 comments on commit 8204eec

Please sign in to comment.