spe_cuke 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +3 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +26 -3
- data/README.rdoc +1 -1
- data/Rakefile +4 -3
- data/lib/spe_cuke/environment.rb +9 -6
- data/lib/spe_cuke/target/base.rb +16 -0
- data/lib/spe_cuke/target/cucumber.rb +9 -0
- data/lib/spe_cuke/target/rspec.rb +3 -13
- data/lib/spe_cuke/version.rb +1 -1
- data/spec/spe_cuke/target_cucumber_spec.rb +1 -0
- data/spec/spe_cuke/target_product_code_spec.rb +1 -1
- data/spec/spe_cuke/target_rspec_spec.rb +5 -4
- metadata +32 -53
data/ChangeLog
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
==
|
1
|
+
== 0.3.1 / 2010-11-05
|
2
2
|
* improve command invokation error message.
|
3
3
|
* workaround for hanging up during spork detection.
|
4
|
+
* import direct spork execution from http://blog.twiwt.org/e/cafcfe and https://gist.github.com/662448
|
5
|
+
* run with RSpec 2.0 (and Rails 3)
|
4
6
|
|
5
7
|
== 0.3.0 / 2010-09-14
|
6
8
|
* assume test file from product code name.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
spe_cuke (0.
|
4
|
+
spe_cuke (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
9
|
+
archive-tar-minitar (0.5.2)
|
10
|
+
columnize (0.3.6)
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
linecache19 (0.5.12)
|
13
|
+
ruby_core_source (>= 0.1.4)
|
14
|
+
rake (0.9.2.2)
|
15
|
+
rspec (2.7.0)
|
16
|
+
rspec-core (~> 2.7.0)
|
17
|
+
rspec-expectations (~> 2.7.0)
|
18
|
+
rspec-mocks (~> 2.7.0)
|
19
|
+
rspec-core (2.7.1)
|
20
|
+
rspec-expectations (2.7.0)
|
21
|
+
diff-lcs (~> 1.1.2)
|
22
|
+
rspec-mocks (2.7.0)
|
23
|
+
ruby-debug-base19 (0.11.25)
|
24
|
+
columnize (>= 0.3.1)
|
25
|
+
linecache19 (>= 0.5.11)
|
26
|
+
ruby_core_source (>= 0.1.4)
|
27
|
+
ruby-debug19 (0.11.6)
|
28
|
+
columnize (>= 0.3.1)
|
29
|
+
linecache19 (>= 0.5.11)
|
30
|
+
ruby-debug-base19 (>= 0.11.19)
|
31
|
+
ruby_core_source (0.1.5)
|
32
|
+
archive-tar-minitar (>= 0.5.2)
|
11
33
|
|
12
34
|
PLATFORMS
|
13
35
|
ruby
|
@@ -16,4 +38,5 @@ DEPENDENCIES
|
|
16
38
|
bundler (>= 1.0.0.rc.5)
|
17
39
|
rake
|
18
40
|
rspec
|
41
|
+
ruby-debug19
|
19
42
|
spe_cuke!
|
data/README.rdoc
CHANGED
@@ -30,7 +30,7 @@ and has option to specify invoking via rake.
|
|
30
30
|
|
31
31
|
append below to your .vimrc or so.
|
32
32
|
|
33
|
-
function s:SetupSpeCuke()
|
33
|
+
function! s:SetupSpeCuke()
|
34
34
|
command! RunTestFile exe '!sc ' . expand('%:p')
|
35
35
|
command! RunTestCase exe '!sc --line ' . line('.') . ' ' . expand('%:p')
|
36
36
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'bundler/setup'
|
3
|
-
require '
|
3
|
+
require 'rspec'
|
4
|
+
require 'rspec/core/rake_task'
|
4
5
|
|
5
6
|
Bundler::GemHelper.install_tasks
|
6
|
-
|
7
|
-
s.
|
7
|
+
RSpec::Core::RakeTask.new do |s|
|
8
|
+
s.rspec_opts = %w[--color --format=progress]
|
8
9
|
end
|
data/lib/spe_cuke/environment.rb
CHANGED
@@ -3,7 +3,10 @@ require 'pathname'
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'drb'
|
5
5
|
require 'timeout'
|
6
|
-
|
6
|
+
begin
|
7
|
+
require 'bundler'
|
8
|
+
rescue LoadError => bundler_not_installed_ignore
|
9
|
+
end
|
7
10
|
|
8
11
|
module SpeCuke
|
9
12
|
class Environment
|
@@ -17,7 +20,7 @@ module SpeCuke
|
|
17
20
|
end
|
18
21
|
|
19
22
|
def bundlized?
|
20
|
-
(@root + 'Gemfile').exist?
|
23
|
+
defined?(Bundler) && (@root + 'Gemfile').exist?
|
21
24
|
end
|
22
25
|
|
23
26
|
def gem_format_executable?
|
@@ -40,16 +43,16 @@ module SpeCuke
|
|
40
43
|
lp.specs.detect{|bs| bs.name == gem_name}.version rescue nil
|
41
44
|
end
|
42
45
|
|
43
|
-
def spork_running?
|
46
|
+
def spork_running?(port)
|
44
47
|
begin
|
45
|
-
timeout(1) { spork_server &&
|
48
|
+
timeout(1) { (s = spork_server(port)) && s.respond_to?(:run) }
|
46
49
|
rescue DRb::DRbConnError, Errno::ECONNREFUSED, Timeout::Error, SocketError, Errno::EADDRNOTAVAIL
|
47
50
|
return false
|
48
51
|
end
|
49
52
|
end
|
50
53
|
|
51
|
-
def spork_server
|
52
|
-
|
54
|
+
def spork_server(port = 8989)
|
55
|
+
DRbObject.new_with_uri("druby://127.0.0.1:#{port}")
|
53
56
|
end
|
54
57
|
|
55
58
|
private
|
data/lib/spe_cuke/target/base.rb
CHANGED
@@ -24,6 +24,22 @@ module SpeCuke
|
|
24
24
|
commands = @env.prefer_rake? ? rake_commands : raw_commands
|
25
25
|
SpeCuke.wrap_execute!( commands.flatten )
|
26
26
|
end
|
27
|
+
|
28
|
+
private
|
29
|
+
# XXX refactor
|
30
|
+
def execute_direct!(port)
|
31
|
+
begin
|
32
|
+
DRb.start_service("druby://localhost:0")
|
33
|
+
rescue SocketError, Errno::EADDRNOTAVAIL
|
34
|
+
DRb.start_service("druby://:0")
|
35
|
+
end
|
36
|
+
puts "direct executing `spork_server.run(#{Array(drb_commands).inspect})'"
|
37
|
+
@env.spork_server(port).run(drb_commands, STDERR, STDOUT)
|
38
|
+
end
|
39
|
+
|
40
|
+
def drb_commands
|
41
|
+
Array(fn_and_line)
|
42
|
+
end
|
27
43
|
end
|
28
44
|
end
|
29
45
|
end
|
@@ -2,6 +2,7 @@ require 'spe_cuke/target/base'
|
|
2
2
|
|
3
3
|
module SpeCuke::Target
|
4
4
|
class Cucumber < Base
|
5
|
+
SPORK_DEFAULT_PORT = 8990
|
5
6
|
class << self
|
6
7
|
def suitable?(file)
|
7
8
|
file =~ /\.feature\Z/
|
@@ -9,6 +10,10 @@ module SpeCuke::Target
|
|
9
10
|
end
|
10
11
|
self.default_options = ['--color']
|
11
12
|
|
13
|
+
def execute!
|
14
|
+
@env.spork_running?(SPORK_DEFAULT_PORT) ? execute_direct!(SPORK_DEFAULT_PORT) : super
|
15
|
+
end
|
16
|
+
|
12
17
|
private
|
13
18
|
def raw_commands
|
14
19
|
cmds = [@env.command('cucumber')]
|
@@ -19,6 +24,10 @@ module SpeCuke::Target
|
|
19
24
|
cmds << fn_and_line
|
20
25
|
end
|
21
26
|
|
27
|
+
def drb_commands
|
28
|
+
raw_commands[(1..-1)].flatten
|
29
|
+
end
|
30
|
+
|
22
31
|
def rake_commands
|
23
32
|
cmds = [@env.command('rake'), 'cucumber', "FEATURE=#{fn_and_line}"]
|
24
33
|
if @line
|
@@ -2,6 +2,7 @@ require 'spe_cuke/target/base'
|
|
2
2
|
|
3
3
|
module SpeCuke::Target
|
4
4
|
class Rspec < Base
|
5
|
+
SPORK_DEFAULT_PORT = 8989
|
5
6
|
class << self
|
6
7
|
attr_accessor :default_options
|
7
8
|
def suitable?(file)
|
@@ -11,21 +12,10 @@ module SpeCuke::Target
|
|
11
12
|
self.default_options = ['--color']
|
12
13
|
|
13
14
|
def execute!
|
14
|
-
@env.spork_running? ? execute_direct! : super
|
15
|
+
@env.spork_running?(SPORK_DEFAULT_PORT) ? execute_direct!(SPORK_DEFAULT_PORT) : super
|
15
16
|
end
|
16
17
|
|
17
18
|
private
|
18
|
-
# XXX refactor
|
19
|
-
def execute_direct!
|
20
|
-
begin
|
21
|
-
DRb.start_service("druby://localhost:0")
|
22
|
-
rescue SocketError, Errno::EADDRNOTAVAIL
|
23
|
-
DRb.start_service("druby://:0")
|
24
|
-
end
|
25
|
-
puts "direct executing `spork_server.run(#{cmd_parameters.flatten.join(" ")})'"
|
26
|
-
@env.spork_server.run([fn_and_line], STDERR, STDOUT)
|
27
|
-
end
|
28
|
-
|
29
19
|
def raw_commands
|
30
20
|
([@env.command(spec_command_base)] + cmd_parameters).flatten
|
31
21
|
end
|
@@ -40,7 +30,7 @@ module SpeCuke::Target
|
|
40
30
|
def spec_command_base
|
41
31
|
v = @env.bundled_version('rspec')
|
42
32
|
|
43
|
-
(v.nil? || v
|
33
|
+
(v.nil? || v > Gem::Version.new("2.0.0.beta.0")) ? 'rspec' : 'spec'
|
44
34
|
end
|
45
35
|
|
46
36
|
def rake_commands
|
data/lib/spe_cuke/version.rb
CHANGED
@@ -13,6 +13,7 @@ describe Target::Cucumber do
|
|
13
13
|
@env = Environment.new
|
14
14
|
@env.stub!(:bundlized?).and_return false
|
15
15
|
@env.stub!(:gem_format_executable?).and_return false
|
16
|
+
@env.stub!(:spork_running?).and_return false
|
16
17
|
|
17
18
|
Target::Cucumber.default_options = ['--color']
|
18
19
|
end
|
@@ -16,7 +16,7 @@ describe ProductCode do
|
|
16
16
|
|
17
17
|
spec = 'spec/spe_cuke/target/product_code_spec.rb'
|
18
18
|
File.should_receive(:exist?).with(spec).and_return true
|
19
|
-
SpeCuke.should_receive(:wrap_execute!).with(%w[
|
19
|
+
SpeCuke.should_receive(:wrap_execute!).with(%w[rspec --color] << spec)
|
20
20
|
end
|
21
21
|
it("should call wrap_execute with valid args"){ @target.execute! }
|
22
22
|
end
|
@@ -22,10 +22,10 @@ describe Target::Rspec do
|
|
22
22
|
before do
|
23
23
|
@env.stub!(:prefer_rake?).and_return false
|
24
24
|
@target = Target::Rspec.new(@env, 'spec/foo/bar_spec.rb')
|
25
|
-
SpeCuke.should_receive(:wrap_execute!).with(%w[
|
25
|
+
SpeCuke.should_receive(:wrap_execute!).with(%w[rspec --color spec/foo/bar_spec.rb])
|
26
26
|
end
|
27
27
|
|
28
|
-
it(%q[
|
28
|
+
it(%q[rspec --color spec/foo/bar_spec.rb]){ @target.execute! }
|
29
29
|
end
|
30
30
|
|
31
31
|
|
@@ -33,14 +33,15 @@ describe Target::Rspec do
|
|
33
33
|
before do
|
34
34
|
@env.stub!(:prefer_rake?).and_return false
|
35
35
|
@target = Target::Rspec.new(@env, 'spec/foo/bar_spec.rb', 40)
|
36
|
-
SpeCuke.should_receive(:wrap_execute!).with(%w[
|
36
|
+
SpeCuke.should_receive(:wrap_execute!).with(%w[rspec --color -fn spec/foo/bar_spec.rb:40])
|
37
37
|
end
|
38
38
|
|
39
|
-
it(%q[
|
39
|
+
it(%q[rspec --color -l 40 spec/foo/bar_spec.rb]){ @target.execute! }
|
40
40
|
end
|
41
41
|
|
42
42
|
context 'spec/foo/bar_spec.rb on line:40/spork:true' do
|
43
43
|
before do
|
44
|
+
pending("unknow purpose test")
|
44
45
|
@env.stub!(:spork_running?).and_return true
|
45
46
|
@env.stub!(:prefer_rake?).and_return false
|
46
47
|
@target = Target::Rspec.new(@env, 'spec/foo/bar_spec.rb', 40)
|
metadata
CHANGED
@@ -1,49 +1,36 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spe_cuke
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 3
|
8
|
-
- 1
|
9
|
-
version: 0.3.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- MOROHASHI Kyosuke
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-04 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: bundler
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70104675484580 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 0
|
31
|
-
- 0
|
32
|
-
- rc
|
33
|
-
- 5
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 1.0.0.rc.5
|
35
22
|
type: :development
|
36
|
-
|
37
|
-
|
38
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70104675484580
|
25
|
+
description: An abstraction command for testing frameworks and invokation methods
|
26
|
+
of them.
|
27
|
+
email:
|
39
28
|
- moronatural@gmail.com
|
40
|
-
executables:
|
29
|
+
executables:
|
41
30
|
- sc
|
42
31
|
extensions: []
|
43
|
-
|
44
32
|
extra_rdoc_files: []
|
45
|
-
|
46
|
-
files:
|
33
|
+
files:
|
47
34
|
- .gitignore
|
48
35
|
- ChangeLog
|
49
36
|
- Gemfile
|
@@ -67,39 +54,31 @@ files:
|
|
67
54
|
- spec/spe_cuke/target_product_code_spec.rb
|
68
55
|
- spec/spe_cuke/target_rspec_spec.rb
|
69
56
|
- spec/spec_helper.rb
|
70
|
-
has_rdoc: true
|
71
57
|
homepage: http://rubygems.org/gems/spe_cuke
|
72
58
|
licenses: []
|
73
|
-
|
74
59
|
post_install_message:
|
75
60
|
rdoc_options: []
|
76
|
-
|
77
|
-
require_paths:
|
61
|
+
require_paths:
|
78
62
|
- lib
|
79
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
64
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
segments:
|
85
70
|
- 0
|
86
|
-
|
87
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
hash: 3598838883337441829
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
73
|
none: false
|
89
|
-
requirements:
|
90
|
-
- -
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
segments:
|
93
|
-
- 1
|
94
|
-
- 3
|
95
|
-
- 6
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
96
77
|
version: 1.3.6
|
97
78
|
requirements: []
|
98
|
-
|
99
79
|
rubyforge_project: spe_cuke
|
100
|
-
rubygems_version: 1.
|
80
|
+
rubygems_version: 1.8.10
|
101
81
|
signing_key:
|
102
82
|
specification_version: 3
|
103
83
|
summary: Provides common interface for rake spec or bin/spec.
|
104
84
|
test_files: []
|
105
|
-
|