From 0528b408a371f171ab4121a59240ed5edd3808b5 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 29 Apr 2014 15:29:01 -0400 Subject: [PATCH] Add an integration test for the new Ember 404 route --- lib/tasks/integration.rake | 3 ++- test/javascripts/fixtures/unknown_fixtures.js | 2 ++ test/javascripts/integration/unknown_test.js | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/javascripts/fixtures/unknown_fixtures.js create mode 100644 test/javascripts/integration/unknown_test.js diff --git a/lib/tasks/integration.rake b/lib/tasks/integration.rake index 3065c79b0ef..cb0579b5bce 100644 --- a/lib/tasks/integration.rake +++ b/lib/tasks/integration.rake @@ -14,7 +14,8 @@ task 'integration:create_fixtures' => :environment do "/user_actions.json?offset=0&username=eviltrout&filter=1", "/user_actions.json?offset=0&username=eviltrout&filter=2", "/user_actions.json?offset=0&username=eviltrout&filter=11"], - static: ["/faq", '/tos', '/privacy'] + static: ["/faq", '/tos', '/privacy'], + unknown: ['/404-body'] } fixtures.each do |type, urls| diff --git a/test/javascripts/fixtures/unknown_fixtures.js b/test/javascripts/fixtures/unknown_fixtures.js new file mode 100644 index 00000000000..fd4b536c3cb --- /dev/null +++ b/test/javascripts/fixtures/unknown_fixtures.js @@ -0,0 +1,2 @@ +/*jshint maxlen:10000000 */ +Discourse.URL_FIXTURES["/404-body"] = "\n\u003Ch1 class=\"page-not-found\"\u003EThe page you requested doesn\u0026#39;t exist or is private.\u003C/h1\u003E\n\n\u003Cdiv class=\"row\"\u003E\n \u003Cdiv class=\"span8\"\u003E\n \u003Ch2 class=\"popular-topics-title\"\u003EPopular topics\u003C/h2\u003E\n \u003Ca href=\"/t/is-it-better-for-discourse-to-use-javascript-or-coffeescript/3153\"\u003EIs it better for Discourse to use JavaScript or CoffeeScript?\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/tuning-ruby-and-rails-for-discourse/4126\"\u003ETuning Ruby and Rails for Discourse\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/welcome-to-meta-discourse-org/1\"\u003EWelcome to meta.discourse.org\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/what-is-wrong-with-phpbb/3763\"\u003EWhat is wrong with PHPBB?\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/what-is-a-onebox/4546\"\u003EWhat is a onebox?\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/so-you-want-to-help-out-with-discourse/3823\"\u003ESo, you want to help out with Discourse\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/please-visit-our-discourse-forum-directory/3102\"\u003EPlease visit our Discourse Forum! (Directory)\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/why-is-discourse-so-slow-on-android/8823\"\u003EWhy is Discourse so slow on Android?\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/what-i-love-about-wordpress-plugins/5697\"\u003EWhat I love about WordPress plugins\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/anyone-got-this-running-on-heroku-yet/625\"\u003EAnyone got this running on Heroku yet?\u003C/a\u003E\u003Cbr/\u003E\n \u003Cbr/\u003E\n \u003Ca href=\"/latest\" class=\"btn\"\u003ESee More\u0026hellip;\u003C/a\u003E\n \u003C/div\u003E\n \u003Cdiv class=\"span8\"\u003E\n \u003Ch2 class=\"recent-topics-title\"\u003ERecent topics\u003C/h2\u003E\n \u003Ca href=\"/t/making-external-api-call-after-logging-in/15160\"\u003EMaking external API call after logging in\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/upload-maximum-value/15159\"\u003EUpload maximum value\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/people-with-experience-bitnami-vs-discoursehosting-com-s/15156\"\u003EPeople with experience, Bitnami vs DiscourseHosting.com? :S\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/support-docker-v0-9-1-and-up/15154\"\u003ESupport Docker v0.9.1 and up\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/how-to-rearrange-participants-list/15152\"\u003EHow to rearrange participants list?\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/how-to-use-category-color-as-background-color/15151\"\u003EHow to use category color as background color?\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/roadmap-for-styling-email-digest/15150\"\u003ERoadmap for styling email digest\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/undefined-on-latest-link/15148\"\u003EUndefined on latest link\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/performance-through-the-roof-since-docker-izing/15147\"\u003EPerformance through the roof since docker-izing\u003C/a\u003E\u003Cbr/\u003E\n \u003Ca href=\"/t/a-image-slider-possible/15139\"\u003EA Image Slider? Possible?\u003C/a\u003E\u003Cbr/\u003E\n \u003Cbr/\u003E\n \u003Ca href=\"/latest\" class=\"btn\"\u003ESee More\u0026hellip;\u003C/a\u003E\n \u003C/div\u003E\n\u003C/div\u003E\n\n"; diff --git a/test/javascripts/integration/unknown_test.js b/test/javascripts/integration/unknown_test.js new file mode 100644 index 00000000000..a48e38d9212 --- /dev/null +++ b/test/javascripts/integration/unknown_test.js @@ -0,0 +1,8 @@ +integration("Unknown"); + +test("Unknown URL", function() { + expect(1); + visit("/url-that-doesn't-exist").then(function() { + ok(exists(".page-not-found"), "The not found content is present"); + }); +});