Sha256: b345b6b966ff4ea5af391a2f2f3663c9b91260b432665c167d985ed57bfa13bc
Contents?: true
Size: 722 Bytes
Versions: 21
Compression:
Stored size: 722 Bytes
Contents
# frozen_string_literal: true module Kadmin class Presenter # Test class for Presenters. While this will not be common, it highlights how much # easier presenters are to test. # TODO: When a use case presents itself, modify to handle JSON or other outputs that are not HTML. class TestCase < ActionView::TestCase def present(presentable) renderable = case presentable when Kadmin::Presenter presentable when Kadmin::Presentable presentable.present end raise ArgumentError, "don't know how to render #{presentable}" if renderable.nil? @rendered = renderable.render(view: self) return @rendered end end end end
Version data entries
21 entries across 21 versions & 1 rubygems