Sha256: d3aa03551d9e8fa4ae8dd69b59c6d3bd5738839f628df9b36275fb7c5616401f
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require 'test_helper' require 'tins' module Tins class ImplementTest < Test::Unit::TestCase require 'tins/xt/implement' class A implement :foo implement :bar, in: :subclass implement :baz, in: :submodule implement :qux, 'blub %{method_name} blob %{module}' implement :quux, 'blab' implement def foobar(x1, x2) end, in: :subclass end def test_implement_default assert_equal( 'method foo not implemented in module Tins::ImplementTest::A', error_message { A.new.foo } ) end def test_implement_subclass assert_equal( 'method bar has to be implemented in subclasses of '\ 'Tins::ImplementTest::A', error_message { A.new.bar } ) end def test_implement_submodule assert_equal( 'method baz has to be implemented in submodules of '\ 'Tins::ImplementTest::A', error_message { A.new.baz } ) end def test_implement_custom_with_vars assert_equal( 'blub qux blob Tins::ImplementTest::A', error_message { A.new.qux } ) end def test_implement_custom_without_vars assert_equal('blab', error_message { A.new.quux }) end def test_implement_def_subclass assert_equal( 'method foobar has to be implemented in subclasses of '\ 'Tins::ImplementTest::A', error_message { A.new.foobar } ) end private def error_message yield rescue NotImplementedError => e e.message end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tins-1.4.1 | tests/implement_test.rb |