Module: Oprah::TestHelpers
- Defined in:
- lib/oprah/test_helpers.rb
Overview
Test helpers that can be included into ‘Minitest::Test` or `ActiveSupport::TestCase`.
Instance Method Summary collapse
-
#assert_presented(object) ⇒ Boolean
Fails unless ‘object` is a presenter.
-
#present(*args, **kwargs, &block) ⇒ Object
Presents a single object.
-
#present_many(*args, **kwargs, &block) ⇒ Object
Presents a collection of objects.
-
#refute_presented(object) ⇒ Boolean
Fails if ‘object` is a presenter.
Instance Method Details
#assert_presented(object) ⇒ Boolean
Fails unless ‘object` is a presenter.
26 27 28 29 30 31 32 |
# File 'lib/oprah/test_helpers.rb', line 26 def assert_presented(object) msg = (msg) do "Expected #{mu_pp(object)} to be an Oprah::Presenter" end assert object.kind_of?(Oprah::Presenter), msg end |
#present(*args, **kwargs, &block) ⇒ Object
Presents a single object.
17 18 19 |
# File 'lib/oprah/test_helpers.rb', line 17 def present(*args, **kwargs, &block) Presenter.present(*args, **kwargs, &block) end |
#present_many(*args, **kwargs, &block) ⇒ Object
Presents a collection of objects.
10 11 12 |
# File 'lib/oprah/test_helpers.rb', line 10 def present_many(*args, **kwargs, &block) Presenter.present_many(*args, **kwargs, &block) end |