Permalink
Browse files

Merge pull request #20191 from juggernaut-/patch-1

Added ActionDispatch::Journey::Routes#empty?
  • Loading branch information...
rafaelfranca committed May 18, 2015
1 parent d8a6555 commit 21abb6edb155291b8a5f8ecd90454016951938d5
@@ -15,6 +15,10 @@ def initialize
@simulator = nil
end
def empty?
routes.empty?
end
def length
routes.length
end
@@ -17,6 +17,16 @@ def call(env)
@set = RouteSet.new
end
test "not being empty when route is added" do
assert empty?
draw do
get 'foo', to: SimpleApp.new('foo#index')
end
assert_not empty?
end
test "url helpers are added when route is added" do
draw do
get 'foo', to: SimpleApp.new('foo#index')
@@ -92,6 +102,10 @@ def draw(&block)
def url_helpers
@set.url_helpers
end
def empty?
@set.empty?
end
end
end
end
@@ -10,9 +10,11 @@ def test_clear
requirements = { :hello => /world/ }
routes.add_route nil, path, requirements, {:id => nil}, {}
assert_not routes.empty?
assert_equal 1, routes.length
routes.clear
assert routes.empty?
assert_equal 0, routes.length
end

0 comments on commit 21abb6e

Please sign in to comment.