diff --git a/assets/scripts/app/routes.coffee b/assets/scripts/app/routes.coffee index 711111a8..3457d14b 100644 --- a/assets/scripts/app/routes.coffee +++ b/assets/scripts/app/routes.coffee @@ -5,13 +5,7 @@ Ember.Router.reopen handleURL: (url) -> url = url.replace(/#.*?$/, '') - try - @_super(url) - catch error - if error.message.match(/No route matched the URL/) - @_super('/not-found') - else - throw(error) + @_super(url) # TODO: don't reopen Ember.Route to add events, there should be # a better way (like "parent" resource for everything inside map) @@ -93,7 +87,6 @@ Travis.Router.map -> @route 'first_sync' @route 'stats', path: '/stats' @route 'auth', path: '/auth' - @route 'notFound', path: '/not-found' @resource 'profile', path: '/profile', -> @route 'index', path: '/' @@ -101,6 +94,8 @@ Travis.Router.map -> @route 'index', path: '/' @route 'profile', path: '/profile' + @route 'notFound', path: "/*path" + Travis.SetupLastBuild = Ember.Mixin.create setupController: -> @repoDidLoad() diff --git a/assets/scripts/spec/integration/routes_spec.coffee b/assets/scripts/spec/integration/routes_spec.coffee index bf491c1c..b8130988 100644 --- a/assets/scripts/spec/integration/routes_spec.coffee +++ b/assets/scripts/spec/integration/routes_spec.coffee @@ -1,9 +1,9 @@ -#module "Router", -# setup: -> -# Ember.run -> Travis.advanceReadiness() -# teardown: -> -# Ember.run -> Travis.reset() -# -#test 'renders notFound template when URL can\t be found', -> -# visit('/somehing/something/something/.../dark/side/..../something/something/something/.../complete').then -> -# equal('The requested page was not found.', $('#main').text().trim()) +module "Router", + setup: -> + Ember.run -> Travis.advanceReadiness() + teardown: -> + Ember.run -> Travis.reset() + +test 'renders notFound template when URL can\t be found', -> + visit('/somehing/something/something/.../dark/side/..../something/something/something/.../complete').then -> + equal('The requested page was not found.', $('#main').text().trim())