Permalink
Browse files

no more is_a checks on instantiation

  • Loading branch information...
1 parent bb207ea commit da2cf937aa68c2470c0d4a73c29fe3555b2667c0 @tenderlove tenderlove committed May 29, 2014
@@ -11,15 +11,10 @@ def self.from_string string
end
def initialize(strexp)
- case strexp
- when Router::Strexp
- @spec = strexp.ast
- @requirements = strexp.requirements
- @separators = strexp.separators.join
- @anchored = strexp.anchor
- else
- raise ArgumentError, "Bad expression: #{strexp}"
- end
+ @spec = strexp.ast
+ @requirements = strexp.requirements
+ @separators = strexp.separators.join
+ @anchored = strexp.anchor
@names = nil
@optional_names = nil
@@ -75,10 +75,6 @@ class TestPattern < ActiveSupport::TestCase
end
end
- def test_to_raise_exception_with_bad_expression
- assert_raise(ArgumentError, "Bad expression: []") { Pattern.new [] }
- end
-
def test_to_regexp_with_extended_group
strexp = Router::Strexp.build(
'/page/:name',

0 comments on commit da2cf93

Please sign in to comment.