Permalink
Browse files

Merge pull request #27 from jtheoof/master

add error string when widget not rendered
  • Loading branch information...
2 parents fe9af96 + 1315cac commit 953e16c254d8108167e391cc2104b9dffc725536 @tylermauthe tylermauthe committed on GitHub Dec 9, 2016
Showing with 9 additions and 0 deletions.
  1. +1 −0 lib/dashing/app.rb
  2. +8 −0 test/app_test.rb
View
@@ -121,6 +121,7 @@ def authenticated?(token)
file = File.join(settings.root, "widgets", params[:widget], "#{params[:widget]}.#{suffix}")
return engines.first.new(file).render if File.exist? file
end
+ "Drats! Unable to find a widget file named: #{params[:widget]} to render."
end
Thin::Server.class_eval do
View
@@ -137,6 +137,14 @@ def test_get_widget
end
end
+ def test_get_nonexistent_widget
+ with_generated_project do
+ get '/views/nowidget.html'
+ assert_equal 200, last_response.status
+ assert_equal last_response.body, 'Drats! Unable to find a widget file named: nowidget to render.'
+ end
+ end
+
def with_generated_project
source_path = File.expand_path('../../templates', __FILE__)

0 comments on commit 953e16c

Please sign in to comment.