summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Peckham <apeckham@gmail.com>2013-05-07 21:27:46 -0700
committerpushmatrix <daniel.beauchamp@gmail.com>2013-05-09 21:27:14 +0200
commit50c8638f95584dbd863de6da042755ea400ee40b (patch)
tree0a3fc3f6d4a74100f1b1d52a79222b2a4bccf37a /test
parent1a974c754789b0b675d39442cead91213f706851 (diff)
add test for redirecting to first dashboard, and returning a 404 if dashboard doesn't exist
Diffstat (limited to 'test')
-rw-r--r--test/app_test.rb32
1 files changed, 25 insertions, 7 deletions
diff --git a/test/app_test.rb b/test/app_test.rb
index 445c538..f6fa537 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -6,13 +6,7 @@ class AppTest < Dashing::Test
@connection = []
Sinatra::Application.settings.connections = [@connection]
Sinatra::Application.settings.auth_token = nil
- end
-
- def test_redirect_to_default_dashboard
- Sinatra::Application.settings.default_dashboard = 'test1'
- get '/'
- assert_equal 302, last_response.status
- assert_equal 'http://example.org/test1', last_response.location
+ Sinatra::Application.settings.default_dashboard = nil
end
def test_post_widgets_without_auth_token
@@ -46,6 +40,23 @@ class AppTest < Dashing::Test
assert_equal 200, last_response.status
assert_equal 8, parse_data(@connection[0])['value']
end
+
+ def test_redirect_to_default_dashboard
+ with_generated_project do
+ Sinatra::Application.settings.default_dashboard = 'test1'
+ get '/'
+ assert_equal 302, last_response.status
+ assert_equal 'http://example.org/test1', last_response.location
+ end
+ end
+
+ def test_redirect_to_first_dashboard
+ with_generated_project do
+ get '/'
+ assert_equal 302, last_response.status
+ assert_equal 'http://example.org/sample', last_response.location
+ end
+ end
def test_get_dashboard
with_generated_project do
@@ -54,6 +65,13 @@ class AppTest < Dashing::Test
assert_include last_response.body, 'class="gridster"'
end
end
+
+ def test_get_nonexistent_dashboard
+ with_generated_project do
+ get '/nodashboard'
+ assert_equal 404, last_response.status
+ end
+ end
def test_get_widget
with_generated_project do