stubb 0.1.3 → 0.2.0
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/README.markdown +1 -1
- data/lib/stubb.rb +7 -2
- data/lib/stubb/combined_logger.rb +2 -2
- data/lib/stubb/finder.rb +1 -1
- data/lib/stubb/naive_finder.rb +1 -1
- data/lib/stubb/response.rb +5 -3
- metadata +69 -68
data/README.markdown
CHANGED
|
@@ -145,7 +145,7 @@ will be the one given in `whales/GET.3.json`.
|
|
|
145
145
|
|
|
146
146
|
### Looping Sequences (0..._n-1_)
|
|
147
147
|
|
|
148
|
-
A *
|
|
148
|
+
A *looping sequence* starts from the first response file in the response sequence after _n_ requests of the same type. Looping sequences are specified by adding response files with indices 0 through _n_-1.
|
|
149
149
|
|
|
150
150
|
GET.0.format, GET.1.format, ..., GET._n-2_.format, GET._n-1_.format
|
|
151
151
|
|
data/lib/stubb.rb
CHANGED
|
@@ -2,7 +2,7 @@ require 'rack'
|
|
|
2
2
|
|
|
3
3
|
module Stubb
|
|
4
4
|
|
|
5
|
-
VERSION = '0.
|
|
5
|
+
VERSION = '0.2.0'
|
|
6
6
|
|
|
7
7
|
class ResponseNotFound < Exception
|
|
8
8
|
end
|
|
@@ -27,7 +27,12 @@ module Stubb
|
|
|
27
27
|
use CombinedLogger
|
|
28
28
|
use Counter
|
|
29
29
|
|
|
30
|
-
run Rack::Cascade.new
|
|
30
|
+
run Rack::Cascade.new [
|
|
31
|
+
SequenceFinder.new(options),
|
|
32
|
+
NaiveFinder.new(options),
|
|
33
|
+
SequenceMatchFinder.new(options),
|
|
34
|
+
MatchFinder.new(options)
|
|
35
|
+
]
|
|
31
36
|
}.to_app
|
|
32
37
|
end
|
|
33
38
|
|
|
@@ -19,8 +19,8 @@ module Stubb
|
|
|
19
19
|
status.to_s[0..3],
|
|
20
20
|
length,
|
|
21
21
|
now - began_at,
|
|
22
|
-
header
|
|
23
|
-
"YAML Frontmatter: #{header
|
|
22
|
+
header['X-Stubb-Response-File'] || 'None',
|
|
23
|
+
"YAML Frontmatter: #{header['X-Stubb-Frontmatter'] || 'No'}"
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
end
|
data/lib/stubb/finder.rb
CHANGED
|
@@ -31,7 +31,7 @@ module Stubb
|
|
|
31
31
|
response_body,
|
|
32
32
|
request.params,
|
|
33
33
|
200,
|
|
34
|
-
{'Content-Type' => content_type, '
|
|
34
|
+
{'Content-Type' => content_type, 'X-Stubb-Response-File' => response_file_path}
|
|
35
35
|
).finish
|
|
36
36
|
rescue NotFound => e
|
|
37
37
|
debug e.message
|
data/lib/stubb/naive_finder.rb
CHANGED
data/lib/stubb/response.rb
CHANGED
|
@@ -30,10 +30,12 @@ module Stubb
|
|
|
30
30
|
self.status = data['status'] if data['status']
|
|
31
31
|
# Fill header information
|
|
32
32
|
data['header'].each { |field, value| self.header[field] = value } if data['header'].kind_of? Hash
|
|
33
|
-
self.header['
|
|
34
|
-
rescue
|
|
35
|
-
self.header['
|
|
33
|
+
self.header['X-Stubb-Frontmatter'] = 'Yes'
|
|
34
|
+
rescue
|
|
35
|
+
self.header['X-Stubb-Frontmatter'] = 'Error'
|
|
36
36
|
end
|
|
37
|
+
else
|
|
38
|
+
self.header['X-Stubb-Frontmatter'] = 'No'
|
|
37
39
|
end
|
|
38
40
|
end
|
|
39
41
|
|
metadata
CHANGED
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stubb
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- 0
|
|
7
|
-
- 1
|
|
8
|
-
- 3
|
|
9
|
-
version: 0.1.3
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
prerelease:
|
|
10
6
|
platform: ruby
|
|
11
|
-
authors:
|
|
7
|
+
authors:
|
|
12
8
|
- Johannes Emerich
|
|
13
9
|
autorequire:
|
|
14
10
|
bindir: bin
|
|
15
11
|
cert_chain: []
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
dependencies:
|
|
20
|
-
- !ruby/object:Gem::Dependency
|
|
21
|
-
type: :development
|
|
22
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
segments:
|
|
27
|
-
- 0
|
|
28
|
-
version: "0"
|
|
12
|
+
date: 2014-10-03 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
29
15
|
name: rake
|
|
30
|
-
requirement:
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
18
|
+
requirements:
|
|
19
|
+
- - ! '>='
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :development
|
|
31
23
|
prerelease: false
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- 1
|
|
40
|
-
- 2
|
|
41
|
-
- 0
|
|
42
|
-
version: 1.2.0
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
26
|
+
requirements:
|
|
27
|
+
- - ! '>='
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
43
31
|
name: rack
|
|
44
|
-
requirement:
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: 1.2.0
|
|
47
38
|
type: :runtime
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
version:
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: 1.2.0
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
55
47
|
name: thor
|
|
56
|
-
requirement:
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
type: :runtime
|
|
57
55
|
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
58
62
|
description: Stubb is the second mate.
|
|
59
63
|
email: johannes@emerich.de
|
|
60
|
-
executables:
|
|
64
|
+
executables:
|
|
61
65
|
- stubb
|
|
62
66
|
extensions: []
|
|
63
|
-
|
|
64
67
|
extra_rdoc_files: []
|
|
65
|
-
|
|
66
|
-
files:
|
|
68
|
+
files:
|
|
67
69
|
- lib/stubb.rb
|
|
68
70
|
- lib/stubb/request.rb
|
|
69
71
|
- lib/stubb/response.rb
|
|
@@ -77,35 +79,34 @@ files:
|
|
|
77
79
|
- bin/stubb
|
|
78
80
|
- LICENSE
|
|
79
81
|
- README.markdown
|
|
80
|
-
has_rdoc: true
|
|
81
82
|
homepage: http://github.com/knuton/stubb
|
|
82
83
|
licenses: []
|
|
83
|
-
|
|
84
84
|
post_install_message:
|
|
85
85
|
rdoc_options: []
|
|
86
|
-
|
|
87
|
-
require_paths:
|
|
86
|
+
require_paths:
|
|
88
87
|
- lib
|
|
89
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ! '>='
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '0'
|
|
94
|
+
segments:
|
|
94
95
|
- 0
|
|
95
|
-
|
|
96
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
hash: 3510561894758515248
|
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
|
+
none: false
|
|
99
|
+
requirements:
|
|
100
|
+
- - ! '>='
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
segments:
|
|
101
104
|
- 0
|
|
102
|
-
|
|
105
|
+
hash: 3510561894758515248
|
|
103
106
|
requirements: []
|
|
104
|
-
|
|
105
107
|
rubyforge_project:
|
|
106
|
-
rubygems_version: 1.
|
|
108
|
+
rubygems_version: 1.8.23
|
|
107
109
|
signing_key:
|
|
108
110
|
specification_version: 3
|
|
109
111
|
summary: Specify REST API stubs using your file system
|
|
110
112
|
test_files: []
|
|
111
|
-
|