summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Underwood <david.underwood@jadedpixel.com>2013-07-29 11:56:43 -0400
committerDavid Underwood <david.underwood@jadedpixel.com>2013-07-29 11:56:43 -0400
commitff467e28a14163f6257c260fdd570c0ccd95228c (patch)
tree44ec670aa78aa0c1b5f998d947662e5ed0251702 /test
parentc2fad09e3b3845f80fb6e60f7ceb7e64c60dd633 (diff)
parent60dcd73bac913afe0a49b6c6c07b709aa288fd7d (diff)
Merge remote-tracking branch 'cjolly/cjolly-application-messages'
* cjolly/cjolly-application-messages: only fire dashboard events when target is current dashboard dashboard events - use SSE event names Adding application messaging. Conflicts: test/app_test.rb
Diffstat (limited to 'test')
-rw-r--r--test/app_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/app_test.rb b/test/app_test.rb
index 0546814..0032165 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -42,6 +42,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'
@@ -142,4 +152,8 @@ class AppTest < Dashing::Test
def parse_data(string)
JSON.parse string[/data: (.+)/, 1]
end
+
+ def parse_event(string)
+ string[/event: (.+)/, 1]
+ end
end