1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

ActionDispatch::Journey::Routes#empty? test cases

This commit is contained in:
Valentine Valyaeff 2015-05-19 01:21:20 +03:00
parent e3333697fc
commit bad30ed46c
3 changed files with 17 additions and 1 deletions

View file

@ -15,7 +15,7 @@ module ActionDispatch
@custom_routes = []
@simulator = nil
end
def empty?
routes.empty?
end

View file

@ -17,6 +17,16 @@ module ActionDispatch
@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
refute empty?
end
test "url helpers are added when route is added" do
draw do
get 'foo', to: SimpleApp.new('foo#index')
@ -136,6 +146,10 @@ module ActionDispatch
def url_helpers
@set.url_helpers
end
def empty?
@set.empty?
end
end
end
end

View file

@ -14,9 +14,11 @@ module ActionDispatch
requirements = { :hello => /world/ }
routes.add_route nil, path, requirements, {:id => nil}, {}
refute routes.empty?
assert_equal 1, routes.length
routes.clear
assert routes.empty?
assert_equal 0, routes.length
end