class SpectatorTest

Overview

Root-level class that all tests inherit from and are contained in. This class is intentionally outside of the scope of Spectator, so that the namespace isn't leaked into tests unexpectedly.

Included Modules

Defined in:

spectator_test.cr

Constructors

Instance Method Summary

Instance methods inherited from module Spectator::DSL

allow(thing) allow, allow_any_instance_of(type : T.class) forall T allow_any_instance_of, anonymous_double(name = "Anonymous", **stubs) anonymous_double, anonymous_null_double(name = "Anonymous", **stubs) anonymous_null_double, fail(reason : String)
fail
fail

Macros inherited from module Spectator::DSL

after_all(&block) after_all, after_each(&block) after_each, all(matcher) all, around_each(&block) around_each, be
be(expected)
be
, be_a(expected) be_a, be_a_kind_of(expected) be_a_kind_of, be_an(expected) be_an, be_an_instance_of(expected) be_an_instance_of, be_between(min, max) be_between, be_close(expected, delta) be_close, be_empty be_empty, be_false be_false, be_falsey be_falsey, be_ge(expected) be_ge, be_gt(expected) be_gt, be_instance_of(expected) be_instance_of, be_kind_of(expected) be_kind_of, be_le(expected) be_le, be_lt(expected) be_lt, be_nil be_nil, be_true be_true, be_truthy be_truthy, be_within(expected) be_within, before_all(&block) before_all, before_each(&block) before_each, change(&expression) change, contain(*expected) contain, contain_elements(expected) contain_elements, contain_exactly(*expected) contain_exactly, context(what, &block) context, cover(*expected) cover, create_double(type_name, name, **stubs) create_double, create_null_double(type_name, name, **stubs) create_null_double, define_double(type_name, name, **stubs, &block) define_double, define_null_double(type_name, name, **stubs, &block) define_null_double, describe(what, &block) describe, double(name = "Anonymous", **stubs, &block) double, end_with(expected) end_with, eq(expected) eq, expect(actual, _source_file = __FILE__, _source_line = __LINE__)
expect(&block)
expect
, expect_any_instance_of(type, _source_file = __FILE__, _source_line = __LINE__) expect_any_instance_of, expect_raises
expect_raises(type, &block)
expect_raises(type, message, &block)
expect_raises
, expects(actual)
expects(&block)
expects
, given(*assignments, &block) given, has_key(expected) has_key, has_value(expected) has_value, have(*expected) have, have_attributes(**expected) have_attributes, have_elements(expected) have_elements, have_key(expected) have_key, have_received(method) have_received, have_size(expected) have_size, have_size_of(expected) have_size_of, have_value(expected) have_value, is(expected) is, is_expected is_expected, is_not(expected) is_not, it(description = nil, &block) it, let(name, &block) let, let!(name, &block) let!, match(expected) match, match_array(expected) match_array, method_missing(call) method_missing, mock(name, &block) mock, ne(expected) ne, null_double(name, **stubs, &block) null_double, pending(description = nil, &block) pending, post_condition(&block) post_condition, pre_condition(&block) pre_condition, raise_error
raise_error(type_or_message)
raise_error(type, message)
raise_error
, random_sample(collection, count = nil, &block) random_sample, receive(method_name, _source_file = __FILE__, _source_line = __LINE__, &block) receive, receive_messages(_source_file = __FILE__, _source_line = __LINE__, **stubs) receive_messages, respond_to(*expected) respond_to, sample(collection, count = nil, &block) sample, should(matcher) should, should_eventually(matcher) should_eventually, should_never(matcher) should_never, should_not(matcher) should_not, skip(description = nil, &block) skip, specify(description = nil, &block) specify, start_with(expected) start_with, subject(&block)
subject(name, &block)
subject
, subject!(&block)
subject!(name, &block)
subject!
, verify_double(name, &block) verify_double, xit(description = nil, &block) xit

Instance methods inherited from class Object

should(matcher) should, should_eventually(matcher) should_eventually, should_never(matcher) should_never, should_not(matcher) should_not

Constructor Detail

def self.new(spectator_test_values : Spectator::TestValues) #

[View source]

Instance Method Detail

def _spectator_implicit_subject #

[View source]
def inspect(io) #

Prevent leaking internal values since their types may differ. Workaround for: https://gitlab.com/arctic-fox/spectator/-/issues/53


[View source]
def subject #

[View source]