2012-11-14 10:42:54 -05:00
|
|
|
require 'cases/helper'
|
|
|
|
require 'active_support/testing/isolation'
|
|
|
|
|
|
|
|
class RailtieTest < ActiveModel::TestCase
|
|
|
|
include ActiveSupport::Testing::Isolation
|
|
|
|
|
|
|
|
def setup
|
2012-11-26 06:18:41 -05:00
|
|
|
require 'active_model/railtie'
|
2012-11-14 10:42:54 -05:00
|
|
|
|
2013-06-05 19:57:58 -04:00
|
|
|
# Set a fake logger to avoid creating the log directory automatically
|
2013-07-30 13:03:57 -04:00
|
|
|
fake_logger = Logger.new(nil)
|
2013-06-05 19:57:58 -04:00
|
|
|
|
2012-11-26 06:18:41 -05:00
|
|
|
@app ||= Class.new(::Rails::Application) do
|
|
|
|
config.eager_load = false
|
2013-06-05 19:57:58 -04:00
|
|
|
config.logger = fake_logger
|
2012-11-14 10:42:54 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'secure password min_cost is false in the development environment' do
|
|
|
|
Rails.env = 'development'
|
|
|
|
@app.initialize!
|
|
|
|
|
|
|
|
assert_equal false, ActiveModel::SecurePassword.min_cost
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'secure password min_cost is true in the test environment' do
|
|
|
|
Rails.env = 'test'
|
|
|
|
@app.initialize!
|
|
|
|
|
|
|
|
assert_equal true, ActiveModel::SecurePassword.min_cost
|
|
|
|
end
|
|
|
|
end
|