http_stub 0.1.3 → 0.1.4

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.
@@ -14,7 +14,7 @@ module HttpStub
14
14
  def stubs?(request)
15
15
  @data["uri"] == request.path_info &&
16
16
  @data["method"].downcase == request.request_method.downcase &&
17
- (parameters.empty? || (parameters == request.params))
17
+ parameters_match?(request)
18
18
  end
19
19
 
20
20
  def to_s
@@ -23,8 +23,11 @@ module HttpStub
23
23
 
24
24
  private
25
25
 
26
- def parameters
27
- @data["parameters"] || {}
26
+ def parameters_match?(request)
27
+ parameters = @data["parameters"]
28
+ parameters.nil? || parameters.reduce(true) do |result, parameter|
29
+ result && (request.params[parameter[0]] == parameter[1])
30
+ end
28
31
  end
29
32
 
30
33
  end
@@ -1,3 +1,3 @@
1
1
  module HttpStub
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -40,7 +40,7 @@ describe HttpStub::Stub do
40
40
  }
41
41
  end
42
42
 
43
- describe "and the parameters match" do
43
+ describe "and the request parameters are identical" do
44
44
 
45
45
  it "should return true" do
46
46
  stub_instance.stubs?(request).should be_true
@@ -48,7 +48,17 @@ describe HttpStub::Stub do
48
48
 
49
49
  end
50
50
 
51
- describe "and the parameter values do not match" do
51
+ describe "and the request parameters match the stub parameters and contain additional parameters" do
52
+
53
+ let(:request_parameters) { stub_parameters.merge("param4" => "value4") }
54
+
55
+ it "should return true" do
56
+ stub_instance.stubs?(request).should be_true
57
+ end
58
+
59
+ end
60
+
61
+ describe "and the requests parameter values do not match" do
52
62
 
53
63
  let(:request_parameters) do
54
64
  {
@@ -64,7 +74,7 @@ describe HttpStub::Stub do
64
74
 
65
75
  end
66
76
 
67
- describe "and not all parameters are provided" do
77
+ describe "and the request parameters do not contain all stub parameters" do
68
78
 
69
79
  let(:request_parameters) do
70
80
  {
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.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  segments:
185
185
  - 0
186
- hash: 3112454833684141326
186
+ hash: 3567633725069526050
187
187
  requirements: []
188
188
  rubyforge_project: http_stub
189
189
  rubygems_version: 1.8.25