module Marten::Spec
Overview
Provides helpers and tools allowing to ease the process of writing specs for Marten projects.
Defined in:
marten/spec.crmarten/spec/client.cr
Class Method Summary
-
.clear_client : Nil
Clears the testing client.
-
.clear_collected_emails : Nil
Clears collected emails.
-
.client : Client
Returns an instance of the testing client.
-
.delivered_emails : Array(Emailing::Email)
Returns an array of all the emails that were delivered as part of the spec.
-
.flush_databases
Flushes all the databases.
-
.setup_databases
Setup all the databases by ensuring that model tables are up-to-date.
Class Method Detail
Clears the testing client.
This method is automatically called after each spec.
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.
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.
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
Flushes all the databases.
This method is automatically called after each spec.
Setup all the databases by ensuring that model tables are up-to-date.
This method is automatically called before each spec suite.