spork-local_process 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/CHANGES
CHANGED
@@ -5,7 +5,11 @@ module Spork
|
|
5
5
|
class TabCompletion
|
6
6
|
def self.init
|
7
7
|
Readline.completion_append_character = nil
|
8
|
-
Readline.completion_proc =
|
8
|
+
Readline.completion_proc = lambda do |s|
|
9
|
+
Dir[s + "*"].map do |m|
|
10
|
+
File.directory?(m) && m !~ /\/$/ ? m + "/" : m
|
11
|
+
end
|
12
|
+
end
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -5,7 +5,8 @@ class Spork::TestFramework::RSpec < Spork::TestFramework
|
|
5
5
|
else
|
6
6
|
::RSpec.reset
|
7
7
|
::RSpec.configuration.formatters.clear if ::RSpec.configuration.formatters
|
8
|
-
::RSpec
|
8
|
+
::RSpec.configuration.clear_inclusion_filter
|
9
|
+
::RSpec.world.shared_example_groups.clear
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../lib/spork/run_strategy/local_process'
|
2
|
+
|
3
|
+
describe Spork::RunStrategy::LocalProcess do
|
4
|
+
it "doesn't run LocalProcess when Spork is used with server" do
|
5
|
+
Spork.should_receive(:using_spork?).and_return(true)
|
6
|
+
Spork::RunStrategy::LocalProcess.should_not_receive(:run)
|
7
|
+
load File.dirname(__FILE__) + "/../../../lib/spork/local_process.rb"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "runs LocalProcess when Spork is not used with server" do
|
11
|
+
Spork::Runner.any_instance.should_receive(:find_test_framework).and_return(nil)
|
12
|
+
Spork.should_receive(:using_spork?).and_return(false)
|
13
|
+
Spork::RunStrategy::LocalProcess.any_instance.should_receive(:run).and_return(true)
|
14
|
+
load File.dirname(__FILE__) + "/../../../lib/spork/local_process.rb"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "runs specs in a loop" do
|
18
|
+
test_framework = mock_test_framework
|
19
|
+
test_framework.should_not_receive(:additional_options=)
|
20
|
+
|
21
|
+
Readline.should_receive(:readline).with("> 'some_specs' or: ").and_return("\n")
|
22
|
+
Spork::RunStrategy::LocalProcess.new(test_framework).run(["some_specs"], STDERR, STDOUT)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "allows to specify new filter" do
|
26
|
+
test_framework = mock_test_framework "other_specs", 2
|
27
|
+
test_framework.should_receive(:run_tests).with(["other_specs"], STDERR, STDOUT)
|
28
|
+
test_framework.should_not_receive(:additional_options=)
|
29
|
+
test_framework.should_receive(:options_str).with("other_specs", nil).and_return("other_specs")
|
30
|
+
|
31
|
+
Readline.should_receive(:readline).with("> 'some_specs' or: ").and_return("other_specs\n")
|
32
|
+
Readline.should_receive(:readline).with("> 'other_specs' or: ").and_return("\n")
|
33
|
+
Spork::RunStrategy::LocalProcess.new(test_framework).run(["some_specs"], STDERR, STDOUT)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "allows to specify additional options" do
|
37
|
+
test_framework = mock_test_framework "other_specs", 2
|
38
|
+
test_framework.should_receive(:run_tests).with(["other_specs"], STDERR, STDOUT)
|
39
|
+
test_framework.should_receive(:additional_options=).with(%q[some additional opts])
|
40
|
+
test_framework.should_receive(:options_str).with("other_specs", "some additional opts").and_return(%q[other_specs "some additional opts"])
|
41
|
+
|
42
|
+
Readline.should_receive(:readline).with("> 'some_specs' or: ").and_return(%Q[other_specs "some additional opts"\n])
|
43
|
+
Readline.should_receive(:readline).with(%Q[> 'other_specs "some additional opts"' or: ]).and_return("\n")
|
44
|
+
Spork::RunStrategy::LocalProcess.new(test_framework).run(["some_specs"], STDERR, STDOUT)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "exits the process if 'exit' is specified as a filter" do
|
48
|
+
test_framework = mock_test_framework
|
49
|
+
|
50
|
+
Readline.should_receive(:readline).with("> 'some_specs' or: ").and_return("exit\n")
|
51
|
+
expect {
|
52
|
+
Spork::RunStrategy::LocalProcess.new(test_framework).run(["some_specs"], STDERR, STDOUT)
|
53
|
+
}.to raise_exception(SystemExit)
|
54
|
+
end
|
55
|
+
|
56
|
+
def mock_test_framework new_filter=nil, loop_count=1
|
57
|
+
test_framework = double('TestFramework')
|
58
|
+
test_framework.should_receive(:run_tests).with(["some_specs"], STDERR, STDOUT)
|
59
|
+
test_framework.should_receive(:options_str).with(["some_specs"], nil).and_return("some_specs")
|
60
|
+
|
61
|
+
test_framework.should_receive(:preload).exactly(loop_count).times
|
62
|
+
test_framework.should_receive(:reset).exactly(loop_count).times
|
63
|
+
|
64
|
+
Spork.should_receive(:exec_each_run).exactly(loop_count).times
|
65
|
+
Spork.should_receive(:exec_after_each_run).exactly(loop_count).times
|
66
|
+
Spork.stub(:using_spork?) {(loop_count -= 1) == -1}
|
67
|
+
|
68
|
+
test_framework
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
data/spork-local_process.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "spork-local_process"
|
6
|
-
s.version = "0.0.
|
6
|
+
s.version = "0.0.4"
|
7
7
|
s.authors = ["Jarmo Pertman"]
|
8
8
|
s.email = ["jarmo.p@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/jarmo/spork-local_process"
|
metadata
CHANGED
@@ -1,36 +1,52 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spork-local_process
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Jarmo Pertman
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2011-09-29 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: spork
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
25
|
+
requirements:
|
19
26
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 15424151
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 9
|
32
|
+
- 0
|
33
|
+
- rc
|
34
|
+
- 9
|
21
35
|
version: 0.9.0.rc9
|
22
36
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
the whole environment each time.
|
27
|
-
email:
|
37
|
+
version_requirements: *id001
|
38
|
+
description: Run your code in a local process with Spork again and again without reloading the whole environment each time.
|
39
|
+
email:
|
28
40
|
- jarmo.p@gmail.com
|
29
41
|
executables: []
|
42
|
+
|
30
43
|
extensions: []
|
44
|
+
|
31
45
|
extra_rdoc_files: []
|
32
|
-
|
46
|
+
|
47
|
+
files:
|
33
48
|
- .gitignore
|
49
|
+
- .rspec
|
34
50
|
- CHANGES
|
35
51
|
- Gemfile
|
36
52
|
- LICENSE
|
@@ -40,30 +56,40 @@ files:
|
|
40
56
|
- lib/spork/local_process.rb
|
41
57
|
- lib/spork/run_strategy/local_process.rb
|
42
58
|
- lib/spork/test_framework/rspec.rb
|
59
|
+
- spec/spork/run_strategies/local_process_spec.rb
|
43
60
|
- spork-local_process.gemspec
|
44
61
|
homepage: https://github.com/jarmo/spork-local_process
|
45
62
|
licenses: []
|
63
|
+
|
46
64
|
post_install_message:
|
47
65
|
rdoc_options: []
|
48
|
-
|
66
|
+
|
67
|
+
require_paths:
|
49
68
|
- lib
|
50
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
70
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
79
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
62
87
|
requirements: []
|
88
|
+
|
63
89
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.8.
|
90
|
+
rubygems_version: 1.8.4
|
65
91
|
signing_key:
|
66
92
|
specification_version: 3
|
67
|
-
summary: Run your code in a local process with Spork again and again without reloading
|
68
|
-
the whole environment each time.
|
93
|
+
summary: Run your code in a local process with Spork again and again without reloading the whole environment each time.
|
69
94
|
test_files: []
|
95
|
+
|