Increment assertions count on assert_nothing_raised

This commit is contained in:
Nikita Vasilevsky 2022-02-08 23:29:30 +00:00 committed by GitHub
parent 4d4497b42e
commit 6758397019
3 changed files with 9 additions and 9 deletions

View File

@ -31,7 +31,7 @@ module ActiveSupport
# perform_service(param: 'no_exception')
# end
def assert_nothing_raised
yield
yield.tap { assert(true) }
rescue => error
raise Minitest::UnexpectedError.new(error)
end

View File

@ -229,7 +229,7 @@ module ApplicationTests
end
output = rails("test")
assert_match(/7 runs, 9 assertions, 0 failures, 0 errors/, output)
assert_match(/7 runs, 11 assertions, 0 failures, 0 errors/, output)
assert_no_match(/Errors running/, output)
end
@ -247,7 +247,7 @@ module ApplicationTests
with_rails_env("test") { rails("db:migrate") }
output = rails("test")
assert_match(/5 runs, 7 assertions, 0 failures, 0 errors/, output)
assert_match(/5 runs, 9 assertions, 0 failures, 0 errors/, output)
assert_no_match(/Errors running/, output)
end
@ -260,7 +260,7 @@ module ApplicationTests
end
output = rails("test")
assert_match(/7 runs, 9 assertions, 0 failures, 0 errors/, output)
assert_match(/7 runs, 11 assertions, 0 failures, 0 errors/, output)
assert_no_match(/Errors running/, output)
end

View File

@ -573,7 +573,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
`bin/rails g scaffold User name:string age:integer;
bin/rails db:migrate`
end
assert_match(/8 runs, 10 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
assert_match(/8 runs, 12 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
end
end
@ -593,7 +593,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_match(/class UsersController < ApplicationController/, content)
end
assert_match(/8 runs, 10 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
assert_match(/8 runs, 12 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
end
end
@ -607,7 +607,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
`bin/rails g scaffold User name:string age:integer;
bin/rails db:migrate`
end
assert_match(/8 runs, 10 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
assert_match(/8 runs, 12 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
end
end
@ -621,7 +621,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
`bin/rails g scaffold User name:string age:integer;
bin/rails db:migrate`
end
assert_match(/6 runs, 8 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
assert_match(/6 runs, 10 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
end
end
@ -635,7 +635,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
`bin/rails g scaffold User name:string age:integer;
bin/rails db:migrate`
end
assert_match(/6 runs, 8 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
assert_match(/6 runs, 10 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
end
end