micro_test 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,8 @@
1
1
  source :rubygems
2
2
 
3
3
  gem "slop"
4
- gem "pry"
5
- gem "pry-stack_explorer"
4
+
5
+ group :debug do
6
+ gem "pry"
7
+ gem "pry-stack_explorer"
8
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MicroTest
2
2
 
3
- ## The Sinatra of testing frameworks.
3
+ ## The Sinatra of testing frameworks
4
4
 
5
5
  ### Quick Start
6
6
 
@@ -35,4 +35,15 @@ Run
35
35
  $ mt
36
36
  ```
37
37
 
38
+ Want BDD?
39
+
40
+ ```ruby
41
+ class DescribeMyObject < MicroTest::Test
42
+ test "that a feature does something" do
43
+ assert true
44
+ end
45
+ end
46
+ ```
47
+
48
+
38
49
  [See the product page for more details.](http://hopsoft.github.com/micro_test/)
data/bin/mt CHANGED
@@ -90,4 +90,6 @@ if opts[:pry]
90
90
  end
91
91
  end
92
92
 
93
+ @start = Time.now
93
94
  MicroTest::Runner.run formatter, opts.to_hash
95
+ puts "Completed in #{Time.now - @start} seconds."
data/lib/micro_test.rb CHANGED
@@ -1,6 +1,9 @@
1
- path = File.expand_path(File.join(File.dirname(__FILE__), "micro_test"))
2
- require File.join(path, "version")
3
- require File.join(path, "test")
4
- require File.join(path, "runner")
1
+ require "bundler"
2
+ Bundler.require :default
3
+ Bundler.require :debug
4
+
5
+ path = File.join(File.dirname(__FILE__), "micro_test", "*.rb")
6
+ Dir[path].each { |file| require file }
5
7
 
6
8
  MicroTest::Test.add_observer MicroTest::Runner
9
+
@@ -21,15 +21,17 @@ module MicroTest
21
21
  def test(info)
22
22
  @total += 1
23
23
  info[:passed] ? @passed += 1 : @failed += 1
24
- print "- test #{info[:name]} "
24
+ duration = (info[:duration] * 10**4).round.to_f / 10**4
25
+ msg = "#{info[:name]} ".ljust(60, ".") + duration.to_s
25
26
  if info[:passed]
26
- puts green(:PASS)
27
+ puts " #{green(:PASS)} #{msg}"
27
28
  else
28
29
  if info[:error]
30
+ puts msg
29
31
  puts "#{red :ERROR} #{red info[:error].message}"
30
32
  puts " #{red info[:error].backtrace[0]}"
31
33
  else
32
- puts red(:FAIL)
34
+ puts " #{red(:FAIL)} #{msg}"
33
35
  info[:asserts].each do |assert|
34
36
  next if assert[:passed]
35
37
  puts " #{red assert[:line]}"
@@ -52,8 +52,9 @@ module MicroTest
52
52
  @failed = false
53
53
  @asserts = []
54
54
  test_class.invoke :before, :each
55
+ start = Time.now
55
56
  test_class.tests[desc].call
56
- formatter.test :name => desc, :passed => !@failed, :asserts => @asserts
57
+ formatter.test :name => desc, :passed => !@failed, :asserts => @asserts, :duration => Time.now - start
57
58
  test_class.invoke :after, :each
58
59
  end
59
60
 
@@ -1,3 +1,3 @@
1
1
  module MicroTest
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  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.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-29 00:00:00.000000000 Z
12
+ date: 2012-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slop
@@ -106,8 +106,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 1.8.24
109
+ rubygems_version: 1.8.23
110
110
  signing_key:
111
111
  specification_version: 3
112
112
  summary: The Sinatra of testing frameworks.
113
113
  test_files: []
114
+ has_rdoc: