Sha256: c4a78961d74b21df200462cbcc0c55fc98b20709d197f2871abd6a8814cb4499
Contents?: true
Size: 1.95 KB
Versions: 11
Compression:
Stored size: 1.95 KB
Contents
require 'simplecov' SimpleCov.start do add_filter '/test/' end require File.expand_path('../test/dummy/config/environment.rb', __dir__) # ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)] require 'rails/test_help' require 'pry' require 'colorize' # Filter out Minitest backtrace while allowing backtrace from other libraries # to be shown. Minitest.backtrace_filter = Minitest::BacktraceFilter.new require 'rails/test_unit/reporter' Rails::TestUnitReporter.executable = 'bin/test' # Load fixtures from the engine if ActiveSupport::TestCase.respond_to?(:fixture_path=) ActiveSupport::TestCase.fixture_path = File.expand_path('fixtures', __dir__) ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path ActiveSupport::TestCase.file_fixture_path = File.join(ActiveSupport::TestCase.fixture_path, '/files') ActiveSupport::TestCase.fixtures :all end load File.join(File.dirname(__FILE__), '/dummy/db/schema.rb') require 'request_store' module TestHelper extend ActiveSupport::Concern # Help test raise errors message # https://ruby-doc.org/stdlib-2.1.5/libdoc/test/unit/rdoc/Test/Unit/Assertions.html#method-i-assert_raise def assert_raises_with_message(exception, expected, msg = nil, &block) case expected when String assert = :assert_equal when Regexp assert = :assert_match else fail TypeError, "Expected #{expected.inspect} to be a kind of String or Regexp, not #{expected.class}" end ex = assert_raises(exception, *msg, &block) msg = message(msg, '') { "Expected Exception(#{exception}) was raised, but the message doesn't match" } if assert == :assert_equal assert_equal(expected, ex.message, msg) else msg = message(msg) { "Expected #{mu_pp expected} to match #{mu_pp ex.message}" } assert expected =~ ex.message, msg block.binding.eval('proc{|_|$~=_}').call($LAST_MATCH_INFO) end return ex end end
Version data entries
11 entries across 11 versions & 1 rubygems