http_stub 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ module HttpStub
4
4
  class HashWithRegexpableValues < Hash
5
5
 
6
6
  def initialize(hash)
7
- hash.each { |entry| self[entry[0]] = HttpStub::Models::RegexpableValue.new(entry[1]) }
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
- @stub_options = options
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
- @stub_options["method"]
24
+ @options["method"]
25
25
  end
26
26
 
27
27
  def to_s
28
- @stub_options.to_s
28
+ @options.to_s
29
29
  end
30
30
 
31
31
  end
@@ -20,6 +20,10 @@ module HttpStub
20
20
  @options["activation_uri"]
21
21
  end
22
22
 
23
+ def to_s
24
+ @options.to_s
25
+ end
26
+
23
27
  end
24
28
 
25
29
  end
@@ -1,3 +1,3 @@
1
1
  module HttpStub
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -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 containing the stubbed uri" do
171
- the_stub.to_s.should match(/\/a_path/)
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
- it "should return a string containing the stubbed parameters" do
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.1
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: -1139132984430576269
293
+ hash: 1625561209117934809
294
294
  requirements: []
295
295
  rubyforge_project: http_stub
296
296
  rubygems_version: 1.8.25