1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add Rake task for testing mailboxes

This commit is contained in:
George Claghorn 2018-12-30 16:17:16 -05:00 committed by GitHub
parent f28b28fe8d
commit e7bcbf7b29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -1,3 +1,7 @@
* Add `rails test:mailboxes`.
*George Claghorn*
* Introduce guard against DNS rebinding attacks
The `ActionDispatch::HostAuthorization` is a new middleware that prevent

View file

@ -28,7 +28,7 @@ namespace :test do
desc "Run tests quickly, but also reset db"
task db: %w[db:test:prepare test]
["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name|
["models", "helpers", "controllers", "mailers", "integration", "jobs", "mailboxes"].each do |name|
task name => "test:prepare" do
$: << "test"
Rails::TestUnit::Runner.rake_run(["test/#{name}"])

View file

@ -131,6 +131,18 @@ module ApplicationTests
end
end
def test_run_mailboxes
create_test_file :mailboxes, "foo_mailbox"
create_test_file :mailboxes, "bar_mailbox"
create_test_file :models, "foo"
rails("test:mailboxes").tap do |output|
assert_match "FooMailboxTest", output
assert_match "BarMailboxTest", output
assert_match "2 runs, 2 assertions, 0 failures", output
end
end
def test_run_functionals
create_test_file :mailers, "foo_mailer"
create_test_file :controllers, "bar_controller"
@ -155,11 +167,11 @@ module ApplicationTests
end
def test_run_all_suites
suites = [:models, :helpers, :unit, :controllers, :mailers, :functional, :integration, :jobs]
suites = [:models, :helpers, :unit, :controllers, :mailers, :functional, :integration, :jobs, :mailboxes]
suites.each { |suite| create_test_file suite, "foo_#{suite}" }
run_test_command("") .tap do |output|
suites.each { |suite| assert_match "Foo#{suite.to_s.camelize}Test", output }
assert_match "8 runs, 8 assertions, 0 failures", output
assert_match "9 runs, 9 assertions, 0 failures", output
end
end