testrbl 0.5.1 → 0.5.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/testrbl.rb +6 -1
- data/lib/testrbl/version.rb +1 -1
- data/spec/testrbl_spec.rb +28 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6512a4285a824c0bb92db42df4dc797a4df84254
|
4
|
+
data.tar.gz: 53b3b9c920952bf895f889d937a37d380db6efe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7330868c50baf797bcf4c02e0218240281f20f2d5a16ef477f43f1af5c3170035036da6ecca33a6fad9b75b972cceeae71e394f91ba5bffc8da8575d2d2b5dd
|
7
|
+
data.tar.gz: 10729f1d80db2d57a8bf07ad4acb3f1ce67a71723a5118ae1a5bc9afa53e129ae247d5be5ec726a2cd4527bc72ac59ed7f19f1dc2ca079beef601f3beba4ec07
|
data/Gemfile.lock
CHANGED
data/lib/testrbl.rb
CHANGED
@@ -24,8 +24,13 @@ module Testrbl
|
|
24
24
|
if files.size == 1 and File.file?(files.first)
|
25
25
|
run(ruby + load_options + files + options)
|
26
26
|
elsif options.none? { |arg| arg =~ /^-n/ }
|
27
|
+
seed = if seed = options.index("--seed")
|
28
|
+
["--"] + options.slice!(seed, 2)
|
29
|
+
else
|
30
|
+
[]
|
31
|
+
end
|
27
32
|
files = files.map { |f| File.directory?(f) ? all_test_files_in(f) : f }.flatten
|
28
|
-
run(ruby + load_options + files.map { |f| "-r#{f}" } + options + ["-e", ""])
|
33
|
+
run(ruby + load_options + files.map { |f| "-r#{f}" } + options + ["-e", ""] + seed)
|
29
34
|
else # pass though
|
30
35
|
# no bundle exec: projects with mini and unit-test do not run well via bundle exec testrb
|
31
36
|
run ["testrb"] + argv
|
data/lib/testrbl/version.rb
CHANGED
data/spec/testrbl_spec.rb
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'tmpdir'
|
2
3
|
|
3
4
|
describe Testrbl do
|
4
5
|
around do |example|
|
5
|
-
|
6
|
-
Dir.chdir "tmp" do
|
7
|
-
example.call
|
8
|
-
end
|
9
|
-
#run "rm -rf tmp"
|
6
|
+
Dir.mktmpdir { |dir| Dir.chdir(dir, &example) }
|
10
7
|
end
|
11
8
|
|
12
9
|
def run(cmd, options={})
|
@@ -72,6 +69,32 @@ describe Testrbl do
|
|
72
69
|
end
|
73
70
|
end
|
74
71
|
|
72
|
+
context "--seed" do
|
73
|
+
before do
|
74
|
+
2.times do |i|
|
75
|
+
write "#{i}_test.rb", <<-RUBY
|
76
|
+
require 'minitest/autorun'
|
77
|
+
|
78
|
+
class Xxx#{i} < Minitest::Test
|
79
|
+
def test_xxx
|
80
|
+
puts 'ABC'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
RUBY
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it "seeds a single file" do
|
88
|
+
result = testrbl "0_test.rb:6 --seed 1234"
|
89
|
+
result.should include "1234"
|
90
|
+
end
|
91
|
+
|
92
|
+
it "seeds multiple files" do
|
93
|
+
result = Bundler.with_clean_env { testrbl "0_test.rb 1_test.rb --seed 1234" } # adding --seed triggers minitest to be loaded in a weird way and then the second version is loaded via bundler :/
|
94
|
+
result.should include "1234"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
75
98
|
context "def test_" do
|
76
99
|
before do
|
77
100
|
write "a_test.rb", <<-RUBY
|