Browse files

revert to using NotImplementedError

  • Loading branch information...
1 parent cbf088f commit 124fbe52916f99991b55d3f41f0b4c27761a7a03 Daisuke IKEGAMI committed Mar 28, 2011
Showing with 22 additions and 12 deletions.
  1. +17 −9 lib/rushcheck/arbitrary.rb
  2. +5 −3 test/test_arbitrary.rb
View
26 lib/rushcheck/arbitrary.rb
@@ -32,33 +32,41 @@
module RushCheck
- # :nodoc:
- def _message_should_be_overrided
- /^.+?:\d+(?::in (`.*'))?/ =~ caller.first
- [ "The method", $1, "should be overrided at",
- self.class.to_s ].join(" ") + "."
- end
+ module ParseError
+
+ # :nodoc:
+ def _message_should_be_overrided
+ /^.+?:\d+(?::in (`.*'))?/ =~ caller.first
+ [ "The method", $1, "should be overrided at",
+ self.class.to_s ].join(" ") + "."
+ end
- private :_message_should_be_overrided
+ private :_message_should_be_overrided
+
+ end
module Arbitrary
+ include RushCheck::ParseError
+
# It is assumed that the _arbitrary_ method must be overrided
# as a instance method, and return a Gen object with the same
# class of self.
def arbitrary
- raise(NameError, _message_should_be_overrided)
+ raise(NotImplementedError, _message_should_be_overrided)
end
end
module Coarbitrary
+
+ include RushCheck::ParseError
# It is assumed that the _coarbitrary_ method must be overrided
# as a class method which takes one argument of Gen
# and return a Gen object.
def coarbitrary(g)
- raise(NameError, _message_should_be_overrided)
+ raise(NotImplementedError, _message_should_be_overrided)
end
end
View
8 test/test_arbitrary.rb
@@ -3,7 +3,9 @@
class TC_Arbitrary < Test::Unit::TestCase
- extend RushCheck::Arbitrary
+ class TC_Arbitrary_Foo
+ extend RushCheck::Arbitrary
+ end
def setup
end
@@ -12,7 +14,7 @@ def teardown
end
def test_arbitrary
- assert_raise(NameError) { arbitrary }
+ assert_raise(NotImplementedError) { TC_Arbitrary_Foo.arbitrary }
end
end
@@ -28,7 +30,7 @@ def teardown
end
def test_coarbitrary
- assert_raise(NameError) { coarbitrary(nil) }
+ assert_raise(NotImplementedError) { coarbitrary(nil) }
end
end

0 comments on commit 124fbe5

Please sign in to comment.