mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
generate migrations with new .change method for rails >= 3.1. closes #1345
This commit is contained in:
@@ -57,4 +57,20 @@ class ActiveSupport::TestCase
|
||||
object.send :"#{key}=", value
|
||||
end
|
||||
end
|
||||
|
||||
def with_rails_version(constants, &block)
|
||||
saved_constants = {}
|
||||
constants.each do |constant, val|
|
||||
saved_constants[constant] = ::Rails::VERSION.const_get constant
|
||||
Kernel::silence_warnings { ::Rails::VERSION.const_set(constant, val) }
|
||||
end
|
||||
|
||||
begin
|
||||
block.call
|
||||
ensure
|
||||
constants.each do |constant, val|
|
||||
Kernel::silence_warnings { ::Rails::VERSION.const_set(constant, saved_constants[constant]) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user