summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChad Jolly <cjolly@lawgical.com>2013-07-14 18:36:19 -0600
committerChad Jolly <cjolly@lawgical.com>2013-07-14 18:36:19 -0600
commit5f8cbcb7debde027e79d87733b84cb852aa47dad (patch)
tree14113289a63f7039c792b7c1a2b645f0f36efd96 /test
parent3f58bbd626cd84d1cb24375b4d8fe6df75ce85ba (diff)
dashboard events - use SSE event names
Diffstat (limited to 'test')
-rw-r--r--test/app_test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/app_test.rb b/test/app_test.rb
index 8b1be19..69e57c9 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -41,6 +41,16 @@ class AppTest < Dashing::Test
assert_equal 8, parse_data(@connection[0])['value']
end
+ def test_dashboard_events
+ post '/dashboards/my_super_sweet_dashboard', JSON.generate({event: 'reload'})
+ assert_equal 204, last_response.status
+
+ get '/events'
+ assert_equal 200, last_response.status
+ assert_equal 'dashboards', parse_event(@connection[0])
+ assert_equal 'reload', parse_data(@connection[0])['event']
+ end
+
def test_redirect_to_default_dashboard
with_generated_project do
Sinatra::Application.settings.default_dashboard = 'test1'
@@ -141,4 +151,8 @@ class AppTest < Dashing::Test
def parse_data(string)
JSON.parse string[/data: (.+)/, 1]
end
-end \ No newline at end of file
+
+ def parse_event(string)
+ string[/event: (.+)/, 1]
+ end
+end