micro_test 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/mt +23 -7
  2. data/lib/micro_test/test.rb +0 -1
  3. metadata +2 -2
data/bin/mt CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ require "rubygems"
2
3
  require "slop"
3
4
  lib_path = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
4
5
  require File.join(lib_path, "micro_test")
@@ -54,15 +55,30 @@ MicroTest::PRY = !!opts[:pry]
54
55
  if MicroTest::PRY
55
56
  require "pry"
56
57
  require "pry-stack_explorer"
57
- $micro_test_demo = true
58
58
 
59
- Pry.config.hooks.add_hook :before_session, :print_instructions do
60
- puts "".rjust(80, "-")
61
- puts "#{MicroTest::Runner.current_test} #{red "FAIL"}"
59
+ MicroTest::Test.add_observer(Class.new do
60
+ def self.update(event, arg)
61
+ binding.pry(:quiet => true) if event == :assert && !arg
62
+ end
63
+ end)
64
+
65
+ Pry.config.hooks.add_hook :before_session, :print_instructions do |_, _, _pry_|
66
+ _pry_.commands.create_command "line", "View the assert line that failed." do
67
+ def process
68
+ _pry_.run_command "up 5"
69
+ end
70
+ end
71
+
72
+ puts
73
+ puts "".ljust(80, "-")
74
+ puts "| #{MicroTest::Runner.current_test} #{red "FAIL"}".ljust(88) + "|"
75
+ puts "".ljust(80, "-")
76
+ puts "| Type #{yellow "line"} to see the line that failed... then".ljust(88) + "|"
77
+ puts "| #{magenta "whereami 10"} for more context".ljust(88) + "|"
78
+ puts "| #{magenta "edit-method"} to make the fix".ljust(88) + "|"
79
+ puts "| or <CTL-D> to continue".ljust(79) + "|"
80
+ puts "".ljust(80, "-")
62
81
  puts
63
- puts "Type #{yellow "up"} to see the line that failed... then"
64
- puts " #{magenta "whereami 10"} for more context"
65
- puts " #{magenta "edit-method"} to make the fix"
66
82
  end
67
83
  end
68
84
 
@@ -39,7 +39,6 @@ module MicroTest
39
39
  end
40
40
 
41
41
  def assert(value)
42
- binding.pry if MicroTest::PRY && !value
43
42
  notify(:assert, value)
44
43
  end
45
44
 
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.1
4
+ version: 0.2.2
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-11 00:00:00.000000000 Z
12
+ date: 2012-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slop