shlogg · Early preview
Michael Nikitochkin @miry

Integrating Marten With Minitest In Crystal

Testing with Minitest and Marten: Setup test helper, test model, and test handler. Run tests with `rake test`. Example output: 2 tests, 0 failures, 0 errors, 0 skips.

Summary

This article demonstrates how to integrate the Marten Web Framework with minitest.cr 1 for testing. For initializing a new project, refer to the Marten documentation on installation 2.

  
  
  Instructions

  
  
  Step 0: Initialize a Simple Task Manager with Rakefile

It is an optional step. 
Create a Rakefile with the following content:

# Rakefile
task test: ["test:all"]
namespace :test do
  desc "Run tests"
  task :all, [:path] do |t, args|
    args.with_defaults(path: pwd)
    option_list = ENV.fetch("TESTOPTS", "--verbose")
    option_list = "-- #{option_list}" if option_list....