spork-minitest 0.0.3 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +16 -0
- data/Rakefile +55 -0
- data/Readme.md +23 -6
- data/bin/testdrb +4 -1
- data/lib/spork/test_framework/minitest.rb +5 -3
- data/spec_project/spec/some_spec.rb +7 -0
- data/spec_project/spec/spec_helper.rb +6 -0
- data/spork-minitest.gemspec +15 -0
- data/unit_project/test/first_test.rb +11 -0
- data/unit_project/test/second_test.rb +7 -0
- data/unit_project/test/test_helper.rb +6 -0
- metadata +17 -7
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
def running(*args)
|
5
|
+
pid = spawn(*args)
|
6
|
+
yield
|
7
|
+
ensure
|
8
|
+
Process.kill :INT, pid
|
9
|
+
end
|
10
|
+
|
11
|
+
def prompt_wait message = nil
|
12
|
+
puts message
|
13
|
+
$stdin.gets
|
14
|
+
end
|
15
|
+
|
16
|
+
def run env = {}, command
|
17
|
+
puts command
|
18
|
+
out_rd, out_wr = IO.pipe
|
19
|
+
system env, command, out: out_wr
|
20
|
+
out_wr.close
|
21
|
+
puts "-" * 30, "Output:", out_rd.read, "-" * 30
|
22
|
+
end
|
23
|
+
|
24
|
+
def testdrb env = {}, args
|
25
|
+
run env, "bundle exec testdrb #{args}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def cd path, &block
|
29
|
+
FileUtils.cd path, verbose: true, &block
|
30
|
+
end
|
31
|
+
|
32
|
+
task "test:unit" do
|
33
|
+
cd "unit_project" do
|
34
|
+
running "bundle exec spork minitest" do
|
35
|
+
prompt_wait "Press return when spork is loaded"
|
36
|
+
testdrb "test/first_test.rb"
|
37
|
+
testdrb "test/first_test.rb test/second_test.rb"
|
38
|
+
testdrb "test/first_test.rb -- -n test_false"
|
39
|
+
testdrb "test/first_test.rb -- -n test_false -v"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
task "test:spec" do
|
45
|
+
cd "spec_project" do
|
46
|
+
running({"HELPER_FILE" => "spec/spec_helper.rb"}, "bundle exec spork minitest -p 8990") do
|
47
|
+
prompt_wait "Press return when spork is loaded"
|
48
|
+
testdrb({ "SPORK_PORT" => "8990" }, "spec/some_spec.rb")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
task :test => ["test:unit", "test:spec"]
|
54
|
+
|
55
|
+
task :default => :test
|
data/Readme.md
CHANGED
@@ -13,7 +13,7 @@ with the following differences:
|
|
13
13
|
|
14
14
|
`ruby test/test_first.rb --seed 12345 -n test_truth`
|
15
15
|
|
16
|
-
When using testdrb you pass them after double dash:
|
16
|
+
When using testdrb you pass them after a double dash:
|
17
17
|
|
18
18
|
`testdrb test/first_test.rb -- --seed 12345 -n test_truth`
|
19
19
|
|
@@ -22,25 +22,40 @@ with the following differences:
|
|
22
22
|
Some automated test running tools like Autotest and Guard
|
23
23
|
rely on this to detect test failure.
|
24
24
|
|
25
|
-
* Does not support -I option
|
25
|
+
* Does not support -I option to modify load path.
|
26
|
+
|
26
27
|
|
27
28
|
Usage
|
28
29
|
-----
|
29
30
|
|
30
31
|
Add it to your gemfile.
|
31
32
|
|
32
|
-
gem "spork-minitest", "~> 0.0.
|
33
|
+
gem "spork-minitest", "~> 1.0.0.beta1"
|
33
34
|
|
34
35
|
Install spork into your test helper using the following command or manually.
|
35
36
|
|
36
37
|
spork minitest --bootstrap
|
37
38
|
|
38
|
-
Start `spork` and run your tests using `testdrb`.
|
39
|
+
Start `spork` and run your tests using `testdrb`. Some examples:
|
39
40
|
|
40
41
|
testdrb test/integration_test.rb
|
42
|
+
testdrb test/integration_test.rb -- --seed 1234
|
43
|
+
SPORK_PORT=8989 testdrb test/integration_test.rb
|
44
|
+
|
45
|
+
If you do `require 'test_helper'` in every test you will get `LoadError: cannot load such file -- test_helper`.
|
46
|
+
To fix that add the following to the very top of your test helper:
|
47
|
+
|
48
|
+
$LOAD_PATH << "test"
|
49
|
+
|
50
|
+
### Different test helper
|
41
51
|
|
42
|
-
|
43
|
-
|
52
|
+
You can specify different test helper when starting spork and run tests as usual.
|
53
|
+
|
54
|
+
HELPER_FILE=spec/spec_helper.rb spork
|
55
|
+
|
56
|
+
### [Autotest][]
|
57
|
+
|
58
|
+
You can run all tests over Spork by adding the following lines to your .autotest file.
|
44
59
|
|
45
60
|
class Autotest
|
46
61
|
# run tests over drb server (spork)
|
@@ -52,3 +67,5 @@ all tests over Spork by adding the following lines to your .autotest file.
|
|
52
67
|
end
|
53
68
|
end
|
54
69
|
end
|
70
|
+
|
71
|
+
[Autotest]: https://github.com/seattlerb/zentest
|
data/bin/testdrb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'drb'
|
3
3
|
|
4
|
+
port = ENV['SPORK_PORT'] || 8988
|
5
|
+
uri = ENV['SPORK_URI'] || "druby://127.0.0.1:#{port}"
|
6
|
+
|
4
7
|
DRb.start_service
|
5
|
-
exit_code = DRbObject.new_with_uri(
|
8
|
+
exit_code = DRbObject.new_with_uri(uri).run(ARGV, $stderr, $stdout)
|
6
9
|
|
7
10
|
exit(exit_code || false)
|
@@ -1,16 +1,18 @@
|
|
1
1
|
class Spork::TestFramework::MiniTest < Spork::TestFramework
|
2
2
|
DEFAULT_PORT = 8988
|
3
|
-
|
3
|
+
|
4
|
+
def self.helper_file
|
5
|
+
ENV['HELPER_FILE'] || "test/test_helper.rb"
|
6
|
+
end
|
4
7
|
|
5
8
|
def run_tests(argv, stderr, stdout)
|
6
9
|
require "minitest/unit"
|
7
|
-
$LOAD_PATH << "test" << "."
|
8
10
|
::MiniTest::Unit.output = stdout
|
9
11
|
|
10
12
|
paths, opts = parse_options(argv)
|
11
13
|
|
12
14
|
paths.each do |path|
|
13
|
-
|
15
|
+
load path
|
14
16
|
end
|
15
17
|
|
16
18
|
::MiniTest::Unit.new.run(opts)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "spork-minitest"
|
3
|
+
s.version = "1.0.0.beta1"
|
4
|
+
s.authors = ["Semyon Perepelitsa"]
|
5
|
+
s.email = ["sema@sema.in"]
|
6
|
+
s.homepage = "https://github.com/semaperepelitsa/spork-minitest"
|
7
|
+
s.summary = "MiniTest runner for Spork"
|
8
|
+
# s.description = %q{TODO: Write a gem description}
|
9
|
+
|
10
|
+
s.executables = ["testdrb"]
|
11
|
+
s.files = File.read('Manifest.txt').split("\n")
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
|
14
|
+
s.add_dependency "spork"
|
15
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spork-minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0.beta1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Semyon Perepelitsa
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spork
|
@@ -35,11 +35,20 @@ executables:
|
|
35
35
|
extensions: []
|
36
36
|
extra_rdoc_files: []
|
37
37
|
files:
|
38
|
+
- Changelog.md
|
39
|
+
- Gemfile
|
40
|
+
- Gemfile.lock
|
41
|
+
- Rakefile
|
42
|
+
- Readme.md
|
38
43
|
- bin/testdrb
|
39
44
|
- lib/spork/test_framework/minitest.rb
|
40
45
|
- metatest/test_spork_minitest.rb
|
41
|
-
-
|
42
|
-
-
|
46
|
+
- spec_project/spec/some_spec.rb
|
47
|
+
- spec_project/spec/spec_helper.rb
|
48
|
+
- spork-minitest.gemspec
|
49
|
+
- unit_project/test/first_test.rb
|
50
|
+
- unit_project/test/second_test.rb
|
51
|
+
- unit_project/test/test_helper.rb
|
43
52
|
homepage: https://github.com/semaperepelitsa/spork-minitest
|
44
53
|
licenses: []
|
45
54
|
post_install_message:
|
@@ -55,9 +64,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
65
|
none: false
|
57
66
|
requirements:
|
58
|
-
- - ! '
|
67
|
+
- - ! '>'
|
59
68
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
69
|
+
version: 1.3.1
|
61
70
|
requirements: []
|
62
71
|
rubyforge_project:
|
63
72
|
rubygems_version: 1.8.23
|
@@ -65,3 +74,4 @@ signing_key:
|
|
65
74
|
specification_version: 3
|
66
75
|
summary: MiniTest runner for Spork
|
67
76
|
test_files: []
|
77
|
+
has_rdoc:
|