maxitest 2.1.0 → 2.2.0

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: 23ffc55ac5838f7616fbd1f3730ca2b437451ee1
4
- data.tar.gz: 8bb2adea9ffb877e7c88fe98f4e64473e88e6fb7
3
+ metadata.gz: 54c24623a3edfdd8ed7e5ffd766aa7825a2cd071
4
+ data.tar.gz: 911241be2e422f384ead493f76e179509f16c4bb
5
5
  SHA512:
6
- metadata.gz: bb18db7c7db8056bc9bbfe895455a8ddefd7e76e8449bc3f4b258e9944715d4457d2e6d8cf831922ca715d5062c3055465642be42b2761973ea39f7166187f86
7
- data.tar.gz: 1e37bb695a936a4b0370a8d50bce889a20d568784fa69a7d33ceb445b3d86f44f2524d6ac01ebe70a650fe38ea5a4261630d58524630a23ef35c4733921dc226
6
+ metadata.gz: 0d612e58ff3da7d6dbd2a2524f33e4be863873ec0a5bd42516edf869c81a42035d3b733ea87f7ee53b7e77fcbde7381273286638dc636b66bbd82bf2fe88dcba
7
+ data.tar.gz: 0553b33303d3bd4fc59894faaeee5beb474de7b2f38f8e2b80f68d7181c6396738e717924f2d947ed1ccdb3e2e191fcbb8e0db3451f2fd2dde92b342fe879dbe
@@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
29
  # https://raw.githubusercontent.com/splattael/minitest-around/master/lib/minitest/around/version.rb
30
30
  # BEGIN generated by rake update, do not modify
31
31
  module MinitestAround
32
- VERSION = '0.3.2'
32
+ VERSION = '0.4.0'
33
33
  end
34
34
  #END generated by rake update, do not modify
35
35
 
@@ -71,10 +71,12 @@ Minitest::Spec::DSL.class_eval do
71
71
  end
72
72
 
73
73
  # Minitest does not support multiple before/after blocks
74
+ remove_method :before
74
75
  def before(type=nil, &block)
75
76
  include Module.new { define_method(:setup) { super(); instance_exec(&block) } }
76
77
  end
77
78
 
79
+ remove_method :after
78
80
  def after(type=nil, &block)
79
81
  include Module.new { define_method(:teardown) { instance_exec(&block); super() } }
80
82
  end
@@ -52,8 +52,8 @@ module Minitest
52
52
 
53
53
  def describes_with_lines(target_file)
54
54
  runnables.map do |runnable|
55
- next unless caller = runnable.instance_variable_get(:@minitest_line_caller)
56
- next unless line = caller.detect { |line| line.include?(target_file) }
55
+ next unless caller = runnable.instance_variable_defined?(:@minitest_line_caller) && runnable.instance_variable_get(:@minitest_line_caller)
56
+ next unless line = caller.detect { |l| l.include?(target_file) }
57
57
  ["/#{Regexp.escape(runnable.name)}/", line[/:(\d+):in/, 1].to_i]
58
58
  end.compact
59
59
  end
@@ -117,11 +117,23 @@ module Maxitest
117
117
  end
118
118
 
119
119
  def changed_files
120
- changed_files = `git status -s`.split("\n").map { |l| l.strip.split(/\s+/, 2)[1] }
121
- raise "Failed: #{changed_files}" unless $?.success?
120
+ changed_files = sh("git status -s").split("\n").map { |l| l.strip.split(/\s+/, 2)[1] }
121
+
122
+ if changed_files.empty?
123
+ # user wants to test last commit and not current diff
124
+ changed_files = sh("git show --name-only").split("\n\n").last.split("\n")
125
+ end
126
+
127
+ # we only want test files that were added or changed (not deleted)
122
128
  changed_files.select { |f| f =~ /_(test|spec)\.rb$/ && File.exist?(f) }
123
129
  end
124
130
 
131
+ def sh(command)
132
+ result = `#{command}`
133
+ raise "Failed: #{command} -> #{result}" unless $?.success?
134
+ result
135
+ end
136
+
125
137
  def ruby
126
138
  if File.file?("Gemfile")
127
139
  ["ruby", "-rbundler/setup"] # faster then bundle exec ruby
@@ -1,3 +1,3 @@
1
1
  module Maxitest
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -3,7 +3,7 @@ Minitest::Spec::DSL.class_eval do
3
3
  describe "skip" do
4
4
  def setup; end
5
5
  def teardown; end
6
- it *args
6
+ it(*args)
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maxitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-14 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest