spoofer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +93 -0
- data/Rakefile +25 -0
- data/features/checking_requests_were_made.feature +39 -0
- data/features/configuring_spoofer_via_http.feature +175 -0
- data/features/echoing_request_in_response.feature +76 -0
- data/features/logging_requests.feature +13 -0
- data/features/resetting_stubs.feature +16 -0
- data/features/steps/http_client_steps.rb +60 -0
- data/features/steps/logging_steps.rb +3 -0
- data/features/steps/shell_steps.rb +10 -0
- data/features/steps/spoofer_steps.rb +21 -0
- data/features/stubbing_requests_by_method.feature +25 -0
- data/features/stubbing_requests_by_path.feature +60 -0
- data/features/stubbing_requests_from_a_file.feature +33 -0
- data/features/stubbing_requests_with_parameters.feature +28 -0
- data/features/support/env.rb +15 -0
- data/features/support/hash_key_path.rb +7 -0
- data/features/support/http_client.rb +50 -0
- data/features/support/spoofer_runner.rb +7 -0
- data/features/using_rack_middlewares.feature +31 -0
- data/lib/spoofer.rb +104 -0
- data/lib/spoofer/api.rb +50 -0
- data/lib/spoofer/api/api_request.rb +49 -0
- data/lib/spoofer/api/stub.rb +39 -0
- data/lib/spoofer/fake_host.rb +102 -0
- data/lib/spoofer/fake_host/helpers.rb +11 -0
- data/lib/spoofer/fake_host/request_echo.rb +42 -0
- data/lib/spoofer/fake_host/stubbed_request.rb +73 -0
- data/lib/spoofer/version.rb +3 -0
- data/spec/fixtures/import_stubs.spoof +3 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/spoofer/fake_host_spec.rb +74 -0
- data/spec/spoofer/stubbed_request_spec.rb +16 -0
- data/spec/support/.keep +0 -0
- data/spec/support/matchers.rb +7 -0
- data/spec/support/pry.rb +1 -0
- data/spec/support/request_helper.rb +7 -0
- metadata +233 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spoofer::FakeHost::StubbedRequest do
|
4
|
+
let(:host) { Spoofer::FakeHost.new(:hostname => "www.example.com") }
|
5
|
+
|
6
|
+
it "has a unique hash based on it's parameters" do
|
7
|
+
host = described_class.new(double, "GET", "/path")
|
8
|
+
host.to_hash.should == Digest::MD5.hexdigest("GET /path")
|
9
|
+
end
|
10
|
+
|
11
|
+
it "has the same hash as an equivalent request" do
|
12
|
+
host_one = described_class.new(double, "GET", "/path")
|
13
|
+
host_two = described_class.new(double, "GET", "/path")
|
14
|
+
host_one.to_hash.should == host_two.to_hash
|
15
|
+
end
|
16
|
+
end
|
data/spec/support/.keep
ADDED
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
RSpec::Matchers.define :match_rack_response do |code, headers, body|
|
2
|
+
match do |actual|
|
3
|
+
(actual[0].should == code) &&
|
4
|
+
(actual[1].should RSpec::Matchers::BuiltIn::Include.new(headers)) #&&
|
5
|
+
(actual[2].should RSpec::Matchers::BuiltIn::Include.new(body))
|
6
|
+
end
|
7
|
+
end
|
data/spec/support/pry.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'pry'
|
metadata
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spoofer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Smestad
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sinatra
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thin
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: plist
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-expectations
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: cucumber
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rest-client
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: A Ruby gem for faking external web services for testing
|
140
|
+
email: justin.smestad@gmail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- lib/spoofer/api/api_request.rb
|
146
|
+
- lib/spoofer/api/stub.rb
|
147
|
+
- lib/spoofer/api.rb
|
148
|
+
- lib/spoofer/fake_host/helpers.rb
|
149
|
+
- lib/spoofer/fake_host/request_echo.rb
|
150
|
+
- lib/spoofer/fake_host/stubbed_request.rb
|
151
|
+
- lib/spoofer/fake_host.rb
|
152
|
+
- lib/spoofer/version.rb
|
153
|
+
- lib/spoofer.rb
|
154
|
+
- LICENSE.txt
|
155
|
+
- Rakefile
|
156
|
+
- README.md
|
157
|
+
- features/checking_requests_were_made.feature
|
158
|
+
- features/configuring_spoofer_via_http.feature
|
159
|
+
- features/echoing_request_in_response.feature
|
160
|
+
- features/logging_requests.feature
|
161
|
+
- features/resetting_stubs.feature
|
162
|
+
- features/steps/http_client_steps.rb
|
163
|
+
- features/steps/logging_steps.rb
|
164
|
+
- features/steps/shell_steps.rb
|
165
|
+
- features/steps/spoofer_steps.rb
|
166
|
+
- features/stubbing_requests_by_method.feature
|
167
|
+
- features/stubbing_requests_by_path.feature
|
168
|
+
- features/stubbing_requests_from_a_file.feature
|
169
|
+
- features/stubbing_requests_with_parameters.feature
|
170
|
+
- features/support/env.rb
|
171
|
+
- features/support/hash_key_path.rb
|
172
|
+
- features/support/http_client.rb
|
173
|
+
- features/support/spoofer_runner.rb
|
174
|
+
- features/using_rack_middlewares.feature
|
175
|
+
- spec/fixtures/import_stubs.spoof
|
176
|
+
- spec/spec_helper.rb
|
177
|
+
- spec/spoofer/fake_host_spec.rb
|
178
|
+
- spec/spoofer/stubbed_request_spec.rb
|
179
|
+
- spec/support/.keep
|
180
|
+
- spec/support/matchers.rb
|
181
|
+
- spec/support/pry.rb
|
182
|
+
- spec/support/request_helper.rb
|
183
|
+
homepage: https://github.com/jsmestad/poser
|
184
|
+
licenses: []
|
185
|
+
metadata: {}
|
186
|
+
post_install_message:
|
187
|
+
rdoc_options: []
|
188
|
+
require_paths:
|
189
|
+
- lib
|
190
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - '>='
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
requirements: []
|
201
|
+
rubyforge_project:
|
202
|
+
rubygems_version: 2.1.4
|
203
|
+
signing_key:
|
204
|
+
specification_version: 4
|
205
|
+
summary: A Ruby gem for faking external web services for testing
|
206
|
+
test_files:
|
207
|
+
- features/checking_requests_were_made.feature
|
208
|
+
- features/configuring_spoofer_via_http.feature
|
209
|
+
- features/echoing_request_in_response.feature
|
210
|
+
- features/logging_requests.feature
|
211
|
+
- features/resetting_stubs.feature
|
212
|
+
- features/steps/http_client_steps.rb
|
213
|
+
- features/steps/logging_steps.rb
|
214
|
+
- features/steps/shell_steps.rb
|
215
|
+
- features/steps/spoofer_steps.rb
|
216
|
+
- features/stubbing_requests_by_method.feature
|
217
|
+
- features/stubbing_requests_by_path.feature
|
218
|
+
- features/stubbing_requests_from_a_file.feature
|
219
|
+
- features/stubbing_requests_with_parameters.feature
|
220
|
+
- features/support/env.rb
|
221
|
+
- features/support/hash_key_path.rb
|
222
|
+
- features/support/http_client.rb
|
223
|
+
- features/support/spoofer_runner.rb
|
224
|
+
- features/using_rack_middlewares.feature
|
225
|
+
- spec/fixtures/import_stubs.spoof
|
226
|
+
- spec/spec_helper.rb
|
227
|
+
- spec/spoofer/fake_host_spec.rb
|
228
|
+
- spec/spoofer/stubbed_request_spec.rb
|
229
|
+
- spec/support/.keep
|
230
|
+
- spec/support/matchers.rb
|
231
|
+
- spec/support/pry.rb
|
232
|
+
- spec/support/request_helper.rb
|
233
|
+
has_rdoc:
|