File tree 3 files changed +64
-0
lines changed
3 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ require 'rake/testtask'
5
+ Rake ::TestTask . new ( :test ) do |test |
6
+ test . libs << 'lib' << 'test'
7
+ test . pattern = 'test/**/*_test.rb'
8
+ end
9
+
10
+ task :default => [ :test ]
Original file line number Diff line number Diff line change
1
+ require 'test_helper'
2
+ silent { load 'bin/dashing' }
3
+
4
+ module Thor ::Actions
5
+ def source_paths
6
+ [ File . join ( File . expand_path ( File . dirname ( __FILE__ ) ) , '../templates' ) ]
7
+ end
8
+ end
9
+
10
+ class CliTest < Dashing ::Test
11
+
12
+ def test_project_directory_created
13
+ temp do |dir |
14
+ cli = Dashing ::CLI . new
15
+ silent { cli . new 'Dashboard' }
16
+ assert Dir . exist? ( File . join ( dir , 'dashboard' ) ) , 'Dashing directory was not created.'
17
+ end
18
+ end
19
+
20
+ end
Original file line number Diff line number Diff line change
1
+ require 'rack/test'
2
+ require 'stringio'
3
+ require 'test/unit'
4
+ require 'tmpdir'
5
+
6
+ ENV [ 'RACK_ENV' ] = 'test'
7
+ WORKING_DIRECTORY = Dir . pwd . freeze
8
+ ARGV . clear
9
+
10
+ def silent
11
+ _stdout = $stdout
12
+ $stdout = mock = StringIO . new
13
+ begin
14
+ yield
15
+ ensure
16
+ $stdout = _stdout
17
+ end
18
+ end
19
+
20
+ def temp
21
+ path = File . expand_path "#{ Dir . tmpdir } /#{ Time . now . to_i } #{ rand ( 1000 ) } /"
22
+ FileUtils . mkdir_p path
23
+ Dir . chdir path
24
+ yield path
25
+ ensure
26
+ Dir . chdir WORKING_DIRECTORY
27
+ FileUtils . rm_rf ( path ) if File . exists? ( path )
28
+ end
29
+
30
+ module Dashing
31
+ class Test < Test ::Unit ::TestCase
32
+ include Rack ::Test ::Methods
33
+ end
34
+ end
You can’t perform that action at this time.
0 commit comments