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