22 lines
622 B
Ruby
22 lines
622 B
Ruby
ENV["RAILS_ENV"] ||= "test"
|
|
require_relative "../config/environment"
|
|
require "rails/test_help"
|
|
|
|
module ActiveSupport
|
|
class TestCase
|
|
# Run tests in parallel with specified workers
|
|
parallelize(workers: :number_of_processors)
|
|
|
|
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
|
fixtures :all
|
|
|
|
def assert_must_exist(record, field)
|
|
assert record.valid?
|
|
record.attributes = { "#{field}": nil }
|
|
assert_not record.valid?
|
|
assert_includes record.errors[field.to_sym], "can't be blank"
|
|
assert_raises { record.save(validate: false) }
|
|
end
|
|
end
|
|
end
|