public
Description: Ruby module that upon requirement will allow any object to become "abstract" by calling a single method
Homepage: http://www.bjeanes.com/
Clone URL: git://github.com/bjeanes/make_abstract.git
make_abstract / test / test_make_abstract.rb
100644 29 lines (25 sloc) 0.701 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'test/unit'
require 'make_abstract'
require 'test/test_classes'
 
class TestMakeAbstract < Test::Unit::TestCase
  def test_defines_method
    assert_respond_to(AbstractClass, :make_abstract)
    assert_respond_to(String, :make_abstract)
    assert_respond_to(Object, :make_abstract)
  end
  
  def test_instantiating_abstract_class_raises_error
    assert_raise NoMethodError do
      AbstractClass.new
    end
  end
  
  def test_instantiating_abstract_child_class_raises_error
    assert_raise NoMethodError do
      AbstractChildClass.new
    end
  end
  
  def test_instantiating_child_of_abstract_class_doesnt_raise_error
    assert_nothing_raised do
      ChildClass.new
    end
  end
end