# frozen_string_literal: true 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 def attr_name(klass, attr) klass.human_attribute_name(attr) end def sign_in(user, password: "password") post sessions_path, params: { username: user.username, password: password } end end end