http_stub 0.7.1 → 0.7.2
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/http_stub/models/hash_with_regexpable_values.rb +1 -1
- data/lib/http_stub/models/stub.rb +3 -3
- data/lib/http_stub/models/stub_activator.rb +4 -0
- data/lib/http_stub/version.rb +1 -1
- data/spec/lib/http_stub/models/stub_activator_spec.rb +10 -0
- data/spec/lib/http_stub/models/stub_spec.rb +3 -28
- metadata +2 -2
@@ -4,7 +4,7 @@ module HttpStub
|
|
4
4
|
class HashWithRegexpableValues < Hash
|
5
5
|
|
6
6
|
def initialize(hash)
|
7
|
-
hash.
|
7
|
+
hash.each_pair { |key, value| self[key] = HttpStub::Models::RegexpableValue.new(value) }
|
8
8
|
end
|
9
9
|
|
10
10
|
def match?(other_hash)
|
@@ -6,7 +6,7 @@ module HttpStub
|
|
6
6
|
attr_reader :uri, :headers, :parameters, :response
|
7
7
|
|
8
8
|
def initialize(options)
|
9
|
-
@
|
9
|
+
@options = options
|
10
10
|
@uri = HttpStub::Models::StubUri.new(options["uri"])
|
11
11
|
@headers = HttpStub::Models::StubHeaders.new(options["headers"])
|
12
12
|
@parameters = HttpStub::Models::StubParameters.new(options["parameters"])
|
@@ -21,11 +21,11 @@ module HttpStub
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def method
|
24
|
-
@
|
24
|
+
@options["method"]
|
25
25
|
end
|
26
26
|
|
27
27
|
def to_s
|
28
|
-
@
|
28
|
+
@options.to_s
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
data/lib/http_stub/version.rb
CHANGED
@@ -63,4 +63,14 @@ describe HttpStub::Models::StubActivator do
|
|
63
63
|
|
64
64
|
end
|
65
65
|
|
66
|
+
describe "#to_s" do
|
67
|
+
|
68
|
+
it "should return the string representation of the activation options" do
|
69
|
+
options.should_receive(:to_s).and_return("activation options string")
|
70
|
+
|
71
|
+
stub_activator.to_s.should eql("activation options string")
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
66
76
|
end
|
@@ -167,36 +167,11 @@ describe HttpStub::Models::Stub do
|
|
167
167
|
|
168
168
|
describe "#to_s" do
|
169
169
|
|
170
|
-
it "should return a string
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
it "should return a string containing the stubbed request method" do
|
175
|
-
the_stub.to_s.should match(/get/)
|
176
|
-
end
|
177
|
-
|
178
|
-
it "should return a string containing the stubbed headers" do
|
179
|
-
raw_stub_headers.each_pair do |key, value|
|
180
|
-
the_stub.to_s.should match(/#{Regexp.escape(key)}/)
|
181
|
-
the_stub.to_s.should match(/#{Regexp.escape(value)}/)
|
182
|
-
end
|
183
|
-
end
|
170
|
+
it "should return a string representation of the stub options" do
|
171
|
+
stub_options.should_receive(:to_s).and_return("stub options string")
|
184
172
|
|
185
|
-
|
186
|
-
raw_stub_parameters.each_pair do |key, value|
|
187
|
-
the_stub.to_s.should match(/#{Regexp.escape(key)}/)
|
188
|
-
the_stub.to_s.should match(/#{Regexp.escape(value)}/)
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
it "should return a string containing the intended response code" do
|
193
|
-
the_stub.to_s.should match(/201/)
|
173
|
+
the_stub.to_s.should eql("stub options string")
|
194
174
|
end
|
195
|
-
|
196
|
-
it "should return a string containing the intended response body" do
|
197
|
-
the_stub.to_s.should match(/Foo/)
|
198
|
-
end
|
199
|
-
|
200
175
|
end
|
201
176
|
|
202
177
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_stub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
290
|
version: '0'
|
291
291
|
segments:
|
292
292
|
- 0
|
293
|
-
hash:
|
293
|
+
hash: 1625561209117934809
|
294
294
|
requirements: []
|
295
295
|
rubyforge_project: http_stub
|
296
296
|
rubygems_version: 1.8.25
|