summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpseudomuto <david.muto@gmail.com>2013-12-18 15:55:46 -0500
committerpseudomuto <david.muto@gmail.com>2013-12-18 16:17:10 -0500
commitc3a72795ecab47f94527e079b60549051843caa4 (patch)
tree0e424b9739e7ade1ad0c9095c91bf41ef7a1da7d
parent69ed82efa8319e7fbde9df95a4fad4ee96aa5074 (diff)
switching from test unit to minitest
-rw-r--r--dashing.gemspec1
-rw-r--r--test/app_test.rb15
-rw-r--r--test/cli_test.rb6
-rw-r--r--test/test_helper.rb23
4 files changed, 25 insertions, 20 deletions
diff --git a/dashing.gemspec b/dashing.gemspec
index de4a590..704d66a 100644
--- a/dashing.gemspec
+++ b/dashing.gemspec
@@ -28,5 +28,6 @@ Gem::Specification.new do |s|
s.add_development_dependency('rake', '~> 10.1.0')
s.add_development_dependency('haml', '~> 4.0.4')
+ s.add_development_dependency('minitest', '~> 5.2.0')
end
diff --git a/test/app_test.rb b/test/app_test.rb
index 0547eb8..a176d2e 100644
--- a/test/app_test.rb
+++ b/test/app_test.rb
@@ -1,11 +1,10 @@
require 'test_helper'
require 'haml'
-Sinatra::Application.settings.history_file = File.join(Dir.tmpdir, 'history.yml')
-
class AppTest < Dashing::Test
def setup
@connection = []
+ Sinatra::Application.settings.history_file = File.join(Dir.tmpdir, 'history.yml')
Sinatra::Application.settings.connections = [@connection]
Sinatra::Application.settings.auth_token = nil
Sinatra::Application.settings.default_dashboard = nil
@@ -83,15 +82,15 @@ class AppTest < Dashing::Test
with_generated_project do
get '/sampletv'
assert_equal 200, last_response.status
- assert_include last_response.body, 'class="gridster"'
- assert_include last_response.body, "DOCTYPE"
+ assert_includes last_response.body, 'class="gridster"'
+ assert_includes last_response.body, "DOCTYPE"
end
end
def test_page_title_set_correctly
with_generated_project do
get '/sampletv'
- assert_include last_response.body, '<title>1080p dashboard</title>'
+ assert_includes last_response.body, '<title>1080p dashboard</title>'
end
end
@@ -100,7 +99,7 @@ class AppTest < Dashing::Test
File.write(File.join(dir, 'dashboards/hamltest.haml'), '.gridster')
get '/hamltest'
assert_equal 200, last_response.status
- assert_include last_response.body, "class='gridster'"
+ assert_includes last_response.body, "class='gridster'"
end
end
@@ -110,7 +109,7 @@ class AppTest < Dashing::Test
File.unlink(File.join(dir, 'widgets/clock/clock.html'))
get '/views/clock.html'
assert_equal 200, last_response.status
- assert_include last_response.body, '<h1>haml</h1>'
+ assert_includes last_response.body, '<h1>haml</h1>'
end
end
@@ -125,7 +124,7 @@ class AppTest < Dashing::Test
with_generated_project do
get '/views/meter.html'
assert_equal 200, last_response.status
- assert_include last_response.body, 'class="meter"'
+ assert_includes last_response.body, 'class="meter"'
end
end
diff --git a/test/cli_test.rb b/test/cli_test.rb
index 6c43e2c..2bf3b65 100644
--- a/test/cli_test.rb
+++ b/test/cli_test.rb
@@ -1,5 +1,5 @@
require 'test_helper'
-silent{ load 'bin/dashing' }
+load_quietly 'bin/dashing'
module Thor::Actions
def source_paths
@@ -12,7 +12,7 @@ class CliTest < Dashing::Test
def test_project_directory_created
temp do |dir|
cli = Dashing::CLI.new
- silent{ cli.new 'Dashboard' }
+ silent { cli.new 'Dashboard' }
assert Dir.exist?(File.join(dir,'dashboard')), 'Dashing directory was not created.'
end
end
@@ -25,4 +25,4 @@ class CliTest < Dashing::Test
assert_equal 'super-power-rangers', Dashing::CLI.hyphenate('SuperPowerRangers')
end
-end \ No newline at end of file
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index b4bbd9e..9c51b87 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,20 +1,19 @@
require 'rack/test'
require 'stringio'
-require 'test/unit'
require 'tmpdir'
+
+require 'minitest/autorun'
+require 'minitest/pride'
+
require_relative '../lib/dashing'
ENV['RACK_ENV'] = 'test'
WORKING_DIRECTORY = Dir.pwd.freeze
ARGV.clear
-def silent
- _stdout = $stdout
- $stdout = mock = StringIO.new
- begin
- yield
- ensure
- $stdout = _stdout
+def load_quietly(file)
+ Minitest::Test.new(nil).capture_io do
+ load file
end
end
@@ -29,7 +28,13 @@ ensure
end
module Dashing
- class Test < Test::Unit::TestCase
+ class Test < Minitest::Test
include Rack::Test::Methods
+
+ alias_method :silent, :capture_io
+
+ def teardown
+ FileUtils.rm_f('history.yml')
+ end
end
end