redrock 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +10 -0
- data/{history.txt → history.rdoc} +4 -0
- data/spec/redrock_spec.rb +25 -3
- data/spec/response.txt +1 -0
- metadata +54 -21
data/README.rdoc
CHANGED
@@ -66,10 +66,20 @@ error.
|
|
66
66
|
Raising exceptions or timing out won't work as expected, because the exceptions
|
67
67
|
will be handled in the RedRock server, not the application under test.
|
68
68
|
|
69
|
+
== Development
|
70
|
+
|
71
|
+
After cloning the project:
|
72
|
+
|
73
|
+
gem install bundler # if not already installed
|
74
|
+
rake gemspec # bootstrap gemspec for bundler
|
75
|
+
bundle
|
76
|
+
bundle exec rake
|
77
|
+
|
69
78
|
== TODO
|
70
79
|
|
71
80
|
* Better documentation!
|
72
81
|
* Refactor the server, which is currently a small ball of mud.
|
82
|
+
* Support latest version of WebMock
|
73
83
|
|
74
84
|
== Why "RedRock"?
|
75
85
|
|
data/spec/redrock_spec.rb
CHANGED
@@ -4,6 +4,12 @@ require File.expand_path("../spec_helper", __FILE__)
|
|
4
4
|
# isn't happening locally.
|
5
5
|
|
6
6
|
describe RedRock do
|
7
|
+
before :all do
|
8
|
+
%w(http_proxy HTTP_PROXY).each do |var|
|
9
|
+
ENV[var] = nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
after do
|
8
14
|
RedRock.stop
|
9
15
|
end
|
@@ -217,7 +223,23 @@ describe RedRock do
|
|
217
223
|
end
|
218
224
|
end
|
219
225
|
|
220
|
-
context "matching query params using a hash" do
|
226
|
+
context "matching single-value query params using a hash" do
|
227
|
+
before do
|
228
|
+
stub_http_request(:get, "localhost:4242").with(:query => {"a" => "b"})
|
229
|
+
end
|
230
|
+
|
231
|
+
it "accepts matching requests" do
|
232
|
+
curl = Curl::Easy.http_get "http://localhost:4242?a=b"
|
233
|
+
curl.response_code.should == 200
|
234
|
+
end
|
235
|
+
|
236
|
+
it "rejects non-matching requests" do
|
237
|
+
curl = Curl::Easy.http_get "http://localhost:4242?a=d"
|
238
|
+
curl.response_code.should == 500
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
context "matching multi-value query params using a hash" do
|
221
243
|
before do
|
222
244
|
stub_http_request(:get, "localhost:4242").with(:query => {"a" => ["b", "c"]})
|
223
245
|
end
|
@@ -255,9 +277,9 @@ describe RedRock do
|
|
255
277
|
end
|
256
278
|
|
257
279
|
it "supports specification of a response body as an IO object" do
|
258
|
-
stub_request(:any, "localhost:4242").to_return(:body =>
|
280
|
+
stub_request(:any, "localhost:4242").to_return(:body => File.new(File.expand_path("../response.txt", __FILE__)), :status => 200)
|
259
281
|
curl = Curl::Easy.http_get "http://localhost:4242"
|
260
|
-
curl.body_str.should == "chunky bacon"
|
282
|
+
curl.body_str.should == "chunky bacon\n"
|
261
283
|
end
|
262
284
|
|
263
285
|
context "returning a custom status message" do
|
data/spec/response.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
chunky bacon
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redrock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kerry Buckley
|
@@ -15,13 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-28 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
26
24
|
requirements:
|
27
25
|
- - ">="
|
@@ -30,12 +28,12 @@ dependencies:
|
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
31
|
+
requirement: *id001
|
33
32
|
type: :runtime
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: thin
|
33
|
+
name: json
|
37
34
|
prerelease: false
|
38
|
-
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
37
|
none: false
|
40
38
|
requirements:
|
41
39
|
- - ">="
|
@@ -44,12 +42,28 @@ dependencies:
|
|
44
42
|
segments:
|
45
43
|
- 0
|
46
44
|
version: "0"
|
45
|
+
requirement: *id002
|
47
46
|
type: :runtime
|
48
|
-
|
47
|
+
name: thin
|
48
|
+
prerelease: false
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
|
50
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 27
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 3
|
59
|
+
- 0
|
60
|
+
version: 1.3.0
|
61
|
+
requirement: *id003
|
62
|
+
type: :runtime
|
63
|
+
name: webmock
|
51
64
|
prerelease: false
|
52
|
-
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
53
67
|
none: false
|
54
68
|
requirements:
|
55
69
|
- - ">="
|
@@ -58,12 +72,12 @@ dependencies:
|
|
58
72
|
segments:
|
59
73
|
- 0
|
60
74
|
version: "0"
|
75
|
+
requirement: *id004
|
61
76
|
type: :development
|
62
|
-
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
77
|
name: curb
|
65
78
|
prerelease: false
|
66
|
-
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
67
81
|
none: false
|
68
82
|
requirements:
|
69
83
|
- - ">="
|
@@ -72,24 +86,43 @@ dependencies:
|
|
72
86
|
segments:
|
73
87
|
- 0
|
74
88
|
version: "0"
|
89
|
+
requirement: *id005
|
90
|
+
type: :development
|
91
|
+
name: rake
|
92
|
+
prerelease: false
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ~>
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 27
|
100
|
+
segments:
|
101
|
+
- 1
|
102
|
+
- 3
|
103
|
+
- 0
|
104
|
+
version: 1.3.0
|
105
|
+
requirement: *id006
|
75
106
|
type: :development
|
76
|
-
|
77
|
-
|
107
|
+
name: rspec
|
108
|
+
prerelease: false
|
109
|
+
description: Use WebMock to test applications that aren't running in the same process as the tests
|
78
110
|
email: kerryjbuckley@gmail.com
|
79
111
|
executables: []
|
80
112
|
|
81
113
|
extensions: []
|
82
114
|
|
83
115
|
extra_rdoc_files:
|
116
|
+
- history.rdoc
|
84
117
|
- README.rdoc
|
85
|
-
- history.txt
|
86
118
|
files:
|
87
119
|
- spec/redrock_spec.rb
|
120
|
+
- spec/response.txt
|
88
121
|
- spec/spec_helper.rb
|
89
122
|
- lib/redrock/server.rb
|
90
123
|
- lib/redrock.rb
|
124
|
+
- history.rdoc
|
91
125
|
- README.rdoc
|
92
|
-
- history.txt
|
93
126
|
has_rdoc: true
|
94
127
|
homepage: http://github.com/kerryb/redrock
|
95
128
|
licenses: []
|