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:
parent
e3333697fc
commit
bad30ed46c
3 changed files with 17 additions and 1 deletions
|
@ -15,7 +15,7 @@ module ActionDispatch
|
|||
@custom_routes = []
|
||||
@simulator = nil
|
||||
end
|
||||
|
||||
|
||||
def empty?
|
||||
routes.empty?
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue