Be more specific when catching 'URL not found' error, also add test

This commit is contained in:
Piotr Sarnacki 2013-03-19 21:30:53 +01:00
parent 65254b70da
commit c0d23f5579
3 changed files with 9 additions and 1 deletions

View File

@ -9,7 +9,7 @@ Ember.Router.reopen
try
@_super(url)
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
# a better way (like "parent" resource for everything inside map)

View 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.')

View File

@ -12,3 +12,4 @@
@queuesRendered = notEmpty('#queue_linux li')
@workersRendered = notEmpty('.worker')
@logRendered = notEmpty('#log p')
@appRendered = -> $('.ember-view.application').length