Browse files

test a subclass so that the removed method does not imact other tests

  • Loading branch information...
1 parent c0d1f5f commit 38a0606d9b1b801a62cd7f8492638931b30d66a5 @tenderlove tenderlove committed Jan 5, 2012
View
2 activerecord/lib/active_record/session_store.rb
@@ -116,7 +116,7 @@ def self.find_by_session_id(*args)
define_method(:session_id) { sessid }
define_method(:session_id=) { |session_id| self.sessid = session_id }
else
- class << self; remove_method :find_by_session_id; end
+ class << self; remove_possible_method :find_by_session_id; end
def self.find_by_session_id(session_id)
find :first, :conditions => {:session_id=>session_id}
View
7 activerecord/test/cases/session_store/session_test.rb
@@ -7,10 +7,13 @@ class SessionStore
class SessionTest < ActiveRecord::TestCase
self.use_transactional_fixtures = false
+ attr_reader :session_klass
+
def setup
super
ActiveRecord::Base.connection.schema_cache.clear!
Session.drop_table! if Session.table_exists?
+ @session_klass = Class.new(Session)
end
def test_data_column_name
@@ -61,8 +64,8 @@ def self.session_id_column
def test_find_by_session_id
Session.create_table!
session_id = "10"
- s = Session.create!(:data => 'world', :session_id => session_id)
- t = Session.find_by_session_id(session_id)
+ s = session_klass.create!(:data => 'world', :session_id => session_id)
+ t = session_klass.find_by_session_id(session_id)
assert_equal s, t
assert_equal s.data, t.data
Session.drop_table!

0 comments on commit 38a0606

Please sign in to comment.