wopen3 0.2 → 0.3
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.
- data/lib/wopen3.rb +4 -0
- data/lib/wopen3/version.rb +3 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/tools/fails.sh +4 -0
- data/spec/tools/hello.sh +3 -0
- data/spec/tools/not-executable.sh +5 -0
- data/spec/tools/succeeds.sh +3 -0
- data/spec/wopen3_spec.rb +87 -0
- metadata +26 -5
data/lib/wopen3.rb
CHANGED
data/spec/spec_helper.rb
ADDED
data/spec/tools/fails.sh
ADDED
data/spec/tools/hello.sh
ADDED
data/spec/wopen3_spec.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
describe Wopen3 do
|
4
|
+
describe 'system' do
|
5
|
+
context 'success' do
|
6
|
+
before do
|
7
|
+
@result = Wopen3.system('spec/tools/succeeds.sh')
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'captures stdout' do
|
11
|
+
@result.stdout.should == "success!\n"
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'captures stderr' do
|
15
|
+
@result.stderr.should == ''
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'captures the exit status' do
|
19
|
+
@result.status.should == 0
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'reports success' do
|
23
|
+
@result.should be_success
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'failure' do
|
28
|
+
before do
|
29
|
+
@result = Wopen3.system('spec/tools/fails.sh')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'captures stdout' do
|
33
|
+
@result.stdout.should == "working...\n"
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'captures stderr' do
|
37
|
+
@result.stderr.should == "error!\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'captures the exit status' do
|
41
|
+
@result.status.should == 64
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'reports failure' do
|
45
|
+
@result.should_not be_success
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'file not found' do
|
50
|
+
before do
|
51
|
+
@result = Wopen3.system('spec/tools/non-existent.sh')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'returns a non-zero exit status' do
|
55
|
+
@result.status.should_not == 0
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'includes Errno::ENOENT in stderr' do
|
59
|
+
@result.stderr.should match(/Errno::ENOENT/)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'file not executable' do
|
64
|
+
before do
|
65
|
+
@result = Wopen3.system('spec/tools/not-executable.sh')
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'returns a non-zero exit status' do
|
69
|
+
@result.status.should_not == 0
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'includes Errno::EACCES in stderr' do
|
73
|
+
@result.stderr.should match(/Errno::EACCES/)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'with parameters' do
|
78
|
+
before do
|
79
|
+
@result = Wopen3.system('spec/tools/hello.sh', 'world')
|
80
|
+
end
|
81
|
+
|
82
|
+
it 'passes parameters to the forked process' do
|
83
|
+
@result.stdout.should == "hello, world!\n"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
version: "0.
|
7
|
+
- 3
|
8
|
+
version: "0.3"
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Wincent Colaiuta
|
@@ -13,10 +13,24 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2010-07-
|
16
|
+
date: 2010-07-29 00:00:00 +02:00
|
17
17
|
default_executable:
|
18
|
-
dependencies:
|
19
|
-
|
18
|
+
dependencies:
|
19
|
+
- !ruby/object:Gem::Dependency
|
20
|
+
name: rspec
|
21
|
+
prerelease: false
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
segments:
|
27
|
+
- 2
|
28
|
+
- 0
|
29
|
+
- 0
|
30
|
+
- beta
|
31
|
+
version: 2.0.0.beta
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
20
34
|
description: " Unlike Open3, Wopen3 does not throw away the exit code of the executed\n (grandchild) process. Only a child process is spawned and the exit\n status is returned in $? as normal.\n"
|
21
35
|
email: win@wincent.com
|
22
36
|
executables: []
|
@@ -26,7 +40,14 @@ extensions: []
|
|
26
40
|
extra_rdoc_files: []
|
27
41
|
|
28
42
|
files:
|
43
|
+
- lib/wopen3/version.rb
|
29
44
|
- lib/wopen3.rb
|
45
|
+
- spec/spec_helper.rb
|
46
|
+
- spec/tools/fails.sh
|
47
|
+
- spec/tools/hello.sh
|
48
|
+
- spec/tools/not-executable.sh
|
49
|
+
- spec/tools/succeeds.sh
|
50
|
+
- spec/wopen3_spec.rb
|
30
51
|
has_rdoc: false
|
31
52
|
homepage: https://wincent.com/products/wopen3
|
32
53
|
licenses: []
|