不在开发中提供某些邮件的最佳做法

时间:2016-07-20 09:17:10

标签: ruby-on-rails

我们有一个中心/课程平台。每当新学生对课程感兴趣时,我们会向de centre发送一封电子邮件,通知他们。

但是,我们不希望在开发过程中发生这种情况,因为中心会收到“虚假”通知。

我想到的第一件事就是在我们不想发送电子邮件的地方介绍Usage: java cucumber.api.cli.Main [options] [ [FILE|DIR][:LINE[:LINE]*] ]+ Options: -g, --glue PATH Where glue code (step definitions and hooks) is loaded from. -f, --format FORMAT[:PATH_OR_URL] How to format results. Goes to STDOUT unless PATH_OR_URL is specified. Built-in FORMAT types: junit, html, pretty, progress, json. FORMAT can also be a fully qualified class name. -t, --tags TAG_EXPRESSION Only run scenarios tagged with tags matching TAG_EXPRESSION. -n, --name REGEXP Only run scenarios whose names match REGEXP. -d, --[no-]-dry-run Skip execution of glue code. -m, --[no-]-monochrome Don't colour terminal output. -s, --[no-]-strict Treat undefined and pending steps as errors. --snippets Snippet name: underscore, camelcase --dotcucumber PATH_OR_URL Where to write out runtime information. PATH_OR_URL can be a file system path or a URL. -v, --version Print version. -h, --help You're looking at it. Exception in thread "main" cucumber.runtime.CucumberException: Unknown option: --plugin at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:119) at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:50) at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:44) at cucumber.api.cli.Main.run(Main.java:20) at cucumber.api.cli.Main.main(Main.java:16) 。但感觉有点奇怪。

实现这一目标的最佳解决方案/模式是什么?

请注意,我们不想停止向所有人发送邮件,而只是向其中一些人发送邮件。

提前致谢。

2 个答案:

答案 0 :(得分:0)

在config / environments / development.rb(和test.rb)中,您可以执行以下操作:

Rails.application.configure do
  #.......other config here
  config.action_mailer.delivery_method = :test
end

这不会发送电子邮件,但您可以在日志文件/终端输出中看到它

答案 1 :(得分:0)

我认为您正在寻找的是:

将此添加到您的config/environments/development.rb

config.action_mailer.perform_deliveries = false

config.action_mailer.delivery_method = :test

记录交货

(如果您使用的是ActionMailer)