rspec-background-process 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +86 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/rspec-background-process/background_process.rb +1 -1
- data/rspec-background-process.gemspec +9 -8
- metadata +30 -51
- data/README.rdoc +0 -19
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ffb6ce1d711fa6429076075b4eb20bf45d564db
|
4
|
+
data.tar.gz: 5de983b0f115d7d4ee68aeb284577f47fa95353b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8608cf064bc09e54ba15c37e5ee5ba76af60df8e5a922eda82bf40bd8b5408c956bb37edcd826d54beedb0f5b0b3e779ec947ed7ecf454f6a2a2e3242b8e88f6
|
7
|
+
data.tar.gz: f680418bd3238b4e646d401b456c3aae4141d782f5620a970a6f843e29fcdbf7d676320be01428a5da2ee8f653c9cd6bf757a94c0f18b3fb0e7e8df92f1d8834
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# rspec-background-process
|
2
|
+
|
3
|
+
RSpec and Cucumber DSL that allows definition of processes with their arguments, working directory, time outs, port numbers etc. and start/stop them during test runs.
|
4
|
+
Processes with same definitions can be pooled and reused between example runs to save time on startup/shutdown. Pooling supports limiting the number of running processes with LRU to limit memory used.
|
5
|
+
|
6
|
+
## Example Usage
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
background_process('bin/http-worker').with do |process|
|
10
|
+
process.http_port_allocated_form 1200
|
11
|
+
|
12
|
+
process.argument '--listen', '127.0.0.1:<allocated port 1>'
|
13
|
+
process.argument '--foreground'
|
14
|
+
process.argument '--debug'
|
15
|
+
|
16
|
+
process.ready_when_log_includes 'worker=0 ready'
|
17
|
+
end
|
18
|
+
.start
|
19
|
+
.wait_ready
|
20
|
+
```
|
21
|
+
|
22
|
+
The above example will start up (or reuse) instance of `http-worker` process with given arguments and allocated unique port number.
|
23
|
+
The `#wait_ready` method will return after process logs `worker=0 ready` to standard output or error. This way the process has a chance of starting up fully before we continue with testing.
|
24
|
+
|
25
|
+
## Usage with RSpec
|
26
|
+
|
27
|
+
Add `require 'rspec-background-process'` to your `spec_helper.rb` and use `with: :background_process` meta tag on example groups that will use `#backgroud_process`.
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require_relative 'spec_helper'
|
31
|
+
|
32
|
+
describe 'starting background process', with: :background_process do
|
33
|
+
before :all do
|
34
|
+
background_process('bin/test_process').with do |process|
|
35
|
+
process.ready_when_log_includes 'ready'
|
36
|
+
end
|
37
|
+
.start
|
38
|
+
.wait_ready
|
39
|
+
end
|
40
|
+
|
41
|
+
example 'test with process running in background' do
|
42
|
+
end
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
## Usage with Cucumber
|
47
|
+
|
48
|
+
Add `require 'rspec-background-process'` to your `env.rb`.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
Given /^my server is running$/ do
|
52
|
+
@server = background_process('bin/server', load: true).with do |process|
|
53
|
+
process.http_port_allocated_form 1200
|
54
|
+
|
55
|
+
process.argument '--listen', '127.0.0.1:<allocated port 1>'
|
56
|
+
process.argument '--dump-log-at-exit'
|
57
|
+
process.argument '--working-directory', '<working directory>'
|
58
|
+
process.argument '--config-prepend', '<project directory>/etc/server.conf'
|
59
|
+
|
60
|
+
process.ready_when_url_response_status 'http://localhost:<allocated port 1>/health.test', 'OK'
|
61
|
+
|
62
|
+
process.refresh_action do |instance|
|
63
|
+
open(instance.render('http://127.0.0.1:<allocated port 1>/_purge'))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
```
|
68
|
+
|
69
|
+
## More info
|
70
|
+
|
71
|
+
See spec files for more usage options.
|
72
|
+
|
73
|
+
## Contributing to rspec-background-process
|
74
|
+
|
75
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
76
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
77
|
+
* Fork the project.
|
78
|
+
* Start a feature/bugfix branch.
|
79
|
+
* Commit and push until you are happy with your contribution.
|
80
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
81
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
82
|
+
|
83
|
+
## Copyright
|
84
|
+
|
85
|
+
Copyright (c) 2014 Global Medical Treatment Ltd trading as WhatClinic.com.
|
86
|
+
See LICENSE.txt for further details.
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
|
|
18
18
|
gem.homepage = "http://github.com/jpastuszek/rspec-background-process"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = "RSpec and Cucumber DSL library that helps managing background processes during test runs"
|
21
|
-
gem.description = "RSpec and Cucumber DSL that allows definition of processes with their arguments, working directory, time outs, port numbers etc. and start/stop them during test runs. Processes with same definitions can pooled and reused between example runs to save time on startup/shutdown. Pooling supports
|
21
|
+
gem.description = "RSpec and Cucumber DSL that allows definition of processes with their arguments, working directory, time outs, port numbers etc. and start/stop them during test runs. Processes with same definitions can be pooled and reused between example runs to save time on startup/shutdown. Pooling supports limiting the number of running processes with LRU to limit memory used."
|
22
22
|
gem.email = "jpastuszek@gmail.com"
|
23
23
|
gem.authors = ["Jakub Pastuszek"]
|
24
24
|
# dependencies defined in Gemfile
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -51,7 +51,7 @@ module RSpecBackgroundProcess
|
|
51
51
|
|
52
52
|
case working_directory
|
53
53
|
when Array
|
54
|
-
working_directory = Dir.mktmpdir(working_directory)
|
54
|
+
working_directory = Dir.mktmpdir(working_directory.map(&:to_s))
|
55
55
|
when nil
|
56
56
|
working_directory = Dir.mktmpdir(name.to_s)
|
57
57
|
end
|
@@ -2,19 +2,21 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: rspec-background-process 0.1.2 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "rspec-background-process"
|
8
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.2"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Jakub Pastuszek"]
|
12
|
-
s.date = "
|
13
|
-
s.description = "RSpec and Cucumber DSL that allows definition of processes with their arguments, working directory, time outs, port numbers etc. and start/stop them during test runs. Processes with same definitions can pooled and reused between example runs to save time on startup/shutdown. Pooling supports
|
14
|
+
s.date = "2016-11-07"
|
15
|
+
s.description = "RSpec and Cucumber DSL that allows definition of processes with their arguments, working directory, time outs, port numbers etc. and start/stop them during test runs. Processes with same definitions can be pooled and reused between example runs to save time on startup/shutdown. Pooling supports limiting the number of running processes with LRU to limit memory used."
|
14
16
|
s.email = "jpastuszek@gmail.com"
|
15
17
|
s.extra_rdoc_files = [
|
16
18
|
"LICENSE.txt",
|
17
|
-
"README.
|
19
|
+
"README.md"
|
18
20
|
]
|
19
21
|
s.files = [
|
20
22
|
".document",
|
@@ -22,7 +24,7 @@ Gem::Specification.new do |s|
|
|
22
24
|
"Gemfile",
|
23
25
|
"Gemfile.lock",
|
24
26
|
"LICENSE.txt",
|
25
|
-
"README.
|
27
|
+
"README.md",
|
26
28
|
"Rakefile",
|
27
29
|
"VERSION",
|
28
30
|
"lib/rspec-background-process.rb",
|
@@ -53,12 +55,11 @@ Gem::Specification.new do |s|
|
|
53
55
|
]
|
54
56
|
s.homepage = "http://github.com/jpastuszek/rspec-background-process"
|
55
57
|
s.licenses = ["MIT"]
|
56
|
-
s.
|
57
|
-
s.rubygems_version = "1.8.23"
|
58
|
+
s.rubygems_version = "2.4.6"
|
58
59
|
s.summary = "RSpec and Cucumber DSL library that helps managing background processes during test runs"
|
59
60
|
|
60
61
|
if s.respond_to? :specification_version then
|
61
|
-
s.specification_version =
|
62
|
+
s.specification_version = 4
|
62
63
|
|
63
64
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
64
65
|
s.add_runtime_dependency(%q<daemon>, ["~> 1.2"])
|
metadata
CHANGED
@@ -1,162 +1,145 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-background-process
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jakub Pastuszek
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-11-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: daemon
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.2'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.2'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: micromachine
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '1.1'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '1.1'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rufus-lru
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '1.0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - ~>
|
52
|
+
- - "~>"
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '1.0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: file-tail
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '1.0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '1.0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: retries
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- - ~>
|
73
|
+
- - "~>"
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: 0.0.5
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- - ~>
|
80
|
+
- - "~>"
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: 0.0.5
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: rspec
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- - ~>
|
87
|
+
- - "~>"
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '3.1'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- - ~>
|
94
|
+
- - "~>"
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '3.1'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: jeweler
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- - ~>
|
101
|
+
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 1.8.4
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- - ~>
|
108
|
+
- - "~>"
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: 1.8.4
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: bundler
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- - ~>
|
115
|
+
- - "~>"
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '1.0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- - ~>
|
122
|
+
- - "~>"
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '1.0'
|
142
125
|
description: RSpec and Cucumber DSL that allows definition of processes with their
|
143
126
|
arguments, working directory, time outs, port numbers etc. and start/stop them during
|
144
|
-
test runs. Processes with same definitions can pooled and reused between example
|
145
|
-
runs to save time on startup/shutdown. Pooling supports
|
146
|
-
with LRU to limit memory used.
|
127
|
+
test runs. Processes with same definitions can be pooled and reused between example
|
128
|
+
runs to save time on startup/shutdown. Pooling supports limiting the number of running
|
129
|
+
processes with LRU to limit memory used.
|
147
130
|
email: jpastuszek@gmail.com
|
148
131
|
executables: []
|
149
132
|
extensions: []
|
150
133
|
extra_rdoc_files:
|
151
134
|
- LICENSE.txt
|
152
|
-
- README.
|
135
|
+
- README.md
|
153
136
|
files:
|
154
|
-
- .document
|
155
|
-
- .rspec
|
137
|
+
- ".document"
|
138
|
+
- ".rspec"
|
156
139
|
- Gemfile
|
157
140
|
- Gemfile.lock
|
158
141
|
- LICENSE.txt
|
159
|
-
- README.
|
142
|
+
- README.md
|
160
143
|
- Rakefile
|
161
144
|
- VERSION
|
162
145
|
- lib/rspec-background-process.rb
|
@@ -187,30 +170,26 @@ files:
|
|
187
170
|
homepage: http://github.com/jpastuszek/rspec-background-process
|
188
171
|
licenses:
|
189
172
|
- MIT
|
173
|
+
metadata: {}
|
190
174
|
post_install_message:
|
191
175
|
rdoc_options: []
|
192
176
|
require_paths:
|
193
177
|
- lib
|
194
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
195
|
-
none: false
|
196
179
|
requirements:
|
197
|
-
- -
|
180
|
+
- - ">="
|
198
181
|
- !ruby/object:Gem::Version
|
199
182
|
version: '0'
|
200
|
-
segments:
|
201
|
-
- 0
|
202
|
-
hash: -348650834708870766
|
203
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
|
-
none: false
|
205
184
|
requirements:
|
206
|
-
- -
|
185
|
+
- - ">="
|
207
186
|
- !ruby/object:Gem::Version
|
208
187
|
version: '0'
|
209
188
|
requirements: []
|
210
189
|
rubyforge_project:
|
211
|
-
rubygems_version:
|
190
|
+
rubygems_version: 2.4.6
|
212
191
|
signing_key:
|
213
|
-
specification_version:
|
192
|
+
specification_version: 4
|
214
193
|
summary: RSpec and Cucumber DSL library that helps managing background processes during
|
215
194
|
test runs
|
216
195
|
test_files: []
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= rspec-background-process
|
2
|
-
|
3
|
-
See features.
|
4
|
-
|
5
|
-
== Contributing to rspec-background-process
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
-
* Fork the project.
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2014 Jakub Pastuszek. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|