Permalink
Browse files

Use the Ruby load path for test_helper requires. Fix AM::TestCase.

  • Loading branch information...
1 parent 9e9dde6 commit d7bad6e2eba5b5ea0d83a4a2a4390b057c39ec7a @jeremy jeremy committed Nov 16, 2008
@@ -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 @@ def setup
Foo.send(:changed)
Foo.send(:notify_observers, :whatever, foo)
end
-end
+end
@@ -1,4 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
+require 'test_helper'
class EventTest < ActiveModel::TestCase
def setup
@@ -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
+end
@@ -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 @@ def new_state(options={})
state.call_action(:entering, record)
end
end
-end
+end
@@ -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
@@ -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 @@ def setup
@subj.dress!(:dating, 'purple', 'slacks')
end
end
-end
+end
@@ -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 @@ def uses_mocha(test_name, &block)
rescue LoadError
end
-ActiveSupport::TestCase.send :include, ActiveSupport::Testing::Default
-
-module ActiveModel
- class TestCase < ActiveSupport::TestCase
- include ActiveSupport::Testing::Default
- end
-end
+class ActiveModel::TestCase < ActiveSupport::TestCase
+end

0 comments on commit d7bad6e

Please sign in to comment.