summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Peckham <apeckham@gmail.com>2013-05-09 23:27:44 -0700
committerAaron Peckham <apeckham@gmail.com>2013-05-09 23:27:44 -0700
commit8795505a06fe58dfb5f414078587349b7771af62 (patch)
tree75a612925b66d4dd7c414e4f6bd7773460f6e28c /test
parent56b3ac96521c2630fde811b0f5fdf045a4ab7ff3 (diff)
use any Tilt-supported view engine for dashboards, including Haml
Diffstat (limited to 'test')
-rw-r--r--test/app_test.rb32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/app_test.rb b/test/app_test.rb
index f6fa537..83bdb74 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -58,6 +58,15 @@ class AppTest < Dashing::Test
end
end
+ def test_redirect_to_first_dashboard_without_erb
+ with_generated_project do |dir|
+ FileUtils.touch(File.join(dir, "dashboards/htmltest.html"))
+ get '/'
+ assert_equal 302, last_response.status
+ assert_equal 'http://example.org/htmltest', last_response.location
+ end
+ end
+
def test_get_dashboard
with_generated_project do
get '/sampletv'
@@ -65,7 +74,26 @@ class AppTest < Dashing::Test
assert_include last_response.body, 'class="gridster"'
end
end
-
+
+ begin
+ require 'haml'
+ def test_get_haml
+ with_generated_project do |dir|
+ File.write(File.join(dir, "dashboards/hamltest.haml"), <<-HAML)
+.gridster
+ %ul
+ %li{data: {col: 1, row: 1, sizex: 1, sizey: 1}}
+ %div{data: {view: "Clock"}}
+ %i.icon-time.icon-background
+HAML
+ get '/hamltest'
+ assert_equal 200, last_response.status
+ assert_include last_response.body, "class='gridster'"
+ end
+ end
+ rescue LoadError
+ end
+
def test_get_nonexistent_dashboard
with_generated_project do
get '/nodashboard'
@@ -88,7 +116,7 @@ class AppTest < Dashing::Test
Sinatra::Application.settings.views = File.join(dir, 'new_project/dashboards')
Sinatra::Application.settings.root = File.join(dir, 'new_project')
- yield
+ yield Sinatra::Application.settings.root
end
end