aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activemodel/lib/active_model/state_machine.rb8
-rw-r--r--activemodel/lib/active_model/state_machine/event.rb2
-rw-r--r--activemodel/lib/active_model/state_machine/machine.rb5
-rw-r--r--activemodel/test/observing_test.rb4
-rw-r--r--activemodel/test/state_machine/event_test.rb2
-rw-r--r--activemodel/test/state_machine/machine_test.rb4
-rw-r--r--activemodel/test/state_machine/state_test.rb4
-rw-r--r--activemodel/test/state_machine/state_transition_test.rb2
-rw-r--r--activemodel/test/state_machine_test.rb4
-rw-r--r--activemodel/test/test_helper.rb13
-rw-r--r--activesupport/lib/active_support/testing/setup_and_teardown.rb2
11 files changed, 22 insertions, 28 deletions
diff --git a/activemodel/lib/active_model/state_machine.rb b/activemodel/lib/active_model/state_machine.rb
index 96df6539ae..89afc4abb6 100644
--- a/activemodel/lib/active_model/state_machine.rb
+++ b/activemodel/lib/active_model/state_machine.rb
@@ -1,14 +1,10 @@
-Dir[File.dirname(__FILE__) + "/state_machine/*.rb"].sort.each do |path|
- filename = File.basename(path)
- require "active_model/state_machine/#{filename}"
-end
-
module ActiveModel
module StateMachine
class InvalidTransition < Exception
end
def self.included(base)
+ require 'active_model/state_machine/machine'
base.extend ClassMethods
end
@@ -63,4 +59,4 @@ module ActiveModel
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/lib/active_model/state_machine/event.rb b/activemodel/lib/active_model/state_machine/event.rb
index 8acde7fd47..3eb656b6d6 100644
--- a/activemodel/lib/active_model/state_machine/event.rb
+++ b/activemodel/lib/active_model/state_machine/event.rb
@@ -1,3 +1,5 @@
+require 'active_model/state_machine/state_transition'
+
module ActiveModel
module StateMachine
class Event
diff --git a/activemodel/lib/active_model/state_machine/machine.rb b/activemodel/lib/active_model/state_machine/machine.rb
index 170505c0b2..58c2f1b200 100644
--- a/activemodel/lib/active_model/state_machine/machine.rb
+++ b/activemodel/lib/active_model/state_machine/machine.rb
@@ -1,3 +1,6 @@
+require 'active_model/state_machine/state'
+require 'active_model/state_machine/event'
+
module ActiveModel
module StateMachine
class Machine
@@ -71,4 +74,4 @@ module ActiveModel
end
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/test/observing_test.rb b/activemodel/test/observing_test.rb
index 6e124de52f..34bf260d69 100644
--- a/activemodel/test/observing_test.rb
+++ b/activemodel/test/observing_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
+require 'test_helper'
class ObservedModel < ActiveModel::Base
class Observer
@@ -120,4 +120,4 @@ class ObserverTest < ActiveModel::TestCase
Foo.send(:changed)
Foo.send(:notify_observers, :whatever, foo)
end
-end \ No newline at end of file
+end
diff --git a/activemodel/test/state_machine/event_test.rb b/activemodel/test/state_machine/event_test.rb
index 40b630da7c..7f4a9afdd8 100644
--- a/activemodel/test/state_machine/event_test.rb
+++ b/activemodel/test/state_machine/event_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
+require 'test_helper'
class EventTest < ActiveModel::TestCase
def setup
diff --git a/activemodel/test/state_machine/machine_test.rb b/activemodel/test/state_machine/machine_test.rb
index 2cdfcd9554..d23c223160 100644
--- a/activemodel/test/state_machine/machine_test.rb
+++ b/activemodel/test/state_machine/machine_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
+require 'test_helper'
class MachineTestSubject
include ActiveModel::StateMachine
@@ -40,4 +40,4 @@ class StateMachineMachineTest < ActiveModel::TestCase
assert events.include?(:shutdown)
assert events.include?(:timeout)
end
-end \ No newline at end of file
+end
diff --git a/activemodel/test/state_machine/state_test.rb b/activemodel/test/state_machine/state_test.rb
index 22d0d9eb93..daaf0829f0 100644
--- a/activemodel/test/state_machine/state_test.rb
+++ b/activemodel/test/state_machine/state_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
+require 'test_helper'
class StateTestSubject
include ActiveModel::StateMachine
@@ -71,4 +71,4 @@ class StateTest < ActiveModel::TestCase
state.call_action(:entering, record)
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/test/state_machine/state_transition_test.rb b/activemodel/test/state_machine/state_transition_test.rb
index 9a9e7f60c5..5165bb1c97 100644
--- a/activemodel/test/state_machine/state_transition_test.rb
+++ b/activemodel/test/state_machine/state_transition_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
+require 'test_helper'
class StateTransitionTest < ActiveModel::TestCase
test 'should set from, to, and opts attr readers' do
diff --git a/activemodel/test/state_machine_test.rb b/activemodel/test/state_machine_test.rb
index b2f0fc4ec0..fb150671e0 100644
--- a/activemodel/test/state_machine_test.rb
+++ b/activemodel/test/state_machine_test.rb
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
+require 'test_helper'
class StateMachineSubject
include ActiveModel::StateMachine
@@ -321,4 +321,4 @@ class StateMachineWithComplexTransitionsTest < ActiveModel::TestCase
@subj.dress!(:dating, 'purple', 'slacks')
end
end
-end \ No newline at end of file
+end
diff --git a/activemodel/test/test_helper.rb b/activemodel/test/test_helper.rb
index ccf93280ec..6c10925270 100644
--- a/activemodel/test/test_helper.rb
+++ b/activemodel/test/test_helper.rb
@@ -1,10 +1,6 @@
-$:.unshift "#{File.dirname(__FILE__)}/../lib"
-$:.unshift File.dirname(__FILE__)
-
require 'test/unit'
require 'active_model'
require 'active_model/state_machine'
-require 'active_support/callbacks' # needed by ActiveModel::TestCase
require 'active_support/test_case'
def uses_gem(gem_name, test_name, version = '> 0')
@@ -30,10 +26,5 @@ begin
rescue LoadError
end
-ActiveSupport::TestCase.send :include, ActiveSupport::Testing::Default
-
-module ActiveModel
- class TestCase < ActiveSupport::TestCase
- include ActiveSupport::Testing::Default
- end
-end \ No newline at end of file
+class ActiveModel::TestCase < ActiveSupport::TestCase
+end
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb
index c70e149c16..dee8d63585 100644
--- a/activesupport/lib/active_support/testing/setup_and_teardown.rb
+++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb
@@ -1,3 +1,5 @@
+require 'active_support/callbacks'
+
module ActiveSupport
module Testing
module SetupAndTeardown