micro_test 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/mt CHANGED
@@ -7,11 +7,13 @@ opts = Slop.parse(:strict => true, :help => true) do
7
7
  on :p, :path, "The path to the test directory or file.", :argument => true
8
8
  on :f, :formatter, "The name of the formatter to use.", :argument => true
9
9
  on :pry, "Starts a pry session whenever tests fail."
10
+ on :demo, "Runs the MicroTest test suite."
10
11
  end
11
12
 
12
13
  exit if opts[:help]
13
14
 
14
15
  path = opts[:path] || "test"
16
+ path = File.expand_path(File.join(File.dirname(__FILE__), "..", "test")) if opts[:demo]
15
17
  path = File.join(Dir.pwd, path) unless path =~ /^\//
16
18
  unless File.exist?(path)
17
19
  puts "#{path} not found."
@@ -15,13 +15,13 @@ module MicroTest
15
15
  end
16
16
 
17
17
  def group(name)
18
- puts name
18
+ puts white(name)
19
19
  end
20
20
 
21
21
  def test(info)
22
22
  @total += 1
23
23
  info[:passed] ? @passed += 1 : @failed += 1
24
- print "- #{info[:name]} "
24
+ print "- test #{info[:name]} "
25
25
  if info[:passed]
26
26
  puts green(:PASS)
27
27
  else
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), "..", "color")
2
+
3
+ module MicroTest
4
+ class Formatter
5
+ include MicroTest::Color
6
+
7
+ def initialize
8
+ end
9
+
10
+ def header
11
+ end
12
+
13
+ def group(name)
14
+ end
15
+
16
+ def test(info)
17
+ if info[:passed]
18
+ print green(".")
19
+ else
20
+ print red("x")
21
+ end
22
+ end
23
+
24
+ def footer
25
+ puts
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ require File.join(File.dirname(__FILE__), "..", "color")
2
+
3
+ module MicroTest
4
+ class Formatter
5
+ include MicroTest::Color
6
+
7
+ def initialize
8
+ @total = 0
9
+ @passed = 0
10
+ @failed = 0
11
+ end
12
+
13
+ def header
14
+ end
15
+
16
+ def group(name)
17
+ end
18
+
19
+ def test(info)
20
+ @total += 1
21
+ info[:passed] ? @passed += 1 : @failed += 1
22
+ end
23
+
24
+ def footer
25
+ puts "Tests: #{@total}, Passed: #{green @passed}, Failed: #{red @failed}"
26
+ end
27
+
28
+ end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micro_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -70,6 +70,8 @@ extra_rdoc_files: []
70
70
  files:
71
71
  - lib/micro_test/color.rb
72
72
  - lib/micro_test/formatters/default.rb
73
+ - lib/micro_test/formatters/dots.rb
74
+ - lib/micro_test/formatters/min.rb
73
75
  - lib/micro_test/runner.rb
74
76
  - lib/micro_test/test.rb
75
77
  - lib/micro_test.rb