spork 0.9.0.rc8 → 0.9.0.rc9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/features/gemfiles/rails3.0/Gemfile +2 -2
- data/features/gemfiles/rails3.0/Gemfile.lock +31 -12
- data/features/support/env.rb +1 -1
- data/lib/spork/gem_helpers.rb +2 -2
- data/lib/spork/run_strategy/magazine.rb +1 -0
- data/lib/spork/test_framework/cucumber.rb +2 -2
- data/lib/spork/test_framework/rspec.rb +10 -6
- data/spec/spec_helper.rb +85 -91
- data/spec/spork/app_framework/rails_spec.rb +1 -1
- data/spec/spork/app_framework/unknown_spec.rb +1 -1
- data/spec/spork/app_framework_spec.rb +1 -1
- data/spec/spork/diagnoser_spec.rb +1 -1
- data/spec/spork/forker_spec.rb +2 -2
- data/spec/spork/run_strategy/forking_spec.rb +1 -1
- data/spec/spork/runner_spec.rb +1 -1
- data/spec/spork/server_spec.rb +1 -1
- data/spec/spork/test_framework/cucumber_spec.rb +3 -8
- data/spec/spork/test_framework/rspec_spec.rb +26 -5
- data/spec/spork/test_framework_shared_examples.rb +5 -5
- data/spec/spork/test_framework_spec.rb +1 -1
- data/spec/spork_spec.rb +1 -1
- metadata +4 -4
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/timcharper/projects/spork
|
3
3
|
specs:
|
4
|
-
spork (0.9.0.
|
4
|
+
spork (0.9.0.rc8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -35,24 +35,35 @@ GEM
|
|
35
35
|
activesupport (3.0.7)
|
36
36
|
arel (2.0.9)
|
37
37
|
builder (2.1.2)
|
38
|
+
capybara (1.0.0)
|
39
|
+
mime-types (>= 1.16)
|
40
|
+
nokogiri (>= 1.3.3)
|
41
|
+
rack (>= 1.0.0)
|
42
|
+
rack-test (>= 0.5.4)
|
43
|
+
selenium-webdriver (~> 0.2.0)
|
44
|
+
xpath (~> 0.1.4)
|
45
|
+
childprocess (0.1.9)
|
46
|
+
ffi (~> 1.0.6)
|
38
47
|
columnize (0.3.2)
|
39
|
-
cucumber (0.
|
48
|
+
cucumber (1.0.0)
|
40
49
|
builder (>= 2.1.2)
|
41
50
|
diff-lcs (>= 1.1.2)
|
42
|
-
gherkin (
|
51
|
+
gherkin (~> 2.4.1)
|
43
52
|
json (>= 1.4.6)
|
44
53
|
term-ansicolor (>= 1.0.5)
|
45
|
-
cucumber-rails (0.
|
46
|
-
|
47
|
-
|
48
|
-
|
54
|
+
cucumber-rails (1.0.2)
|
55
|
+
capybara (>= 1.0.0)
|
56
|
+
cucumber (~> 1.0.0)
|
57
|
+
nokogiri (>= 1.4.6)
|
49
58
|
diff-lcs (1.1.2)
|
50
59
|
erubis (2.6.6)
|
51
60
|
abstract (>= 1.0.0)
|
52
|
-
|
61
|
+
ffi (1.0.9)
|
62
|
+
gherkin (2.4.1)
|
53
63
|
json (>= 1.4.6)
|
54
64
|
i18n (0.5.0)
|
55
|
-
json (1.5.
|
65
|
+
json (1.5.3)
|
66
|
+
json_pure (1.5.3)
|
56
67
|
linecache (0.43)
|
57
68
|
mail (2.2.19)
|
58
69
|
activesupport (>= 2.3.6)
|
@@ -60,7 +71,7 @@ GEM
|
|
60
71
|
mime-types (~> 1.16)
|
61
72
|
treetop (~> 1.4.8)
|
62
73
|
mime-types (1.16)
|
63
|
-
nokogiri (1.4.
|
74
|
+
nokogiri (1.4.6)
|
64
75
|
polyglot (0.3.1)
|
65
76
|
rack (1.2.2)
|
66
77
|
rack-mount (0.6.14)
|
@@ -99,19 +110,27 @@ GEM
|
|
99
110
|
ruby-debug-base (~> 0.10.4.0)
|
100
111
|
ruby-debug-base (0.10.4)
|
101
112
|
linecache (>= 0.3)
|
113
|
+
rubyzip (0.9.4)
|
114
|
+
selenium-webdriver (0.2.2)
|
115
|
+
childprocess (>= 0.1.9)
|
116
|
+
ffi (>= 1.0.7)
|
117
|
+
json_pure
|
118
|
+
rubyzip
|
102
119
|
sqlite3-ruby (1.2.5)
|
103
120
|
term-ansicolor (1.0.5)
|
104
121
|
thor (0.14.6)
|
105
122
|
treetop (1.4.9)
|
106
123
|
polyglot (>= 0.3.1)
|
107
124
|
tzinfo (0.3.27)
|
125
|
+
xpath (0.1.4)
|
126
|
+
nokogiri (~> 1.3)
|
108
127
|
|
109
128
|
PLATFORMS
|
110
129
|
ruby
|
111
130
|
|
112
131
|
DEPENDENCIES
|
113
|
-
cucumber (
|
114
|
-
cucumber-rails (
|
132
|
+
cucumber (~> 1.0.0)
|
133
|
+
cucumber-rails (~> 1.0.0)
|
115
134
|
rails (= 3.0.7)
|
116
135
|
rspec (= 2.5.0)
|
117
136
|
rspec-rails (= 2.5.0)
|
data/features/support/env.rb
CHANGED
data/lib/spork/gem_helpers.rb
CHANGED
@@ -19,7 +19,7 @@ module Spork::GemHelpers
|
|
19
19
|
def latest_load_paths
|
20
20
|
case
|
21
21
|
when defined?(Bundler)
|
22
|
-
$LOAD_PATH.uniq
|
22
|
+
$LOAD_PATH.map { |p| File.expand_path(p) }.uniq
|
23
23
|
when Gem.respond_to?(:path)
|
24
24
|
Dir["{#{Gem.path.join(',')}}" + "/gems/*"].inject({}) do |h,f|
|
25
25
|
gem_path = GemPath.new(f)
|
@@ -29,7 +29,7 @@ module Spork::GemHelpers
|
|
29
29
|
h[gem_path.name] = gem_path
|
30
30
|
end
|
31
31
|
h
|
32
|
-
end.values.map(
|
32
|
+
end.values.map { |gem_path| File.expand_path("lib", gem_path.path) }.sort.uniq
|
33
33
|
else
|
34
34
|
STDERR.puts "No mechanism available to scan for other gems implementing spork hooks. "
|
35
35
|
[]
|
@@ -8,6 +8,7 @@ if RUBY_PLATFORM =~ /mswin|mingw/ and RUBY_VERSION < '1.9.1'
|
|
8
8
|
require 'win32/process'
|
9
9
|
rescue LoadError
|
10
10
|
puts "The 'win32-process' gem is required for windows Spork support with ruby 1.9.1 and lower. Install it, or if using bundler, add it to your Gemfile."
|
11
|
+
exit 1
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -9,7 +9,7 @@ class Spork::TestFramework::Cucumber < Spork::TestFramework
|
|
9
9
|
|
10
10
|
def preload
|
11
11
|
require 'cucumber'
|
12
|
-
if ::Cucumber::VERSION >= '0.9.0'
|
12
|
+
if ::Cucumber::VERSION >= '0.9.0' && ::Cucumber::VERSION < '1.0.0'
|
13
13
|
# nothing to do nowadays
|
14
14
|
else
|
15
15
|
preload_legacy_cucumbers
|
@@ -18,7 +18,7 @@ class Spork::TestFramework::Cucumber < Spork::TestFramework
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def run_tests(argv, stderr, stdout)
|
21
|
-
if ::Cucumber::VERSION >= '0.9.0'
|
21
|
+
if ::Cucumber::VERSION >= '0.9.0' && ::Cucumber::VERSION < '1.0.0'
|
22
22
|
::Cucumber::Cli::Main.new(argv, stdout, stderr).execute!
|
23
23
|
else
|
24
24
|
::Cucumber::Cli::Main.new(argv, stdout, stderr).execute!(@step_mother)
|
@@ -3,12 +3,16 @@ class Spork::TestFramework::RSpec < Spork::TestFramework
|
|
3
3
|
HELPER_FILE = File.join(Dir.pwd, "spec/spec_helper.rb")
|
4
4
|
|
5
5
|
def run_tests(argv, stderr, stdout)
|
6
|
-
|
7
|
-
::Spec::Runner::
|
8
|
-
argv,
|
9
|
-
stderr,
|
10
|
-
stdout
|
6
|
+
if rspec1?
|
7
|
+
::Spec::Runner::CommandLine.run(
|
8
|
+
::Spec::Runner::OptionParser.parse(argv, stderr, stdout)
|
11
9
|
)
|
12
|
-
|
10
|
+
else
|
11
|
+
::RSpec::Core::CommandLine.new(argv).run(stderr, stdout)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def rspec1?
|
16
|
+
defined?(Spec) && !defined?(RSpec)
|
13
17
|
end
|
14
18
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,113 +1,107 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
require 'spork'
|
9
|
-
require 'stringio'
|
10
|
-
require 'fileutils'
|
11
|
-
require 'rspec'
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
config.before(:each) do
|
15
|
-
$test_stdout = StringIO.new
|
16
|
-
$test_stderr = StringIO.new
|
17
|
-
@current_dir = nil
|
18
|
-
end
|
19
|
-
|
20
|
-
config.after(:each) do
|
21
|
-
FileUtils.rm_rf(SPEC_TMP_DIR) if File.directory?(SPEC_TMP_DIR)
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def create_file(filename, contents)
|
26
|
-
FileUtils.mkdir_p(SPEC_TMP_DIR) unless File.directory?(SPEC_TMP_DIR)
|
27
|
-
|
28
|
-
in_current_dir do
|
29
|
-
FileUtils.mkdir_p(File.dirname(filename))
|
30
|
-
File.open(filename, 'wb') { |f| f << contents }
|
31
|
-
end
|
32
|
-
end
|
3
|
+
SPEC_TMP_DIR = File.expand_path('tmp', File.dirname(__FILE__))
|
4
|
+
require 'spork'
|
5
|
+
require 'stringio'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'rspec'
|
33
8
|
|
34
|
-
|
35
|
-
|
36
|
-
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.before(:each) do
|
11
|
+
$test_stdout = StringIO.new
|
12
|
+
$test_stderr = StringIO.new
|
13
|
+
@current_dir = nil
|
14
|
+
end
|
37
15
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
def windows?
|
51
|
-
ENV['OS'] == 'Windows_NT'
|
52
|
-
end
|
16
|
+
config.after(:each) do
|
17
|
+
FileUtils.rm_rf(SPEC_TMP_DIR) if File.directory?(SPEC_TMP_DIR)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_file(filename, contents)
|
22
|
+
FileUtils.mkdir_p(SPEC_TMP_DIR) unless File.directory?(SPEC_TMP_DIR)
|
23
|
+
|
24
|
+
in_current_dir do
|
25
|
+
FileUtils.mkdir_p(File.dirname(filename))
|
26
|
+
File.open(filename, 'wb') { |f| f << contents }
|
53
27
|
end
|
28
|
+
end
|
54
29
|
|
30
|
+
def create_helper_file(test_framework = FakeFramework)
|
31
|
+
create_file(test_framework.helper_file, "# stub spec helper file")
|
32
|
+
end
|
55
33
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
def initialize(substring_or_regex)
|
60
|
-
case substring_or_regex
|
61
|
-
when String
|
62
|
-
@regex = Regexp.new(Regexp.escape(substring_or_regex))
|
63
|
-
when Regexp
|
64
|
-
@regex = substring_or_regex
|
65
|
-
else
|
66
|
-
raise ArgumentError, "don't know what to do with the #{substring_or_regex.class} you provided"
|
67
|
-
end
|
68
|
-
end
|
34
|
+
def in_current_dir(&block)
|
35
|
+
Dir.chdir(current_dir, &block)
|
36
|
+
end
|
69
37
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
38
|
+
def current_dir
|
39
|
+
@current_dir ||= SPEC_TMP_DIR
|
40
|
+
end
|
41
|
+
|
42
|
+
def change_current_dir(sub_path)
|
43
|
+
@current_dir = File.expand_path(sub_path, SPEC_TMP_DIR)
|
44
|
+
end
|
45
|
+
|
46
|
+
def windows?
|
47
|
+
ENV['OS'] == 'Windows_NT'
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
module RSpec
|
52
|
+
module Matchers
|
53
|
+
class IncludeAStringLike
|
54
|
+
def initialize(substring_or_regex)
|
55
|
+
case substring_or_regex
|
56
|
+
when String
|
57
|
+
@regex = Regexp.new(Regexp.escape(substring_or_regex))
|
58
|
+
when Regexp
|
59
|
+
@regex = substring_or_regex
|
60
|
+
else
|
61
|
+
raise ArgumentError, "don't know what to do with the #{substring_or_regex.class} you provided"
|
79
62
|
end
|
80
63
|
end
|
81
64
|
|
82
|
-
def
|
83
|
-
|
65
|
+
def matches?(list_of_strings)
|
66
|
+
@list_of_strings = list_of_strings
|
67
|
+
@list_of_strings.any? { |s| s =~ @regex }
|
68
|
+
end
|
69
|
+
def failure_message
|
70
|
+
"#{@list_of_strings.inspect} expected to include a string like #{@regex.inspect}"
|
71
|
+
end
|
72
|
+
def negative_failure_message
|
73
|
+
"#{@list_of_strings.inspect} expected to not include a string like #{@regex.inspect}, but did"
|
84
74
|
end
|
85
75
|
end
|
86
|
-
end
|
87
76
|
|
88
|
-
|
89
|
-
|
90
|
-
klass.send(:extend, ::Spork::TestIOStreams::ClassMethods)
|
77
|
+
def include_a_string_like(substring_or_regex)
|
78
|
+
IncludeAStringLike.new(substring_or_regex)
|
91
79
|
end
|
92
|
-
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
module Spork::TestIOStreams
|
84
|
+
def self.included(klass)
|
85
|
+
klass.send(:extend, ::Spork::TestIOStreams::ClassMethods)
|
86
|
+
end
|
87
|
+
|
88
|
+
def stderr
|
89
|
+
self.class.stderr
|
90
|
+
end
|
91
|
+
|
92
|
+
def stdout
|
93
|
+
self.class.stdout
|
94
|
+
end
|
95
|
+
|
96
|
+
module ClassMethods
|
93
97
|
def stderr
|
94
|
-
|
98
|
+
$test_stderr
|
95
99
|
end
|
96
100
|
|
97
101
|
def stdout
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
module ClassMethods
|
102
|
-
def stderr
|
103
|
-
$test_stderr
|
104
|
-
end
|
105
|
-
|
106
|
-
def stdout
|
107
|
-
$test_stdout
|
108
|
-
end
|
102
|
+
$test_stdout
|
109
103
|
end
|
110
104
|
end
|
111
|
-
|
112
|
-
Dir.glob(File.dirname(__FILE__) + "/support/*.rb").each { |f| require(f) }
|
113
105
|
end
|
106
|
+
|
107
|
+
Dir.glob(File.dirname(__FILE__) + "/support/*.rb").each { |f| require(f) }
|
data/spec/spork/forker_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Spork::Forker do
|
4
4
|
describe ".new" do
|
@@ -37,7 +37,7 @@ describe Spork::Forker do
|
|
37
37
|
sleep 0.5
|
38
38
|
forker.abort
|
39
39
|
sleep 0.1
|
40
|
-
(ended_at - started_at).should
|
40
|
+
(ended_at - started_at).should be_within(0.1).of(0.5)
|
41
41
|
forker.running?.should == false
|
42
42
|
end
|
43
43
|
end
|
data/spec/spork/runner_spec.rb
CHANGED
data/spec/spork/server_spec.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spork/test_framework_shared_examples'
|
3
3
|
|
4
4
|
describe Spork::TestFramework::Cucumber do
|
5
|
-
|
6
|
-
@klass = Spork::TestFramework::Cucumber
|
7
|
-
@server = @klass.new
|
8
|
-
end
|
9
|
-
|
10
|
-
it_should_behave_like "a TestFramework"
|
5
|
+
it_behaves_like "a TestFramework"
|
11
6
|
end
|
@@ -1,10 +1,31 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spork/test_framework_shared_examples'
|
3
3
|
|
4
4
|
describe Spork::TestFramework::RSpec do
|
5
|
-
|
6
|
-
|
5
|
+
it_behaves_like "a TestFramework"
|
6
|
+
|
7
|
+
it "supports rspec 1.x" do
|
8
|
+
begin
|
9
|
+
Object.const_set(:Spec, Module.new)
|
10
|
+
Spec.const_set(:Runner, Module.new)
|
11
|
+
Spec::Runner.const_set(:CommandLine, Module.new)
|
12
|
+
Spec::Runner.const_set(:OptionParser, Module.new)
|
13
|
+
Spec::Runner::OptionParser.stub(:parse)
|
14
|
+
|
15
|
+
framework = Spork::TestFramework::RSpec.new
|
16
|
+
framework.stub(:rspec1?).and_return(true)
|
17
|
+
|
18
|
+
Spec::Runner::CommandLine.should_receive(:run)
|
19
|
+
|
20
|
+
framework.run_tests([],StringIO.new,StringIO.new)
|
21
|
+
ensure
|
22
|
+
Object.__send__(:remove_const, :Spec)
|
23
|
+
end
|
7
24
|
end
|
8
25
|
|
9
|
-
|
26
|
+
it "supports rspec >= 2.0" do
|
27
|
+
RSpec::Core::CommandLine.any_instance.should_receive(:run)
|
28
|
+
framework = Spork::TestFramework::RSpec.new
|
29
|
+
framework.run_tests([],StringIO.new,StringIO.new)
|
30
|
+
end
|
10
31
|
end
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
1
|
+
shared_examples "a TestFramework" do
|
2
2
|
describe ".default_port" do
|
3
3
|
it "uses the DEFAULT_PORT when the environment variable is not set" do
|
4
|
-
|
4
|
+
described_class.default_port.should == described_class::DEFAULT_PORT
|
5
5
|
end
|
6
6
|
|
7
7
|
it 'uses ENV["#{short_name.upcase}_DRB"] as port if present' do
|
8
|
-
env_name = "#{
|
8
|
+
env_name = "#{described_class.short_name.upcase}_DRB"
|
9
9
|
orig, ENV[env_name] = ENV[env_name], "9000"
|
10
10
|
begin
|
11
|
-
|
11
|
+
described_class.default_port.should == 9000
|
12
12
|
ensure
|
13
13
|
ENV[env_name] = orig
|
14
14
|
end
|
@@ -17,7 +17,7 @@ shared_examples_for "a TestFramework" do
|
|
17
17
|
|
18
18
|
describe ".helper_file" do
|
19
19
|
it "returns ::HELPER_FILE for the TestFramework" do
|
20
|
-
|
20
|
+
described_class.helper_file.should == described_class::HELPER_FILE
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/spec/spork_spec.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424151
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 0.9.0.
|
11
|
+
- 9
|
12
|
+
version: 0.9.0.rc9
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Tim Harper
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-
|
21
|
+
date: 2011-06-30 00:00:00 -06:00
|
22
22
|
default_executable:
|
23
23
|
dependencies: []
|
24
24
|
|