http_stub 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/http_stub.rb +4 -3
- data/lib/http_stub/controllers/stub_activator_controller.rb +3 -3
- data/lib/http_stub/controllers/stub_controller.rb +2 -2
- data/lib/http_stub/hash_extensions.rb +2 -2
- data/lib/http_stub/models/request_header_parser.rb +17 -0
- data/lib/http_stub/models/response.rb +29 -0
- data/lib/http_stub/models/stub.rb +3 -3
- data/lib/http_stub/models/{headers.rb → stub_headers.rb} +3 -7
- data/lib/http_stub/models/{parameters.rb → stub_parameters.rb} +1 -1
- data/lib/http_stub/server.rb +1 -1
- data/lib/http_stub/version.rb +1 -1
- data/spec/lib/http_stub/controllers/stub_activator_controller_spec.rb +3 -3
- data/spec/lib/http_stub/controllers/stub_controller_spec.rb +3 -3
- data/spec/lib/http_stub/hash_extensions_spec.rb +17 -3
- data/spec/lib/http_stub/models/request_header_parser_spec.rb +27 -0
- data/spec/lib/http_stub/{response_spec.rb → models/response_spec.rb} +8 -8
- data/spec/lib/http_stub/models/stub_headers_spec.rb +156 -0
- data/spec/lib/http_stub/models/stub_parameters_spec.rb +73 -0
- data/spec/lib/http_stub/models/stub_spec.rb +10 -10
- data/spec/lib/http_stub/server_spec.rb +8 -8
- metadata +15 -12
- data/lib/http_stub/response.rb +0 -27
- data/spec/lib/http_stub/models/headers_spec.rb +0 -153
- data/spec/lib/http_stub/models/parameters_spec.rb +0 -73
data/lib/http_stub.rb
CHANGED
@@ -10,9 +10,10 @@ require 'net/http'
|
|
10
10
|
require 'json'
|
11
11
|
|
12
12
|
require File.expand_path('../http_stub/hash_extensions', __FILE__)
|
13
|
-
require File.expand_path('../http_stub/response', __FILE__)
|
14
|
-
require File.expand_path('../http_stub/models/
|
15
|
-
require File.expand_path('../http_stub/models/
|
13
|
+
require File.expand_path('../http_stub/models/response', __FILE__)
|
14
|
+
require File.expand_path('../http_stub/models/request_header_parser', __FILE__)
|
15
|
+
require File.expand_path('../http_stub/models/stub_headers', __FILE__)
|
16
|
+
require File.expand_path('../http_stub/models/stub_parameters', __FILE__)
|
16
17
|
require File.expand_path('../http_stub/models/stub', __FILE__)
|
17
18
|
require File.expand_path('../http_stub/models/stub_activator', __FILE__)
|
18
19
|
require File.expand_path('../http_stub/models/registry', __FILE__)
|
@@ -10,16 +10,16 @@ module HttpStub
|
|
10
10
|
|
11
11
|
def register(request)
|
12
12
|
@stub_activator_registry.add(HttpStub::Models::StubActivator.new(JSON.parse(request.body.read)), request)
|
13
|
-
HttpStub::Response::SUCCESS
|
13
|
+
HttpStub::Models::Response::SUCCESS
|
14
14
|
end
|
15
15
|
|
16
16
|
def activate(request)
|
17
17
|
activator = @stub_activator_registry.find_for(request)
|
18
18
|
if activator
|
19
19
|
@stub_registry.add(activator.the_stub, request)
|
20
|
-
HttpStub::Response::SUCCESS
|
20
|
+
HttpStub::Models::Response::SUCCESS
|
21
21
|
else
|
22
|
-
HttpStub::Response::EMPTY
|
22
|
+
HttpStub::Models::Response::EMPTY
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -9,12 +9,12 @@ module HttpStub
|
|
9
9
|
|
10
10
|
def register(request)
|
11
11
|
@registry.add(HttpStub::Models::Stub.new(JSON.parse(request.body.read)), request)
|
12
|
-
HttpStub::Response::SUCCESS
|
12
|
+
HttpStub::Models::Response::SUCCESS
|
13
13
|
end
|
14
14
|
|
15
15
|
def replay(request)
|
16
16
|
stub = @registry.find_for(request)
|
17
|
-
stub ? stub.response : HttpStub::Response::EMPTY
|
17
|
+
stub ? stub.response : HttpStub::Models::Response::EMPTY
|
18
18
|
end
|
19
19
|
|
20
20
|
def clear(request)
|
@@ -2,9 +2,9 @@ module HttpStub
|
|
2
2
|
|
3
3
|
module HashExtensions
|
4
4
|
|
5
|
-
def
|
5
|
+
def downcase_and_underscore_keys
|
6
6
|
self.reduce({}) do |result, element|
|
7
|
-
result[element[0].is_a?(::String) ? element[0].downcase : element[0]] = element[1]
|
7
|
+
result[element[0].is_a?(::String) ? element[0].downcase.gsub(/-/, '_') : element[0]] = element[1]
|
8
8
|
result
|
9
9
|
end
|
10
10
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module HttpStub
|
2
|
+
module Models
|
3
|
+
|
4
|
+
class RequestHeaderParser
|
5
|
+
|
6
|
+
def self.parse(request)
|
7
|
+
request.env.reduce({}) do |result, element|
|
8
|
+
match = element[0].match(/^HTTP_(.*)/)
|
9
|
+
result[match[1]] = element[1] if match
|
10
|
+
result
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module HttpStub
|
2
|
+
module Models
|
3
|
+
|
4
|
+
class Response
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
@response_options = options || {}
|
8
|
+
end
|
9
|
+
|
10
|
+
SUCCESS = HttpStub::Models::Response.new("status" => 200, "body" => "OK")
|
11
|
+
ERROR = HttpStub::Models::Response.new("status" => 404, "body" => "ERROR")
|
12
|
+
EMPTY = HttpStub::Models::Response.new()
|
13
|
+
|
14
|
+
def status
|
15
|
+
@response_options["status"]
|
16
|
+
end
|
17
|
+
|
18
|
+
def body
|
19
|
+
@response_options["body"]
|
20
|
+
end
|
21
|
+
|
22
|
+
def empty?
|
23
|
+
@response_options.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -7,9 +7,9 @@ module HttpStub
|
|
7
7
|
|
8
8
|
def initialize(options)
|
9
9
|
@stub_options = options
|
10
|
-
@headers = HttpStub::Models::
|
11
|
-
@parameters = HttpStub::Models::
|
12
|
-
@response = HttpStub::Response.new(options["response"])
|
10
|
+
@headers = HttpStub::Models::StubHeaders.new(options["headers"])
|
11
|
+
@parameters = HttpStub::Models::StubParameters.new(options["parameters"])
|
12
|
+
@response = HttpStub::Models::Response.new(options["response"])
|
13
13
|
end
|
14
14
|
|
15
15
|
def satisfies?(request)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module HttpStub
|
2
2
|
module Models
|
3
3
|
|
4
|
-
class
|
4
|
+
class StubHeaders
|
5
5
|
|
6
6
|
def initialize(headers)
|
7
7
|
@headers = headers || {}
|
8
8
|
end
|
9
9
|
|
10
10
|
def match?(request)
|
11
|
-
headers_in(request).
|
11
|
+
headers_in(request).downcase_and_underscore_keys.has_hash?(@headers.downcase_and_underscore_keys)
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_s
|
@@ -18,11 +18,7 @@ module HttpStub
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def headers_in(request)
|
21
|
-
|
22
|
-
match = element[0].match(/^HTTP_(.*)/)
|
23
|
-
result[match[1]] = element[1] if match
|
24
|
-
result
|
25
|
-
end
|
21
|
+
HttpStub::Models::RequestHeaderParser.parse(request)
|
26
22
|
end
|
27
23
|
|
28
24
|
end
|
data/lib/http_stub/server.rb
CHANGED
@@ -94,7 +94,7 @@ module HttpStub
|
|
94
94
|
def handle_request
|
95
95
|
response = @stub_controller.replay(request)
|
96
96
|
response = @stub_activator_controller.activate(request) if response.empty?
|
97
|
-
response = HttpStub::Response::ERROR if response.empty?
|
97
|
+
response = HttpStub::Models::Response::ERROR if response.empty?
|
98
98
|
halt(response.status, response.body)
|
99
99
|
end
|
100
100
|
|
data/lib/http_stub/version.rb
CHANGED
@@ -36,7 +36,7 @@ describe HttpStub::Controllers::StubActivatorController do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should return a success response" do
|
39
|
-
controller.register(request).should eql(HttpStub::Response::SUCCESS)
|
39
|
+
controller.register(request).should eql(HttpStub::Models::Response::SUCCESS)
|
40
40
|
end
|
41
41
|
|
42
42
|
end
|
@@ -56,7 +56,7 @@ describe HttpStub::Controllers::StubActivatorController do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should return a success response" do
|
59
|
-
controller.activate(request).should eql(HttpStub::Response::SUCCESS)
|
59
|
+
controller.activate(request).should eql(HttpStub::Models::Response::SUCCESS)
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
@@ -74,7 +74,7 @@ describe HttpStub::Controllers::StubActivatorController do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should return an empty response" do
|
77
|
-
controller.activate(request).should eql(HttpStub::Response::EMPTY)
|
77
|
+
controller.activate(request).should eql(HttpStub::Models::Response::EMPTY)
|
78
78
|
end
|
79
79
|
|
80
80
|
end
|
@@ -3,7 +3,7 @@ describe HttpStub::Controllers::StubController do
|
|
3
3
|
let(:request_body) { "Some request body" }
|
4
4
|
let(:stub_options) { double("StubOptions") }
|
5
5
|
let(:request) { double("HttpRequest", body: double("RequestBody", read: request_body)) }
|
6
|
-
let(:response) { double(HttpStub::Response) }
|
6
|
+
let(:response) { double(HttpStub::Models::Response) }
|
7
7
|
let(:the_stub) { double(HttpStub::Models::Stub, response: response) }
|
8
8
|
let(:registry) { double(HttpStub::Models::Registry).as_null_object }
|
9
9
|
let(:controller) { HttpStub::Controllers::StubController.new(registry) }
|
@@ -35,7 +35,7 @@ describe HttpStub::Controllers::StubController do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should return a success response" do
|
38
|
-
controller.register(request).should eql(HttpStub::Response::SUCCESS)
|
38
|
+
controller.register(request).should eql(HttpStub::Models::Response::SUCCESS)
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
@@ -63,7 +63,7 @@ describe HttpStub::Controllers::StubController do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should return an empty response" do
|
66
|
-
controller.replay(request).should eql(HttpStub::Response::EMPTY)
|
66
|
+
controller.replay(request).should eql(HttpStub::Models::Response::EMPTY)
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
describe HttpStub::HashExtensions do
|
2
2
|
|
3
|
-
describe "#
|
3
|
+
describe "#downcase_and_underscore_keys" do
|
4
4
|
|
5
5
|
describe "when the hash contains keys which are strings" do
|
6
6
|
|
@@ -9,7 +9,21 @@ describe HttpStub::HashExtensions do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should downcase the string keys" do
|
12
|
-
hash.
|
12
|
+
hash.downcase_and_underscore_keys.should eql({ "lower" => 1, "upper" => 2, "mixedcase" => 3 })
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "and keys contain underscores and hyphens" do
|
16
|
+
|
17
|
+
let(:hash) do
|
18
|
+
{ "has_underscore" => 1, "has-hypen" => 2, "has_underscore_and-hypen" => 3 }
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should downcase the string keys" do
|
22
|
+
hash.downcase_and_underscore_keys.should eql({ "has_underscore" => 1,
|
23
|
+
"has_hypen" => 2,
|
24
|
+
"has_underscore_and_hypen" => 3 })
|
25
|
+
end
|
26
|
+
|
13
27
|
end
|
14
28
|
|
15
29
|
end
|
@@ -21,7 +35,7 @@ describe HttpStub::HashExtensions do
|
|
21
35
|
end
|
22
36
|
|
23
37
|
it "should not alter a hash" do
|
24
|
-
hash.
|
38
|
+
hash.downcase_and_underscore_keys.should eql({ 1 => 2, :symbol => 3, nil => 4 })
|
25
39
|
end
|
26
40
|
|
27
41
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
describe HttpStub::Models::RequestHeaderParser do
|
2
|
+
|
3
|
+
let(:non_http_env_elements) do
|
4
|
+
{
|
5
|
+
"GATEWAY_INTERFACE" => "CGI/1.1",
|
6
|
+
"QUERY_STRING" => "some string",
|
7
|
+
"REMOTE_ADDR" => "127.0.0.1",
|
8
|
+
"SCRIPT_NAME" => "some script",
|
9
|
+
"SERVER_NAME" => "localhost",
|
10
|
+
}
|
11
|
+
end
|
12
|
+
let(:env) { non_http_env_elements.merge(request_headers) }
|
13
|
+
let(:request) { double("HttpRequest", env: env) }
|
14
|
+
|
15
|
+
describe ".parse" do
|
16
|
+
|
17
|
+
let(:request_headers) { { "HTTP_KEY1" => "value1", "HTTP_KEY2" => "value2", "HTTP_KEY3" => "value3" } }
|
18
|
+
|
19
|
+
it "should return a hash containing request environment entries prefixed with HTTP_" do
|
20
|
+
HttpStub::Models::RequestHeaderParser.parse(request).should eql({ "KEY1" => "value1",
|
21
|
+
"KEY2" => "value2",
|
22
|
+
"KEY3" => "value3" })
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
describe HttpStub::Response do
|
1
|
+
describe HttpStub::Models::Response do
|
2
2
|
|
3
|
-
let(:response) { HttpStub::Response.new("status" => 202, "body" => "A response body")}
|
3
|
+
let(:response) { HttpStub::Models::Response.new("status" => 202, "body" => "A response body")}
|
4
4
|
|
5
5
|
describe "::SUCCESS" do
|
6
6
|
|
7
|
-
let(:response) { HttpStub::Response::SUCCESS }
|
7
|
+
let(:response) { HttpStub::Models::Response::SUCCESS }
|
8
8
|
|
9
9
|
it "should have a status of 200" do
|
10
10
|
response.status.should eql(200)
|
@@ -18,7 +18,7 @@ describe HttpStub::Response do
|
|
18
18
|
|
19
19
|
describe "::ERROR" do
|
20
20
|
|
21
|
-
let(:response) { HttpStub::Response::ERROR }
|
21
|
+
let(:response) { HttpStub::Models::Response::ERROR }
|
22
22
|
|
23
23
|
it "should have a status of 404" do
|
24
24
|
response.status.should eql(404)
|
@@ -32,7 +32,7 @@ describe HttpStub::Response do
|
|
32
32
|
|
33
33
|
describe "::EMPTY" do
|
34
34
|
|
35
|
-
let(:response) { HttpStub::Response::EMPTY }
|
35
|
+
let(:response) { HttpStub::Models::Response::EMPTY }
|
36
36
|
|
37
37
|
it "should have a nil status" do
|
38
38
|
response.status.should be_nil
|
@@ -65,7 +65,7 @@ describe HttpStub::Response do
|
|
65
65
|
describe "when the response is EMPTY" do
|
66
66
|
|
67
67
|
it "should return true" do
|
68
|
-
HttpStub::Response::EMPTY.should be_empty
|
68
|
+
HttpStub::Models::Response::EMPTY.should be_empty
|
69
69
|
end
|
70
70
|
|
71
71
|
end
|
@@ -73,7 +73,7 @@ describe HttpStub::Response do
|
|
73
73
|
describe "when the response is not EMPTY but contains no values" do
|
74
74
|
|
75
75
|
it "should return true" do
|
76
|
-
HttpStub::Response.new.should be_empty
|
76
|
+
HttpStub::Models::Response.new.should be_empty
|
77
77
|
end
|
78
78
|
|
79
79
|
end
|
@@ -81,7 +81,7 @@ describe HttpStub::Response do
|
|
81
81
|
describe "when the response is not EMPTY" do
|
82
82
|
|
83
83
|
it "should return false" do
|
84
|
-
HttpStub::Response::SUCCESS.should_not be_empty
|
84
|
+
HttpStub::Models::Response::SUCCESS.should_not be_empty
|
85
85
|
end
|
86
86
|
|
87
87
|
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
describe HttpStub::Models::StubHeaders do
|
2
|
+
|
3
|
+
let(:request) { double("HttpRequest") }
|
4
|
+
|
5
|
+
let(:stub_headers) { HttpStub::Models::StubHeaders.new(stubbed_headers) }
|
6
|
+
|
7
|
+
describe "#match?" do
|
8
|
+
|
9
|
+
before(:each) { HttpStub::Models::RequestHeaderParser.stub!(:parse).with(request).and_return(request_headers) }
|
10
|
+
|
11
|
+
describe "when multiple headers are mandatory" do
|
12
|
+
|
13
|
+
let(:stubbed_headers) { { "KEY1" => "value1", "KEY2" => "value2", "KEY3" => "value3" } }
|
14
|
+
|
15
|
+
describe "and the mandatory headers are provided" do
|
16
|
+
|
17
|
+
let(:request_headers) { stubbed_headers }
|
18
|
+
|
19
|
+
describe "and the casing of the header names is identical" do
|
20
|
+
|
21
|
+
it "should return true" do
|
22
|
+
stub_headers.match?(request).should be_true
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "and the casing of the header names is different" do
|
28
|
+
|
29
|
+
let(:stubbed_headers) { { "key1" => "value1", "KEY2" => "value2", "key3" => "value3" } }
|
30
|
+
|
31
|
+
it "should return true" do
|
32
|
+
stub_headers.match?(request).should be_true
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "and the mandatory request header names have hyphens in place of underscores" do
|
38
|
+
|
39
|
+
let(:stubbed_headers) { { "KEY_1" => "value1", "KEY-2" => "value2", "KEY_3" => "value3" } }
|
40
|
+
let(:request_headers) { { "KEY-1" => "value1", "KEY_2" => "value2", "KEY-3" => "value3" } }
|
41
|
+
|
42
|
+
it "should return true" do
|
43
|
+
stub_headers.match?(request).should be_true
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "and the request headers have different values" do
|
51
|
+
|
52
|
+
let(:request_headers) { { "KEY1" => "value1", "KEY2" => "doesNotMatch", "KEY3" => "value3" } }
|
53
|
+
|
54
|
+
it "should return false" do
|
55
|
+
stub_headers.match?(request).should be_false
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "and some mandatory headers are omitted" do
|
61
|
+
|
62
|
+
let(:request_headers) { { "KEY1" => "value1", "KEY3" => "value3" } }
|
63
|
+
|
64
|
+
it "should return false" do
|
65
|
+
stub_headers.match?(request).should be_false
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "and all mandatory headers are omitted" do
|
71
|
+
|
72
|
+
let(:request_headers) { {} }
|
73
|
+
|
74
|
+
it "should return false" do
|
75
|
+
stub_headers.match?(request).should be_false
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "when no headers are mandatory" do
|
83
|
+
|
84
|
+
let(:stubbed_headers) { {} }
|
85
|
+
|
86
|
+
describe "and headers are provided" do
|
87
|
+
|
88
|
+
let(:request_headers) { { "KEY" => "value" } }
|
89
|
+
|
90
|
+
it "should return true" do
|
91
|
+
stub_headers.match?(request).should be_true
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "when the mandatory headers are nil" do
|
99
|
+
|
100
|
+
let(:stubbed_headers) { nil }
|
101
|
+
|
102
|
+
describe "and headers are provided" do
|
103
|
+
|
104
|
+
let(:request_headers) { { "KEY" => "value" } }
|
105
|
+
|
106
|
+
it "should return true" do
|
107
|
+
stub_headers.match?(request).should be_true
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "#to_s" do
|
117
|
+
|
118
|
+
describe "when multiple headers are provided" do
|
119
|
+
|
120
|
+
let(:stubbed_headers) { { "key1" => "value1", "key2" => "value2", "key3" => "value3" } }
|
121
|
+
|
122
|
+
it "should return a string containing each header formatted as a conventional request header" do
|
123
|
+
result = stub_headers.to_s
|
124
|
+
|
125
|
+
stubbed_headers.each { |key, value| result.should match(/#{key}:#{value}/) }
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should comma delimit the headers" do
|
129
|
+
stub_headers.to_s.should match(/key\d.value\d\, key\d.value\d\, key\d.value\d/)
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
describe "when empty headers are provided" do
|
135
|
+
|
136
|
+
let(:stubbed_headers) { {} }
|
137
|
+
|
138
|
+
it "should return an empty string" do
|
139
|
+
stub_headers.to_s.should eql("")
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "when nil headers are provided" do
|
145
|
+
|
146
|
+
let(:stubbed_headers) { nil }
|
147
|
+
|
148
|
+
it "should return an empty string" do
|
149
|
+
stub_headers.to_s.should eql("")
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
describe HttpStub::Models::StubParameters do
|
2
|
+
|
3
|
+
let(:request_parameters) { double("RequestParameters") }
|
4
|
+
let(:request) { double("HttpRequest", params: request_parameters) }
|
5
|
+
|
6
|
+
let(:stubbed_parameters) { { "key1" => "value1", "key2" => "value2", "key3" => "value3" } }
|
7
|
+
let(:stub_parameters) { HttpStub::Models::StubParameters.new(stubbed_parameters) }
|
8
|
+
|
9
|
+
describe "#match?" do
|
10
|
+
|
11
|
+
describe "when the request parameters contain the mandatory parameters" do
|
12
|
+
|
13
|
+
before(:each) { request_parameters.stub!(:has_hash?).with(stubbed_parameters).and_return(true) }
|
14
|
+
|
15
|
+
it "should return true" do
|
16
|
+
stub_parameters.match?(request).should be(true)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "when the request parameters do not contain the mandatory parameters" do
|
22
|
+
|
23
|
+
before(:each) { request_parameters.stub!(:has_hash?).with(stubbed_parameters).and_return(false) }
|
24
|
+
|
25
|
+
it "should return false" do
|
26
|
+
stub_parameters.match?(request).should be(false)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "#to_s" do
|
34
|
+
|
35
|
+
describe "when multiple parameters are provided" do
|
36
|
+
|
37
|
+
let(:stubbed_parameters) { { "key1" => "value1", "key2" => "value2", "key3" => "value3" } }
|
38
|
+
|
39
|
+
it "should return a string containing each parameter formatted as a conventional request parameter" do
|
40
|
+
result = stub_parameters.to_s
|
41
|
+
|
42
|
+
stubbed_parameters.each { |key, value| result.should match(/#{key}=#{value}/) }
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should separate each parameter with the conventional request parameter delimiter" do
|
46
|
+
stub_parameters.to_s.should match(/key\d.value\d\&key\d.value\d\&key\d.value\d/)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "when empty parameters are provided" do
|
52
|
+
|
53
|
+
let(:stubbed_parameters) { {} }
|
54
|
+
|
55
|
+
it "should return an empty string" do
|
56
|
+
stub_parameters.to_s.should eql("")
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "when nil parameters are provided" do
|
62
|
+
|
63
|
+
let(:stubbed_parameters) { nil }
|
64
|
+
|
65
|
+
it "should return an empty string" do
|
66
|
+
stub_parameters.to_s.should eql("")
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -21,12 +21,12 @@ describe HttpStub::Models::Stub do
|
|
21
21
|
}
|
22
22
|
end
|
23
23
|
let(:the_stub) { HttpStub::Models::Stub.new(stub_options) }
|
24
|
-
let(:
|
25
|
-
let(:
|
24
|
+
let(:stub_parameters) { double(HttpStub::Models::StubParameters, match?: true) }
|
25
|
+
let(:stub_headers) { double(HttpStub::Models::StubHeaders, match?: true) }
|
26
26
|
|
27
27
|
before(:each) do
|
28
|
-
HttpStub::Models::
|
29
|
-
HttpStub::Models::
|
28
|
+
HttpStub::Models::StubParameters.stub!(:new).and_return(stub_parameters)
|
29
|
+
HttpStub::Models::StubHeaders.stub!(:new).and_return(stub_headers)
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#satisfies?" do
|
@@ -43,13 +43,13 @@ describe HttpStub::Models::Stub do
|
|
43
43
|
|
44
44
|
describe "that matches" do
|
45
45
|
|
46
|
-
before(:each) {
|
46
|
+
before(:each) { stub_headers.stub!(:match?).with(request).and_return(true) }
|
47
47
|
|
48
48
|
describe "and a parameter match is configured" do
|
49
49
|
|
50
50
|
describe "that matches" do
|
51
51
|
|
52
|
-
before(:each) {
|
52
|
+
before(:each) { stub_parameters.stub!(:match?).with(request).and_return(true) }
|
53
53
|
|
54
54
|
it "should return true" do
|
55
55
|
the_stub.satisfies?(request).should be_true
|
@@ -59,7 +59,7 @@ describe HttpStub::Models::Stub do
|
|
59
59
|
|
60
60
|
describe "that does not match" do
|
61
61
|
|
62
|
-
before(:each) {
|
62
|
+
before(:each) { stub_parameters.stub!(:match?).with(request).and_return(false) }
|
63
63
|
|
64
64
|
it "should return false" do
|
65
65
|
the_stub.satisfies?(request).should be_false
|
@@ -99,7 +99,7 @@ describe HttpStub::Models::Stub do
|
|
99
99
|
|
100
100
|
describe "when the headers do not match" do
|
101
101
|
|
102
|
-
before(:each) {
|
102
|
+
before(:each) { stub_headers.stub!(:match?).with(request).and_return(false) }
|
103
103
|
|
104
104
|
it "should return false" do
|
105
105
|
the_stub.satisfies?(request).should be_false
|
@@ -128,7 +128,7 @@ describe HttpStub::Models::Stub do
|
|
128
128
|
describe "#headers" do
|
129
129
|
|
130
130
|
it "should return the headers model encapsulating the headers provided in the request body" do
|
131
|
-
the_stub.headers.should eql(
|
131
|
+
the_stub.headers.should eql(stub_headers)
|
132
132
|
end
|
133
133
|
|
134
134
|
end
|
@@ -136,7 +136,7 @@ describe HttpStub::Models::Stub do
|
|
136
136
|
describe "#parameters" do
|
137
137
|
|
138
138
|
it "should return the parameters model encapsulating the parameters provided in the request body" do
|
139
|
-
the_stub.parameters.should eql(
|
139
|
+
the_stub.parameters.should eql(stub_parameters)
|
140
140
|
end
|
141
141
|
|
142
142
|
end
|
@@ -22,13 +22,13 @@ describe HttpStub::Server do
|
|
22
22
|
describe "when a stub insertion is received" do
|
23
23
|
|
24
24
|
it "should register the insertion via the stub controller" do
|
25
|
-
stub_controller.should_receive(:register).and_return(HttpStub::Response::SUCCESS)
|
25
|
+
stub_controller.should_receive(:register).and_return(HttpStub::Models::Response::SUCCESS)
|
26
26
|
|
27
27
|
issue_stub_request
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should respond with the response provided by the controller" do
|
31
|
-
stub_controller.stub!(:register).and_return(HttpStub::Response.new("status" => 202, "body" => ""))
|
31
|
+
stub_controller.stub!(:register).and_return(HttpStub::Models::Response.new("status" => 202, "body" => ""))
|
32
32
|
|
33
33
|
issue_stub_request
|
34
34
|
|
@@ -51,13 +51,13 @@ describe HttpStub::Server do
|
|
51
51
|
describe "when a stub activator insertion request is received" do
|
52
52
|
|
53
53
|
it "should register the insertion via the stub activator controller" do
|
54
|
-
stub_activator_controller.should_receive(:register).and_return(HttpStub::Response::SUCCESS)
|
54
|
+
stub_activator_controller.should_receive(:register).and_return(HttpStub::Models::Response::SUCCESS)
|
55
55
|
|
56
56
|
issue_stub_activator_request
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should respond with the response provided by the controller" do
|
60
|
-
stub_activator_controller.stub!(:register).and_return(HttpStub::Response.new("status" => 302, "body" => ""))
|
60
|
+
stub_activator_controller.stub!(:register).and_return(HttpStub::Models::Response.new("status" => 302, "body" => ""))
|
61
61
|
|
62
62
|
issue_stub_activator_request
|
63
63
|
|
@@ -115,7 +115,7 @@ describe HttpStub::Server do
|
|
115
115
|
describe "and the stub controller replays a response" do
|
116
116
|
|
117
117
|
before(:each) do
|
118
|
-
stub_controller.stub!(:replay).and_return(HttpStub::Response.new("status" => 222, "body" => "Some body"))
|
118
|
+
stub_controller.stub!(:replay).and_return(HttpStub::Models::Response.new("status" => 222, "body" => "Some body"))
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should respond with the replay status code" do
|
@@ -135,13 +135,13 @@ describe HttpStub::Server do
|
|
135
135
|
describe "and the stub controller does not replay a response" do
|
136
136
|
|
137
137
|
before(:each) do
|
138
|
-
stub_controller.stub!(:replay).and_return(HttpStub::Response::EMPTY)
|
138
|
+
stub_controller.stub!(:replay).and_return(HttpStub::Models::Response::EMPTY)
|
139
139
|
end
|
140
140
|
|
141
141
|
describe "but the stub activator controller activates a stub" do
|
142
142
|
|
143
143
|
before(:each) do
|
144
|
-
stub_activator_controller.stub!(:activate).and_return(HttpStub::Response.new("status" => 300, "body" => "A body"))
|
144
|
+
stub_activator_controller.stub!(:activate).and_return(HttpStub::Models::Response.new("status" => 300, "body" => "A body"))
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should respond with the activation response status code" do
|
@@ -161,7 +161,7 @@ describe HttpStub::Server do
|
|
161
161
|
describe "and the stub activator controller does not activate a stub" do
|
162
162
|
|
163
163
|
before(:each) do
|
164
|
-
stub_activator_controller.stub!(:activate).and_return(HttpStub::Response::EMPTY)
|
164
|
+
stub_activator_controller.stub!(:activate).and_return(HttpStub::Models::Response::EMPTY)
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should respond with a 404 status code" do
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sinatra
|
@@ -198,12 +198,13 @@ files:
|
|
198
198
|
- ./lib/http_stub/controllers/stub_activator_controller.rb
|
199
199
|
- ./lib/http_stub/controllers/stub_controller.rb
|
200
200
|
- ./lib/http_stub/hash_extensions.rb
|
201
|
-
- ./lib/http_stub/models/headers.rb
|
202
|
-
- ./lib/http_stub/models/parameters.rb
|
203
201
|
- ./lib/http_stub/models/registry.rb
|
202
|
+
- ./lib/http_stub/models/request_header_parser.rb
|
203
|
+
- ./lib/http_stub/models/response.rb
|
204
204
|
- ./lib/http_stub/models/stub.rb
|
205
205
|
- ./lib/http_stub/models/stub_activator.rb
|
206
|
-
- ./lib/http_stub/
|
206
|
+
- ./lib/http_stub/models/stub_headers.rb
|
207
|
+
- ./lib/http_stub/models/stub_parameters.rb
|
207
208
|
- ./lib/http_stub/server.rb
|
208
209
|
- ./lib/http_stub/start_server_rake_task.rb
|
209
210
|
- ./lib/http_stub/version.rb
|
@@ -218,12 +219,13 @@ files:
|
|
218
219
|
- ./spec/lib/http_stub/controllers/stub_activator_controller_spec.rb
|
219
220
|
- ./spec/lib/http_stub/controllers/stub_controller_spec.rb
|
220
221
|
- ./spec/lib/http_stub/hash_extensions_spec.rb
|
221
|
-
- ./spec/lib/http_stub/models/headers_spec.rb
|
222
|
-
- ./spec/lib/http_stub/models/parameters_spec.rb
|
223
222
|
- ./spec/lib/http_stub/models/registry_spec.rb
|
223
|
+
- ./spec/lib/http_stub/models/request_header_parser_spec.rb
|
224
|
+
- ./spec/lib/http_stub/models/response_spec.rb
|
224
225
|
- ./spec/lib/http_stub/models/stub_activator_spec.rb
|
226
|
+
- ./spec/lib/http_stub/models/stub_headers_spec.rb
|
227
|
+
- ./spec/lib/http_stub/models/stub_parameters_spec.rb
|
225
228
|
- ./spec/lib/http_stub/models/stub_spec.rb
|
226
|
-
- ./spec/lib/http_stub/response_spec.rb
|
227
229
|
- ./spec/lib/http_stub/server_integration_spec.rb
|
228
230
|
- ./spec/lib/http_stub/server_spec.rb
|
229
231
|
- ./spec/lib/http_stub/start_server_rake_task_integration_spec.rb
|
@@ -250,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
252
|
version: '0'
|
251
253
|
segments:
|
252
254
|
- 0
|
253
|
-
hash: -
|
255
|
+
hash: -845059187710201243
|
254
256
|
requirements: []
|
255
257
|
rubyforge_project: http_stub
|
256
258
|
rubygems_version: 1.8.25
|
@@ -263,12 +265,13 @@ test_files:
|
|
263
265
|
- ./spec/lib/http_stub/controllers/stub_activator_controller_spec.rb
|
264
266
|
- ./spec/lib/http_stub/controllers/stub_controller_spec.rb
|
265
267
|
- ./spec/lib/http_stub/hash_extensions_spec.rb
|
266
|
-
- ./spec/lib/http_stub/models/headers_spec.rb
|
267
|
-
- ./spec/lib/http_stub/models/parameters_spec.rb
|
268
268
|
- ./spec/lib/http_stub/models/registry_spec.rb
|
269
|
+
- ./spec/lib/http_stub/models/request_header_parser_spec.rb
|
270
|
+
- ./spec/lib/http_stub/models/response_spec.rb
|
269
271
|
- ./spec/lib/http_stub/models/stub_activator_spec.rb
|
272
|
+
- ./spec/lib/http_stub/models/stub_headers_spec.rb
|
273
|
+
- ./spec/lib/http_stub/models/stub_parameters_spec.rb
|
270
274
|
- ./spec/lib/http_stub/models/stub_spec.rb
|
271
|
-
- ./spec/lib/http_stub/response_spec.rb
|
272
275
|
- ./spec/lib/http_stub/server_integration_spec.rb
|
273
276
|
- ./spec/lib/http_stub/server_spec.rb
|
274
277
|
- ./spec/lib/http_stub/start_server_rake_task_integration_spec.rb
|
data/lib/http_stub/response.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module HttpStub
|
2
|
-
|
3
|
-
class Response
|
4
|
-
|
5
|
-
def initialize(options = {})
|
6
|
-
@response_options = options || {}
|
7
|
-
end
|
8
|
-
|
9
|
-
SUCCESS = HttpStub::Response.new("status" => 200, "body" => "OK")
|
10
|
-
ERROR = HttpStub::Response.new("status" => 404, "body" => "ERROR")
|
11
|
-
EMPTY = HttpStub::Response.new()
|
12
|
-
|
13
|
-
def status
|
14
|
-
@response_options["status"]
|
15
|
-
end
|
16
|
-
|
17
|
-
def body
|
18
|
-
@response_options["body"]
|
19
|
-
end
|
20
|
-
|
21
|
-
def empty?
|
22
|
-
@response_options.empty?
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,153 +0,0 @@
|
|
1
|
-
describe HttpStub::Models::Headers do
|
2
|
-
|
3
|
-
let(:non_http_env_elements) do
|
4
|
-
{
|
5
|
-
"GATEWAY_INTERFACE" => "CGI/1.1",
|
6
|
-
"QUERY_STRING" => "some string",
|
7
|
-
"REMOTE_ADDR" => "127.0.0.1",
|
8
|
-
"SCRIPT_NAME" => "some script",
|
9
|
-
"SERVER_NAME" => "localhost",
|
10
|
-
}
|
11
|
-
end
|
12
|
-
let(:env) { non_http_env_elements.merge(request_headers) }
|
13
|
-
let(:request) { double("HttpRequest", env: env) }
|
14
|
-
|
15
|
-
let(:model) { HttpStub::Models::Headers.new(mandatory_headers) }
|
16
|
-
|
17
|
-
describe "#match?" do
|
18
|
-
|
19
|
-
describe "when multiple headers are mandatory" do
|
20
|
-
|
21
|
-
let(:mandatory_headers) { { "KEY1" => "value1", "KEY2" => "value2", "KEY3" => "value3" } }
|
22
|
-
|
23
|
-
describe "and the mandatory headers are provided" do
|
24
|
-
|
25
|
-
let(:request_headers) { { "HTTP_KEY1" => "value1", "HTTP_KEY2" => "value2", "HTTP_KEY3" => "value3" } }
|
26
|
-
|
27
|
-
describe "and the casing of the header names is identical" do
|
28
|
-
|
29
|
-
it "should return true" do
|
30
|
-
model.match?(request).should be_true
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "and the casing of the header names is different" do
|
36
|
-
|
37
|
-
let(:mandatory_headers) { { "key1" => "value1", "KEY2" => "value2", "key3" => "value3" } }
|
38
|
-
|
39
|
-
it "should return true" do
|
40
|
-
model.match?(request).should be_true
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
describe "and the request headers have different values" do
|
48
|
-
|
49
|
-
let(:request_headers) { { "HTTP_KEY1" => "value1", "HTTP_KEY2" => "doesNotMatch", "HTTP_KEY3" => "value3" } }
|
50
|
-
|
51
|
-
it "should return false" do
|
52
|
-
model.match?(request).should be_false
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "and some mandatory headers are omitted" do
|
58
|
-
|
59
|
-
let(:request_headers) { { "HTTP_KEY1" => "value1", "HTTP_KEY3" => "value3" } }
|
60
|
-
|
61
|
-
it "should return false" do
|
62
|
-
model.match?(request).should be_false
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
describe "and all mandatory headers are omitted" do
|
68
|
-
|
69
|
-
let(:request_headers) { {} }
|
70
|
-
|
71
|
-
it "should return false" do
|
72
|
-
model.match?(request).should be_false
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "when no headers are mandatory" do
|
80
|
-
|
81
|
-
let(:mandatory_headers) { {} }
|
82
|
-
|
83
|
-
describe "and headers are provided" do
|
84
|
-
|
85
|
-
let(:request_headers) { { "HTTP_KEY" => "value" } }
|
86
|
-
|
87
|
-
it "should return true" do
|
88
|
-
model.match?(request).should be_true
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "when the mandatory headers are nil" do
|
96
|
-
|
97
|
-
let(:mandatory_headers) { nil }
|
98
|
-
|
99
|
-
describe "and headers are provided" do
|
100
|
-
|
101
|
-
let(:request_headers) { { "HTTP_KEY" => "value" } }
|
102
|
-
|
103
|
-
it "should return true" do
|
104
|
-
model.match?(request).should be_true
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
describe "#to_s" do
|
114
|
-
|
115
|
-
describe "when multiple headers are provided" do
|
116
|
-
|
117
|
-
let(:mandatory_headers) { { "key1" => "value1", "key2" => "value2", "key3" => "value3" } }
|
118
|
-
|
119
|
-
it "should return a string containing each header formatted as a conventional request header" do
|
120
|
-
result = model.to_s
|
121
|
-
|
122
|
-
mandatory_headers.each { |key, value| result.should match(/#{key}:#{value}/) }
|
123
|
-
end
|
124
|
-
|
125
|
-
it "should comma delimit the headers" do
|
126
|
-
model.to_s.should match(/key\d.value\d\, key\d.value\d\, key\d.value\d/)
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
describe "when empty headers are provided" do
|
132
|
-
|
133
|
-
let(:mandatory_headers) { {} }
|
134
|
-
|
135
|
-
it "should return an empty string" do
|
136
|
-
model.to_s.should eql("")
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
describe "when nil headers are provided" do
|
142
|
-
|
143
|
-
let(:mandatory_headers) { nil }
|
144
|
-
|
145
|
-
it "should return an empty string" do
|
146
|
-
model.to_s.should eql("")
|
147
|
-
end
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
describe HttpStub::Models::Parameters do
|
2
|
-
|
3
|
-
let(:request_params) { double("RequestParameters") }
|
4
|
-
let(:request) { double("HttpRequest", params: request_params) }
|
5
|
-
|
6
|
-
let(:params) { { "key1" => "value1", "key2" => "value2", "key3" => "value3" } }
|
7
|
-
let(:model) { HttpStub::Models::Parameters.new(params) }
|
8
|
-
|
9
|
-
describe "#match?" do
|
10
|
-
|
11
|
-
describe "when the request parameters contain the model parameters" do
|
12
|
-
|
13
|
-
before(:each) { request_params.stub!(:has_hash?).with(params).and_return(true) }
|
14
|
-
|
15
|
-
it "should return true" do
|
16
|
-
model.match?(request).should be(true)
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "when the request parameters do not contain the model parameters" do
|
22
|
-
|
23
|
-
before(:each) { request_params.stub!(:has_hash?).with(params).and_return(false) }
|
24
|
-
|
25
|
-
it "should return false" do
|
26
|
-
model.match?(request).should be(false)
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "#to_s" do
|
34
|
-
|
35
|
-
describe "when multiple parameters are provided" do
|
36
|
-
|
37
|
-
let(:params) { { "key1" => "value1", "key2" => "value2", "key3" => "value3" } }
|
38
|
-
|
39
|
-
it "should return a string containing each parameter formatted as a conventional request parameter" do
|
40
|
-
result = model.to_s
|
41
|
-
|
42
|
-
params.each { |key, value| result.should match(/#{key}=#{value}/) }
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should separate each parameter with the conventional request parameter delimiter" do
|
46
|
-
model.to_s.should match(/key\d.value\d\&key\d.value\d\&key\d.value\d/)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "when empty parameters are provided" do
|
52
|
-
|
53
|
-
let(:params) { {} }
|
54
|
-
|
55
|
-
it "should return an empty string" do
|
56
|
-
model.to_s.should eql("")
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "when nil parameters are provided" do
|
62
|
-
|
63
|
-
let(:params) { nil }
|
64
|
-
|
65
|
-
it "should return an empty string" do
|
66
|
-
model.to_s.should eql("")
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|