我想测试通过无效主机连接到RabbitMQ服务的功能:
# config/application.rb
config.session_store :cache_store, key: "_myapp_session_#{Rails.env}",
expire_after: 20.years
# config/environments/development.rb
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :redis_cache_store, { driver: :hiredis, url: "redis://redis:6379/0" }
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# config/environments/production.rb
config.cache_store = :redis_cache_store, { driver: :hiredis, url: ENV['REDIS_URL'] }
这里我正在测试
Rails 5.2.1.1
Devise 4.5.0
但是我在终端上显式地抛出了抛出的错误,但是我的单元测试没有断言它。
connect(host) {
return new Promise((resolve, reject) => {
amqp.connect(host)
.then((conn) => {
resolve(conn);
})
.catch((err) => {
throw new Error(err);
});
});
}
我做错了什么?