Skip to content

module Athena::Spec #

A set of common Spec compliant testing utilities/types.

Constants#

VERSION = "0.4.1"#

Class methods#

.run_all : Nil#

Runs all ASPEC::TestCases.

Is equivalent to manually calling .run on each test case.

View source

Macros#

compile_time_assert(condition, message = "Compile-time assertion failed")#

Asserts a condition, raising message if it is falsey. This is primarily intended to be used with ASPEC::Methods.assert_compiles to assert state that exists at compile time. An example of this is how internally Athena's specs do something like this to assert aspects of wired up services are correct:

ASPEC::Methods.assert_compiles <<-'CR'
  require "../spec_helper"

  @[ADI::Register(public: true)]
  record MyService

  macro finished
    macro finished
      \{%
        service = ADI::ServiceContainer::SERVICE_HASH["my_service"]
      %}
      ASPEC.compile_time_assert(\{{ service["public"] == true }}, "Expected service to be public")
    end
  end
CR
View source