knapsack_pro 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 298cd101879e3a4da08f66de0b2ccfe6fd4be478
4
- data.tar.gz: a393fbb53dff07029ffcc4ffde88b7a99150f9aa
3
+ metadata.gz: 5cda0e0e6281dd44b8b51af6d7cac7872f79b08e
4
+ data.tar.gz: c7911a8fc5345af87a0d29ac224a5143789e0c58
5
5
  SHA512:
6
- metadata.gz: 67bb457b7c35e6c1135f197d34a67e0b4e222e9a8be9dd24a093b2761fdf497349c2b2cd95d5636333f6bb9aadb980ab56374b2b3d914e3457422be86cd5fe2d
7
- data.tar.gz: 4bcc5069b5aa69d8be4f1477a332c0318a97f4d122493cd6c393196ea672831e921093ad402542a99018928f83d1dc5d59cd038b8dadf66ba2859c72c75effc2
6
+ metadata.gz: 2082cbd396b2c6f4460eff48a7cc0878ca498ccd6285f5a98fa551e04e3e143d90ed1fbee31db9e928a944544f5888d3aff9a893bfd98bcada9c74c1d30198e5
7
+ data.tar.gz: 7cb3a536848041dfa7c940baeed3cfaf67b8450e6aa9c198e4de06c9a823d14a4837cc2c6a8f3ccf12e02ef46047024d7362a70422619f254fd40a996691394b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.1.1
6
+
7
+ * Make knapsack_pro backwards compatible with earlier version of minitest
8
+
9
+ Related PR from knapsack gem repository:
10
+ https://github.com/ArturT/knapsack/pull/26
11
+
12
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.1.0...v0.1.1
13
+
5
14
  ### 0.1.0
6
15
 
7
16
  First working release on rubygems.org.
@@ -5,7 +5,8 @@ module KnapsackPro
5
5
  @@parent_of_test_dir = nil
6
6
 
7
7
  def self.test_path(obj)
8
- test_method_name = obj.name
8
+ # Pick the first public method in the class itself, that starts with "test_"
9
+ test_method_name = obj.public_methods(false).select{|m| m =~ /^test_/ }.first
9
10
  method_object = obj.method(test_method_name)
10
11
  full_test_path = method_object.source_location.first
11
12
  parent_of_test_dir_regexp = Regexp.new("^#{@@parent_of_test_dir}")
@@ -32,13 +33,13 @@ module KnapsackPro
32
33
  def bind_time_tracker
33
34
  ::Minitest::Test.send(:include, BindTimeTrackerMinitestPlugin)
34
35
 
35
- ::Minitest.after_run do
36
+ add_post_run_callback do
36
37
  KnapsackPro.logger.info(KnapsackPro::Presenter.global_time)
37
38
  end
38
39
  end
39
40
 
40
41
  def bind_save_report
41
- Minitest.after_run do
42
+ add_post_run_callback do
42
43
  KnapsackPro::Report.save
43
44
  end
44
45
  end
@@ -47,6 +48,16 @@ module KnapsackPro
47
48
  test_dir_path = File.dirname(file_path)
48
49
  @@parent_of_test_dir = File.expand_path('../', test_dir_path)
49
50
  end
51
+
52
+ private
53
+
54
+ def add_post_run_callback(&block)
55
+ if Minitest.respond_to?(:after_run)
56
+ Minitest.after_run { block.call }
57
+ else
58
+ Minitest::Unit.after_tests { block.call }
59
+ end
60
+ end
50
61
  end
51
62
  end
52
63
  end
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT