summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Beauchamp <daniel.beauchamp@gmail.com>2015-04-26 22:44:09 -0400
committerDaniel Beauchamp <daniel.beauchamp@gmail.com>2015-04-26 22:44:09 -0400
commit66cd2039a3397387cd5399d65a415ceb53a12a32 (patch)
tree500aebafe910c7b19befadc3ead52ad4958e71e8
parentf4b121e8dead69e02223ee9d50e431dbc7f5b3c5 (diff)
parent937fcce2dcca8010dbe8e9e26df954cb1330c1e0 (diff)
Merge pull request #558 from svendahlstrand/fix_404
Make sure a 404 is returned for non existing dashboard
-rw-r--r--lib/dashing/app.rb2
-rw-r--r--test/app_test.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/dashing/app.rb b/lib/dashing/app.rb
index 921bf9c..0e7f7bb 100644
--- a/lib/dashing/app.rb
+++ b/lib/dashing/app.rb
@@ -50,7 +50,7 @@ end
end
not_found do
- send_file File.join(settings.public_folder, '404.html')
+ send_file File.join(settings.public_folder, '404.html'), status: 404
end
at_exit do
diff --git a/test/app_test.rb b/test/app_test.rb
index 4101e91..4acb27a 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -129,6 +129,13 @@ class AppTest < Dashing::Test
end
end
+ def test_get_nonexistent_dashboard_sends_file_with_404_status
+ with_generated_project do
+ app.any_instance.expects(:send_file).with(anything, has_entry(:status, 404))
+ get '/nodashboard'
+ end
+ end
+
def test_get_widget
with_generated_project do
get '/views/meter.html'