From 69ed82efa8319e7fbde9df95a4fad4ee96aa5074 Mon Sep 17 00:00:00 2001 From: pseudomuto Date: Wed, 18 Dec 2013 15:49:32 -0500 Subject: adding haml to dev dependencies so all tests run --- test/app_test.rb | 37 ++++++++++++++++--------------------- test/test_helper.rb | 3 ++- 2 files changed, 18 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/app_test.rb b/test/app_test.rb index 0032165..0547eb8 100644 --- a/test/app_test.rb +++ b/test/app_test.rb @@ -1,5 +1,6 @@ require 'test_helper' -require File.expand_path('../../lib/dashing', __FILE__) +require 'haml' + Sinatra::Application.settings.history_file = File.join(Dir.tmpdir, 'history.yml') class AppTest < Dashing::Test @@ -94,29 +95,23 @@ class AppTest < Dashing::Test end end - begin - require 'haml' - - def test_get_haml_dashboard - with_generated_project do |dir| - File.write(File.join(dir, 'dashboards/hamltest.haml'), '.gridster') - get '/hamltest' - assert_equal 200, last_response.status - assert_include last_response.body, "class='gridster'" - end + def test_get_haml_dashboard + with_generated_project do |dir| + File.write(File.join(dir, 'dashboards/hamltest.haml'), '.gridster') + get '/hamltest' + assert_equal 200, last_response.status + assert_include last_response.body, "class='gridster'" end + end - def test_get_haml_widget - with_generated_project do |dir| - File.write(File.join(dir, 'widgets/clock/clock.haml'), '%h1 haml') - File.unlink(File.join(dir, 'widgets/clock/clock.html')) - get '/views/clock.html' - assert_equal 200, last_response.status - assert_include last_response.body, '

haml

' - end + def test_get_haml_widget + with_generated_project do |dir| + File.write(File.join(dir, 'widgets/clock/clock.haml'), '%h1 haml') + File.unlink(File.join(dir, 'widgets/clock/clock.html')) + get '/views/clock.html' + assert_equal 200, last_response.status + assert_include last_response.body, '

haml

' end - rescue LoadError - puts "[skipping haml tests because haml isn't installed]" end def test_get_nonexistent_dashboard diff --git a/test/test_helper.rb b/test/test_helper.rb index d2337c5..b4bbd9e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,7 @@ require 'rack/test' require 'stringio' require 'test/unit' require 'tmpdir' +require_relative '../lib/dashing' ENV['RACK_ENV'] = 'test' WORKING_DIRECTORY = Dir.pwd.freeze @@ -31,4 +32,4 @@ module Dashing class Test < Test::Unit::TestCase include Rack::Test::Methods end -end \ No newline at end of file +end -- cgit v1.2.3