Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a test to find default regexp nodes.

  • Loading branch information...
commit e95aeace2ada6379be36075923f2a52c561fb7db 1 parent ba53081
@tenderlove tenderlove authored
Showing with 21 additions and 1 deletion.
  1. +6 −1 lib/journey/nodes/node.rb
  2. +15 −0 test/nodes/test_symbol.rb
View
7 lib/journey/nodes/node.rb
@@ -53,9 +53,14 @@ class Symbol < Terminal
attr_accessor :regexp
alias :symbol :regexp
+ DEFAULT_EXP = /[^\.\/\?]+/
def initialize left
super
- @regexp = /[^\.\/\?]+/
+ @regexp = DEFAULT_EXP
+ end
+
+ def default_regexp?
+ regexp == DEFAULT_EXP
end
end
View
15 test/nodes/test_symbol.rb
@@ -0,0 +1,15 @@
+require 'helper'
+
+module Journey
+ module Nodes
+ class TestSymbol < MiniTest::Unit::TestCase
+ def test_default_regexp?
+ sym = Symbol.new nil
+ assert sym.default_regexp?
+
+ sym.regexp = nil
+ refute sym.default_regexp?
+ end
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.