knapsack 1.3.3 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0974720e7e8e9f9aa97785ba24e51c894659e169
4
- data.tar.gz: 80ce683d5dcc6347686ae8b632fe428da6273d75
3
+ metadata.gz: d3884defa102a784ebc24edee1f7f0bce15e47c2
4
+ data.tar.gz: 54a6980e2ae231d9048a5d864a345995af50bba9
5
5
  SHA512:
6
- metadata.gz: cda9a461a9b1916bbcc228ec35ca9d0181d2200c2b756dee6ae5d251c4a72b89598f874c3b04d206aadcdc3391f704cea8415acf968ceeb3805417a542ab0208
7
- data.tar.gz: bfc05588f5864fa8879029f1a2f8783501b29d953e1fbe41161000852493e04a2bbd0f51f2a4672795792a5a815831517dc1aaacab61fe0b59da247f2fb58f80
6
+ metadata.gz: 99669c6406a29636495159672d56dfe176ed4573c690929e18a8b092c54b269408ca3eecc76b005a6a5842d34496d08bb8cdcb644af01feeaca38d7deca87409
7
+ data.tar.gz: f09fbc5afeac38e7ec5a943e3527c049fb2f7b77c2df42dff9967f0db4840fb17a681fcbe052546ab36be9aaf6544648ecc1610b06cd7c816d20441358790a22
@@ -2,6 +2,14 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.3.4
6
+
7
+ * Make knapsack backwards compatible with earlier version of minitest
8
+
9
+ https://github.com/ArturT/knapsack/pull/26
10
+
11
+ https://github.com/ArturT/knapsack/compare/v1.3.3...v1.3.4
12
+
5
13
  ### 1.3.3
6
14
 
7
15
  * Fix wrong dependency for timecop
@@ -23,20 +23,20 @@ module Knapsack
23
23
  def bind_time_tracker
24
24
  ::Minitest::Test.send(:include, BindTimeTrackerMinitestPlugin)
25
25
 
26
- ::Minitest.after_run do
26
+ add_post_run_callback do
27
27
  Knapsack.logger.info(Presenter.global_time)
28
28
  end
29
29
  end
30
30
 
31
31
  def bind_report_generator
32
- Minitest.after_run do
32
+ add_post_run_callback do
33
33
  Knapsack.report.save
34
34
  Knapsack.logger.info(Presenter.report_details)
35
35
  end
36
36
  end
37
37
 
38
38
  def bind_time_offset_warning
39
- Minitest.after_run do
39
+ add_post_run_callback do
40
40
  Knapsack.logger.warn(Presenter.time_offset_warning)
41
41
  end
42
42
  end
@@ -47,7 +47,8 @@ module Knapsack
47
47
  end
48
48
 
49
49
  def self.test_path(obj)
50
- test_method_name = obj.name
50
+ # Pick the first public method in the class itself, that starts with "test_"
51
+ test_method_name = obj.public_methods(false).select{|m| m =~ /^test_/ }.first
51
52
  method_object = obj.method(test_method_name)
52
53
  full_test_path = method_object.source_location.first
53
54
  parent_of_test_dir_regexp = Regexp.new("^#{@@parent_of_test_dir}")
@@ -55,6 +56,16 @@ module Knapsack
55
56
  # test_path will look like ./test/dir/unit_test.rb
56
57
  test_path
57
58
  end
59
+
60
+ private
61
+
62
+ def add_post_run_callback(&block)
63
+ if Minitest.respond_to?(:after_run)
64
+ Minitest.after_run { block.call }
65
+ else
66
+ Minitest::Unit.after_tests { block.call }
67
+ end
68
+ end
58
69
  end
59
70
  end
60
71
  end
@@ -15,7 +15,7 @@ module Knapsack
15
15
  cmd = %Q[bundle exec cucumber #{args} -- #{allocator.stringify_node_tests}]
16
16
 
17
17
  system(cmd)
18
- exit($?.exitstatus) unless $?.exitstatus == 0
18
+ exit($?.exitstatus) unless $?.exitstatus.zero?
19
19
  end
20
20
  end
21
21
  end
@@ -15,7 +15,7 @@ module Knapsack
15
15
  cmd = %Q[bundle exec rspec #{args} --default-path #{allocator.test_dir} -- #{allocator.stringify_node_tests}]
16
16
 
17
17
  system(cmd)
18
- exit($?.exitstatus) unless $?.exitstatus == 0
18
+ exit($?.exitstatus) unless $?.exitstatus.zero?
19
19
  end
20
20
  end
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.3.3'
2
+ VERSION = '1.3.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake