module Oprah::TestHelpers

Test helpers that can be included into `Minitest::Test` or `ActiveSupport::TestCase`.

@since 0.1.2

Public Instance Methods

assert_presented(object) click to toggle source

Fails unless `object` is a presenter.

@since 0.1.3 @param [Object] object The object to be tested @return [Boolean]

# File lib/oprah/test_helpers.rb, line 26
def assert_presented(object)
  msg = message(msg) do
    "Expected #{mu_pp(object)} to be an Oprah::Presenter"
  end

  assert object.kind_of?(Oprah::Presenter), msg
end
present(*args, **kwargs, &block) click to toggle source

Presents a single object.

@see Presenter.present

# File lib/oprah/test_helpers.rb, line 17
def present(*args, **kwargs, &block)
  Presenter.present(*args, **kwargs, &block)
end
present_many(*args, **kwargs, &block) click to toggle source

Presents a collection of objects.

@see Presenter.present_many

# File lib/oprah/test_helpers.rb, line 10
def present_many(*args, **kwargs, &block)
  Presenter.present_many(*args, **kwargs, &block)
end
refute_presented(object) click to toggle source

Fails if `object` is a presenter.

@since 0.1.3 @param [Object] object The object to be tested @return [Boolean]

# File lib/oprah/test_helpers.rb, line 39
def refute_presented(object)
  msg = message(msg) do
    "Expected #{mu_pp(object)} to not be an Oprah::Presenter"
  end

  refute object.kind_of?(Oprah::Presenter), msg
end