micro_test 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/mt CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "slop"
3
3
  require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "micro_test"))
4
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "micro_test", "color"))
5
+
6
+ include MicroTest::Color
4
7
 
5
8
  opts = Slop.parse(:strict => true, :help => true) do
6
9
  banner "mt [options]"
@@ -48,7 +51,12 @@ if MicroTest::PRY
48
51
  require "pry-stack_explorer"
49
52
  # require "pry-exception_explorer"
50
53
  Pry.config.hooks.add_hook :before_session, :print_instructions do
51
- puts "#{MicroTest::Color.red "Assert Failed!"} #{MicroTest::Color.yellow "Type 'up' to see the line that failed."}"
54
+ puts "".rjust(40, "-")
55
+ puts "test '#{MicroTest::Runner.current_test}' #{red "FAIL"}"
56
+ puts "".rjust(40, "-")
57
+ puts "Type #{yellow "up"} to see the line that failed... then"
58
+ puts " #{magenta "whereami 10"} for more context."
59
+ puts " #{magenta "edit-method"} to make the fix."
52
60
  end
53
61
  # EE.enabled = true
54
62
  # EE.intercept do |frame , ex|
@@ -5,7 +5,6 @@ module MicroTest
5
5
  include MicroTest::Color
6
6
 
7
7
  def initialize
8
- @total = 0
9
8
  @passed = 0
10
9
  @failed = 0
11
10
  end
@@ -17,12 +16,11 @@ module MicroTest
17
16
  end
18
17
 
19
18
  def test(info)
20
- @total += 1
21
19
  info[:passed] ? @passed += 1 : @failed += 1
22
20
  end
23
21
 
24
22
  def footer
25
- puts "Tests: #{@total}, Passed: #{green @passed}, Failed: #{red @failed}"
23
+ puts "Passed: #{green @passed}, Failed: #{red @failed}"
26
24
  end
27
25
 
28
26
  end
@@ -1,6 +1,7 @@
1
1
  module MicroTest
2
2
  module Runner
3
3
  class << self
4
+ attr_reader :current_test
4
5
 
5
6
  def update(event, arg)
6
7
  send event, arg
@@ -38,6 +39,7 @@ module MicroTest
38
39
  end
39
40
 
40
41
  def run(formatter, opts={})
42
+ @current_test = nil
41
43
  formatter.header
42
44
 
43
45
  test_classes.shuffle.each do |test_class|
@@ -45,6 +47,7 @@ module MicroTest
45
47
  test_class.invoke :before, :all
46
48
 
47
49
  test_class.tests.keys.shuffle.each do |desc|
50
+ @current_test = desc
48
51
  @failed = false
49
52
  @asserts = []
50
53
  test_class.invoke :before, :each
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.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: