Be more specific when catching 'URL not found' error, also add test
This commit is contained in:
parent
65254b70da
commit
c0d23f5579
|
@ -9,7 +9,7 @@ Ember.Router.reopen
|
||||||
try
|
try
|
||||||
@_super(url)
|
@_super(url)
|
||||||
catch error
|
catch error
|
||||||
@_super('/not-found')
|
@_super('/not-found') if error.message.match(/No route matched the URL/)
|
||||||
|
|
||||||
# TODO: don't reopen Ember.Route to add events, there should be
|
# TODO: don't reopen Ember.Route to add events, there should be
|
||||||
# a better way (like "parent" resource for everything inside map)
|
# a better way (like "parent" resource for everything inside map)
|
||||||
|
|
7
assets/scripts/spec/routes_spec.coffee
Normal file
7
assets/scripts/spec/routes_spec.coffee
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
describe 'router', ->
|
||||||
|
it 'renders notFound template when URL can\t be found', ->
|
||||||
|
app '/somehing/something/something/.../dark/side/..../something/something/something/.../complete'
|
||||||
|
waitFor appRendered
|
||||||
|
runs ->
|
||||||
|
expect( $('#main').text().trim() ).toEqual('The requested page was not found.')
|
||||||
|
|
|
@ -12,3 +12,4 @@
|
||||||
@queuesRendered = notEmpty('#queue_linux li')
|
@queuesRendered = notEmpty('#queue_linux li')
|
||||||
@workersRendered = notEmpty('.worker')
|
@workersRendered = notEmpty('.worker')
|
||||||
@logRendered = notEmpty('#log p')
|
@logRendered = notEmpty('#log p')
|
||||||
|
@appRendered = -> $('.ember-view.application').length
|
||||||
|
|
Loading…
Reference in New Issue
Block a user