module Marten::Spec

Overview

Provides helpers and tools allowing to ease the process of writing specs for Marten projects.

Defined in:

marten/spec.cr
marten/spec/client.cr

Class Method Summary

Class Method Detail

def self.clear_client : Nil #

Clears the testing client.

This method is automatically called after each spec.


[View source]
def self.clear_collected_emails : Nil #

Clears collected emails.

This method is only relevant if the current emailing backend is an instance of Marten::Emailing::Backend::Development that was initialized with collect_emails: true.

This method is automatically called after each spec.


[View source]
def self.client : Client #

Returns an instance of the testing client.

The testing client allows to issue requests to the server and obtain the associated responses. Note that this method is memoized on a per-spec basis.


[View source]
def self.delivered_emails : Array(Emailing::Email) #

Returns an array of all the emails that were delivered as part of the spec.

Note that this method will return an empty array if the emailing backend is not set to an instance of the development backend that was initialized with collect_emails: true. For example:

Marten.configure :test do |config|
  # [...]
  config.emailing.backend = Marten::Emailing::Backend::Development.new(collect_emails: true, print_emails: false)
end

[View source]
def self.flush_databases #

Flushes all the databases.

This method is automatically called after each spec.


[View source]
def self.setup_databases #

Setup all the databases by ensuring that model tables are up-to-date.

This method is automatically called before each spec suite.


[View source]