http_stub 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/http_stub.rb +3 -1
- data/lib/http_stub/controllers/alias_controller.rb +1 -1
- data/lib/http_stub/controllers/stub_controller.rb +1 -1
- data/lib/http_stub/models/alias.rb +8 -4
- data/lib/http_stub/models/registry.rb +4 -0
- data/lib/http_stub/models/stub.rb +15 -7
- data/lib/http_stub/response.rb +17 -4
- data/lib/http_stub/server.rb +19 -1
- data/lib/http_stub/version.rb +1 -1
- data/lib/http_stub/views/_stub.haml +13 -0
- data/lib/http_stub/views/aliases.haml +12 -0
- data/lib/http_stub/views/application.sass +2 -0
- data/spec/lib/http_stub/configurer_integration_spec.rb +3 -3
- data/spec/lib/http_stub/controllers/alias_controller_spec.rb +47 -6
- data/spec/lib/http_stub/controllers/stub_controller_spec.rb +11 -2
- data/spec/lib/http_stub/models/alias_spec.rb +13 -5
- data/spec/lib/http_stub/models/registry_spec.rb +28 -0
- data/spec/lib/http_stub/models/stub_spec.rb +26 -10
- data/spec/lib/http_stub/response_spec.rb +22 -4
- data/spec/lib/http_stub/server_integration_spec.rb +44 -0
- data/spec/lib/http_stub/server_spec.rb +4 -4
- data/spec/spec_helper.rb +9 -1
- metadata +68 -15
data/lib/http_stub.rb
CHANGED
@@ -3,19 +3,23 @@ module HttpStub
|
|
3
3
|
|
4
4
|
class Alias
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
@
|
8
|
-
@stub = HttpStub::Models::Stub.new(
|
6
|
+
def initialize(options)
|
7
|
+
@alias_options = options
|
8
|
+
@stub = HttpStub::Models::Stub.new(options)
|
9
9
|
end
|
10
10
|
|
11
11
|
def satisfies?(request)
|
12
|
-
|
12
|
+
alias_uri == request.path_info
|
13
13
|
end
|
14
14
|
|
15
15
|
def the_stub
|
16
16
|
@stub
|
17
17
|
end
|
18
18
|
|
19
|
+
def alias_uri
|
20
|
+
@alias_options["alias_uri"]
|
21
|
+
end
|
22
|
+
|
19
23
|
end
|
20
24
|
|
21
25
|
end
|
@@ -5,25 +5,33 @@ module HttpStub
|
|
5
5
|
|
6
6
|
attr_reader :response
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
10
|
-
@response = HttpStub::Response.new(
|
8
|
+
def initialize(options)
|
9
|
+
@alias_options = options
|
10
|
+
@response = HttpStub::Response.new(options["response"])
|
11
11
|
end
|
12
12
|
|
13
13
|
def satisfies?(request)
|
14
|
-
|
15
|
-
|
14
|
+
uri == request.path_info &&
|
15
|
+
method.downcase == request.request_method.downcase &&
|
16
16
|
parameters_match?(request)
|
17
17
|
end
|
18
18
|
|
19
|
+
def uri
|
20
|
+
@alias_options["uri"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def method
|
24
|
+
@alias_options["method"]
|
25
|
+
end
|
26
|
+
|
19
27
|
def to_s
|
20
|
-
@
|
28
|
+
@alias_options.to_s
|
21
29
|
end
|
22
30
|
|
23
31
|
private
|
24
32
|
|
25
33
|
def parameters_match?(request)
|
26
|
-
parameters = @
|
34
|
+
parameters = @alias_options["parameters"]
|
27
35
|
parameters.nil? || parameters.reduce(true) do |result, parameter|
|
28
36
|
result && (request.params[parameter[0]] == parameter[1])
|
29
37
|
end
|
data/lib/http_stub/response.rb
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
module HttpStub
|
2
2
|
|
3
|
-
class Response
|
4
|
-
|
5
|
-
|
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")
|
6
11
|
EMPTY = HttpStub::Response.new()
|
7
12
|
|
13
|
+
def status
|
14
|
+
@response_options["status"]
|
15
|
+
end
|
16
|
+
|
17
|
+
def body
|
18
|
+
@response_options["body"]
|
19
|
+
end
|
20
|
+
|
8
21
|
def empty?
|
9
|
-
|
22
|
+
@response_options.empty?
|
10
23
|
end
|
11
24
|
|
12
25
|
end
|
data/lib/http_stub/server.rb
CHANGED
@@ -2,7 +2,9 @@ module HttpStub
|
|
2
2
|
|
3
3
|
class Server < ::Sinatra::Base
|
4
4
|
|
5
|
-
|
5
|
+
register Sinatra::Partial
|
6
|
+
|
7
|
+
enable :dump_errors, :logging, :partial_underscores
|
6
8
|
|
7
9
|
def initialize
|
8
10
|
super()
|
@@ -55,13 +57,29 @@ module HttpStub
|
|
55
57
|
halt(response.status, response.body)
|
56
58
|
end
|
57
59
|
|
60
|
+
get "/stubs/aliases" do
|
61
|
+
haml :aliases, {}, aliases: @alias_registry.all.sort_by(&:alias_uri)
|
62
|
+
end
|
63
|
+
|
58
64
|
delete "/stubs/aliases" do
|
59
65
|
@alias_controller.clear(request)
|
60
66
|
halt 200
|
61
67
|
end
|
62
68
|
|
69
|
+
get "/application.css" do
|
70
|
+
sass :application
|
71
|
+
end
|
72
|
+
|
63
73
|
any_request_type(//) { handle_request }
|
64
74
|
|
75
|
+
helpers do
|
76
|
+
|
77
|
+
def h(text)
|
78
|
+
Rack::Utils.escape_html(text)
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
|
65
83
|
private
|
66
84
|
|
67
85
|
def handle_request
|
data/lib/http_stub/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title http_stub server configuration
|
5
|
+
%link{ "rel" => "stylesheet", "href" => "/application.css", "type" => "text/css" }
|
6
|
+
%body
|
7
|
+
- aliases.each do |the_alias|
|
8
|
+
%div
|
9
|
+
%span Response Activation URI:
|
10
|
+
%a{ href: the_alias.alias_uri }= the_alias.alias_uri
|
11
|
+
= partial :stub, locals: { the_stub: the_alias.the_stub }
|
12
|
+
%br
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe HttpStub::Configurer do
|
1
|
+
describe HttpStub::Configurer, "when the server is running" do
|
2
2
|
include_context "server integration"
|
3
3
|
|
4
4
|
let(:configurer) { HttpStub::Examples::ConfigurerWithAlias.new }
|
@@ -8,7 +8,7 @@ describe HttpStub::Configurer do
|
|
8
8
|
configurer.class.clear_aliases!
|
9
9
|
end
|
10
10
|
|
11
|
-
describe "
|
11
|
+
describe "and the configurer is initialized" do
|
12
12
|
|
13
13
|
before(:each) { configurer.class.initialize! }
|
14
14
|
|
@@ -45,7 +45,7 @@ describe HttpStub::Configurer do
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
-
describe "
|
48
|
+
describe "and the configurer is uninitialized" do
|
49
49
|
|
50
50
|
describe "and an attempt is made to activate a stub alias" do
|
51
51
|
|
@@ -2,26 +2,67 @@ describe HttpStub::Controllers::AliasController do
|
|
2
2
|
|
3
3
|
let(:request_body) { "Some request body" }
|
4
4
|
let(:request) { double("HttpRequest", body: double("RequestBody", read: request_body)) }
|
5
|
+
let(:alias_options) { double("AliasOptions") }
|
5
6
|
let(:the_stub) { double(HttpStub::Models::Stub) }
|
6
|
-
let(:
|
7
|
+
let(:the_alias) { double(HttpStub::Models::Alias, the_stub: the_stub) }
|
7
8
|
let(:alias_registry) { double("HttpStub::Models::AliasRegistry").as_null_object }
|
8
9
|
let(:stub_registry) { double("HttpStub::Models::StubRegistry").as_null_object }
|
9
10
|
let(:controller) { HttpStub::Controllers::AliasController.new(alias_registry, stub_registry) }
|
10
11
|
|
12
|
+
before(:each) { JSON.stub!(:parse).and_return(alias_options) }
|
13
|
+
|
14
|
+
describe "#list" do
|
15
|
+
|
16
|
+
describe "when the alias registry contains multiple aliases" do
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
alias_registry.stub!(:all).and_return((1..3).map { |i| double("#{HttpStub::Models::Alias}#{i}") })
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return a page containing each alias" do
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "when the alias registry contains one alias" do
|
29
|
+
|
30
|
+
it "should return a page containing the one alias" do
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "when then alias registry is empty" do
|
37
|
+
|
38
|
+
it "should return an empty page" do
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
11
46
|
describe "#register" do
|
12
47
|
|
13
48
|
before(:each) do
|
14
|
-
HttpStub::Models::Alias.stub!(:new).and_return(
|
49
|
+
HttpStub::Models::Alias.stub!(:new).and_return(the_alias)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should parse an options hash from the JSON request body" do
|
53
|
+
JSON.should_receive(:parse).with(request_body).and_return(alias_options)
|
54
|
+
|
55
|
+
controller.register(request)
|
15
56
|
end
|
16
57
|
|
17
|
-
it "should create an alias from the
|
18
|
-
HttpStub::Models::Alias.should_receive(:new).with(
|
58
|
+
it "should create an alias from the parsed options" do
|
59
|
+
HttpStub::Models::Alias.should_receive(:new).with(alias_options).and_return(the_alias)
|
19
60
|
|
20
61
|
controller.register(request)
|
21
62
|
end
|
22
63
|
|
23
64
|
it "should add the created alias to the alias registry" do
|
24
|
-
alias_registry.should_receive(:add).with(
|
65
|
+
alias_registry.should_receive(:add).with(the_alias, request)
|
25
66
|
|
26
67
|
controller.register(request)
|
27
68
|
end
|
@@ -37,7 +78,7 @@ describe HttpStub::Controllers::AliasController do
|
|
37
78
|
describe "when an alias has been registered that is activated by the request" do
|
38
79
|
|
39
80
|
before(:each) do
|
40
|
-
alias_registry.stub!(:find_for).with(request).and_return(
|
81
|
+
alias_registry.stub!(:find_for).with(request).and_return(the_alias)
|
41
82
|
end
|
42
83
|
|
43
84
|
it "should add the aliases stub to the stub registry" do
|
@@ -1,20 +1,29 @@
|
|
1
1
|
describe HttpStub::Controllers::StubController do
|
2
2
|
|
3
3
|
let(:request_body) { "Some request body" }
|
4
|
+
let(:stub_options) { double("StubOptions") }
|
4
5
|
let(:request) { double("HttpRequest", body: double("RequestBody", read: request_body)) }
|
5
6
|
let(:response) { double(HttpStub::Response) }
|
6
7
|
let(:the_stub) { double(HttpStub::Models::Stub, response: response) }
|
7
8
|
let(:registry) { double(HttpStub::Models::Registry).as_null_object }
|
8
9
|
let(:controller) { HttpStub::Controllers::StubController.new(registry) }
|
9
10
|
|
11
|
+
before(:each) { JSON.stub!(:parse).and_return(stub_options) }
|
12
|
+
|
10
13
|
describe "#register" do
|
11
14
|
|
12
15
|
before(:each) do
|
13
16
|
HttpStub::Models::Stub.stub!(:new).and_return(the_stub)
|
14
17
|
end
|
15
18
|
|
16
|
-
it "should
|
17
|
-
|
19
|
+
it "should parse an options hash from the JSON request body" do
|
20
|
+
JSON.should_receive(:parse).with(request_body).and_return(stub_options)
|
21
|
+
|
22
|
+
controller.register(request)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should create a stub from the parsed options" do
|
26
|
+
HttpStub::Models::Stub.should_receive(:new).with(stub_options).and_return(the_stub)
|
18
27
|
|
19
28
|
controller.register(request)
|
20
29
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
describe HttpStub::Models::Alias do
|
2
2
|
|
3
3
|
let(:alias_uri) { "/some/alias/uri" }
|
4
|
-
let(:
|
5
|
-
{ "alias_uri" => alias_uri }
|
4
|
+
let(:alias_options) do
|
5
|
+
{ "alias_uri" => alias_uri }
|
6
6
|
end
|
7
|
-
let(:the_alias) { HttpStub::Models::Alias.new(
|
7
|
+
let(:the_alias) { HttpStub::Models::Alias.new(alias_options) }
|
8
8
|
|
9
9
|
before(:each) { HttpStub::Models::Stub.stub!(:new).and_return(double(HttpStub::Models::Stub)) }
|
10
10
|
|
@@ -46,13 +46,21 @@ describe HttpStub::Models::Alias do
|
|
46
46
|
|
47
47
|
describe "#the_stub" do
|
48
48
|
|
49
|
-
it "should return a HttpStub::Models::Stub constructed from the
|
49
|
+
it "should return a HttpStub::Models::Stub constructed from the alias options" do
|
50
50
|
stub = double(HttpStub::Models::Stub)
|
51
|
-
HttpStub::Models::Stub.should_receive(:new).with(
|
51
|
+
HttpStub::Models::Stub.should_receive(:new).with(alias_options).and_return(stub)
|
52
52
|
|
53
53
|
the_alias.the_stub.should eql(stub)
|
54
54
|
end
|
55
55
|
|
56
56
|
end
|
57
57
|
|
58
|
+
describe "#alias_uri" do
|
59
|
+
|
60
|
+
it "should return the value provided in the request body" do
|
61
|
+
the_alias.alias_uri.should eql(alias_uri)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
58
66
|
end
|
@@ -88,6 +88,34 @@ describe HttpStub::Models::Registry do
|
|
88
88
|
|
89
89
|
end
|
90
90
|
|
91
|
+
describe "#all" do
|
92
|
+
|
93
|
+
describe "when multiple models have been registered" do
|
94
|
+
|
95
|
+
let(:models) do
|
96
|
+
(1..3).map { |i| double("HttpStub::Models::Model#{i}", :satisfies? => false) }
|
97
|
+
end
|
98
|
+
|
99
|
+
before(:each) do
|
100
|
+
models.each { |model| registry.add(model, request) }
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should return the registered models in the order they were added" do
|
104
|
+
registry.all.should eql(models.reverse)
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "when no model has been registered" do
|
110
|
+
|
111
|
+
it "should return an empty list" do
|
112
|
+
registry.all.should eql([])
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
91
119
|
describe "#clear" do
|
92
120
|
|
93
121
|
it "should log that the models are being cleared" do
|
@@ -3,18 +3,18 @@ describe HttpStub::Models::Stub do
|
|
3
3
|
let(:stub_uri) { "/a_path" }
|
4
4
|
let(:stub_method) { "get" }
|
5
5
|
let(:stub_parameters) { {} }
|
6
|
-
let(:
|
6
|
+
let(:stub_options) do
|
7
7
|
{
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
8
|
+
"uri" => stub_uri,
|
9
|
+
"method" => stub_method,
|
10
|
+
"parameters" => stub_parameters,
|
11
|
+
"response" => {
|
12
|
+
"status" => 201,
|
13
|
+
"body" => "Foo"
|
14
|
+
}
|
15
|
+
}
|
16
16
|
end
|
17
|
-
let(:the_stub) { HttpStub::Models::Stub.new(
|
17
|
+
let(:the_stub) { HttpStub::Models::Stub.new(stub_options) }
|
18
18
|
|
19
19
|
describe "#satisfies?" do
|
20
20
|
|
@@ -132,6 +132,22 @@ describe HttpStub::Models::Stub do
|
|
132
132
|
|
133
133
|
end
|
134
134
|
|
135
|
+
describe "#uri" do
|
136
|
+
|
137
|
+
it "should return the value provided in the request body" do
|
138
|
+
the_stub.uri.should eql(stub_uri)
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
describe "#method" do
|
144
|
+
|
145
|
+
it "should return the value provided in the request body" do
|
146
|
+
the_stub.method.should eql(stub_method)
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
135
151
|
describe "#response" do
|
136
152
|
|
137
153
|
it "should expose the provided response status" do
|
@@ -1,5 +1,7 @@
|
|
1
1
|
describe HttpStub::Response do
|
2
2
|
|
3
|
+
let(:response) { HttpStub::Response.new("status" => 202, "body" => "A response body")}
|
4
|
+
|
3
5
|
describe "::SUCCESS" do
|
4
6
|
|
5
7
|
let(:response) { HttpStub::Response::SUCCESS }
|
@@ -8,8 +10,8 @@ describe HttpStub::Response do
|
|
8
10
|
response.status.should eql(200)
|
9
11
|
end
|
10
12
|
|
11
|
-
it "should have
|
12
|
-
response.body.should
|
13
|
+
it "should have a body containing OK to visually indicate success to those interacting via a browser" do
|
14
|
+
response.body.should match(/OK/)
|
13
15
|
end
|
14
16
|
|
15
17
|
end
|
@@ -22,8 +24,8 @@ describe HttpStub::Response do
|
|
22
24
|
response.status.should eql(404)
|
23
25
|
end
|
24
26
|
|
25
|
-
it "should have
|
26
|
-
response.body.should
|
27
|
+
it "should have a body containing ERROR to visually indicate the error to those interacting via a browser" do
|
28
|
+
response.body.should match(/ERROR/)
|
27
29
|
end
|
28
30
|
|
29
31
|
end
|
@@ -42,6 +44,22 @@ describe HttpStub::Response do
|
|
42
44
|
|
43
45
|
end
|
44
46
|
|
47
|
+
describe "#status" do
|
48
|
+
|
49
|
+
it "should return the value provided in the options" do
|
50
|
+
response.status.should eql(202)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#body" do
|
56
|
+
|
57
|
+
it "should return the value provided in the options" do
|
58
|
+
response.body.should eql("A response body")
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
45
63
|
describe "#empty?" do
|
46
64
|
|
47
65
|
describe "when the response is EMPTY" do
|
@@ -0,0 +1,44 @@
|
|
1
|
+
describe HttpStub::Server, "when the server is running" do
|
2
|
+
include Rack::Utils
|
3
|
+
include_context "server integration"
|
4
|
+
|
5
|
+
let(:configurer) { HttpStub::Examples::ConfigurerWithManyAliases.new }
|
6
|
+
|
7
|
+
describe "and a configurer with multiple aliases is initialized" do
|
8
|
+
|
9
|
+
before(:all) { configurer.class.initialize! }
|
10
|
+
|
11
|
+
describe "GET #stubs/aliases" do
|
12
|
+
|
13
|
+
let(:response) { Net::HTTP.get_response("localhost", "/stubs/aliases", 8001) }
|
14
|
+
let(:response_document) { Nokogiri::HTML(response.body) }
|
15
|
+
|
16
|
+
it "should return a 200 response code" do
|
17
|
+
response.code.should eql("200")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return response whose body contains a link to each alias in alphabetical order" do
|
21
|
+
response_document.css("a").each_with_index do |link, i|
|
22
|
+
link['href'].should eql("/alias#{i + 1}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should return a response whose body contains the uri of each alias stub" do
|
27
|
+
(1..3).each { |i| response.body.should match(/#{escape_html("/path#{i}")}/) }
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return a response whose body contains the response status of each alias stub" do
|
31
|
+
(1..3).each { |i| response.body.should match(/20#{i}/) }
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return a response whose body contains the response body of each alias stub" do
|
35
|
+
response.body.should match(/Plain text body/)
|
36
|
+
response.body.should match(/#{escape_html({ "key" => "JSON body" }.to_json)}/)
|
37
|
+
response.body.should match(/#{escape_html("<html><body>HTML body</body></html>")}/)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -28,7 +28,7 @@ describe HttpStub::Server do
|
|
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
|
31
|
+
stub_controller.stub!(:register).and_return(HttpStub::Response.new("status" => 202, "body" => ""))
|
32
32
|
|
33
33
|
issue_stub_request
|
34
34
|
|
@@ -57,7 +57,7 @@ describe HttpStub::Server do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should respond with the response provided by the controller" do
|
60
|
-
alias_controller.stub!(:register).and_return(HttpStub::Response.new(status
|
60
|
+
alias_controller.stub!(:register).and_return(HttpStub::Response.new("status" => 302, "body" => ""))
|
61
61
|
|
62
62
|
issue_stub_alias_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
|
118
|
+
stub_controller.stub!(:replay).and_return(HttpStub::Response.new("status" => 222, "body" => "Some body"))
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should respond with the replay status code" do
|
@@ -141,7 +141,7 @@ describe HttpStub::Server do
|
|
141
141
|
describe "but the alias controller activates a stub" do
|
142
142
|
|
143
143
|
before(:each) do
|
144
|
-
alias_controller.stub!(:activate).and_return(HttpStub::Response.new(status
|
144
|
+
alias_controller.stub!(:activate).and_return(HttpStub::Response.new("status" => 300, "body" => "A body"))
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should respond with the activation response status code" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter "/spec/"
|
4
|
+
minimum_coverage 96.4
|
5
|
+
refuse_coverage_drop
|
6
|
+
end if ENV["coverage"]
|
7
|
+
|
2
8
|
require 'rack/test'
|
9
|
+
require 'nokogiri'
|
3
10
|
|
4
11
|
require File.expand_path('../../lib/http_stub/start_server_rake_task', __FILE__)
|
5
12
|
require File.expand_path('../../lib/http_stub', __FILE__)
|
6
13
|
require File.expand_path('../../examples/configurer_with_alias', __FILE__)
|
14
|
+
require File.expand_path('../../examples/configurer_with_many_aliases', __FILE__)
|
7
15
|
|
8
16
|
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |file| require file }
|
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.
|
4
|
+
version: 0.3.0
|
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-02-
|
13
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sinatra
|
@@ -29,13 +29,13 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: 1.3.4
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: sinatra-partial
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
36
|
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: 0.4.0
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,55 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 0.4.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: haml
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.0.0
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 4.0.0
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: sass
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 3.2.6
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 3.2.6
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: rspec
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ~>
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '2.12'
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ~>
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '2.12'
|
47
95
|
- !ruby/object:Gem::Dependency
|
48
96
|
name: rack-test
|
49
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,13 +109,13 @@ dependencies:
|
|
61
109
|
- !ruby/object:Gem::Version
|
62
110
|
version: 0.6.2
|
63
111
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
112
|
+
name: nokogiri
|
65
113
|
requirement: !ruby/object:Gem::Requirement
|
66
114
|
none: false
|
67
115
|
requirements:
|
68
116
|
- - ~>
|
69
117
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
118
|
+
version: 1.5.6
|
71
119
|
type: :development
|
72
120
|
prerelease: false
|
73
121
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -75,15 +123,15 @@ dependencies:
|
|
75
123
|
requirements:
|
76
124
|
- - ~>
|
77
125
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
126
|
+
version: 1.5.6
|
79
127
|
- !ruby/object:Gem::Dependency
|
80
|
-
name:
|
128
|
+
name: rake
|
81
129
|
requirement: !ruby/object:Gem::Requirement
|
82
130
|
none: false
|
83
131
|
requirements:
|
84
132
|
- - ~>
|
85
133
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
134
|
+
version: 10.0.3
|
87
135
|
type: :development
|
88
136
|
prerelease: false
|
89
137
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -91,15 +139,15 @@ dependencies:
|
|
91
139
|
requirements:
|
92
140
|
- - ~>
|
93
141
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
142
|
+
version: 10.0.3
|
95
143
|
- !ruby/object:Gem::Dependency
|
96
|
-
name:
|
144
|
+
name: simplecov
|
97
145
|
requirement: !ruby/object:Gem::Requirement
|
98
146
|
none: false
|
99
147
|
requirements:
|
100
148
|
- - ~>
|
101
149
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
150
|
+
version: 0.7.1
|
103
151
|
type: :development
|
104
152
|
prerelease: false
|
105
153
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -107,7 +155,7 @@ dependencies:
|
|
107
155
|
requirements:
|
108
156
|
- - ~>
|
109
157
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
158
|
+
version: 0.7.1
|
111
159
|
- !ruby/object:Gem::Dependency
|
112
160
|
name: flog
|
113
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,6 +205,9 @@ files:
|
|
157
205
|
- ./lib/http_stub/server.rb
|
158
206
|
- ./lib/http_stub/start_server_rake_task.rb
|
159
207
|
- ./lib/http_stub/version.rb
|
208
|
+
- ./lib/http_stub/views/_stub.haml
|
209
|
+
- ./lib/http_stub/views/aliases.haml
|
210
|
+
- ./lib/http_stub/views/application.sass
|
160
211
|
- ./lib/http_stub.rb
|
161
212
|
- ./spec/curl_samples.txt
|
162
213
|
- ./spec/lib/http_stub/configurer_integration_spec.rb
|
@@ -166,6 +217,7 @@ files:
|
|
166
217
|
- ./spec/lib/http_stub/models/registry_spec.rb
|
167
218
|
- ./spec/lib/http_stub/models/stub_spec.rb
|
168
219
|
- ./spec/lib/http_stub/response_spec.rb
|
220
|
+
- ./spec/lib/http_stub/server_integration_spec.rb
|
169
221
|
- ./spec/lib/http_stub/server_spec.rb
|
170
222
|
- ./spec/lib/http_stub/start_server_rake_task_integration_spec.rb
|
171
223
|
- ./spec/spec_helper.rb
|
@@ -191,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
243
|
version: '0'
|
192
244
|
segments:
|
193
245
|
- 0
|
194
|
-
hash:
|
246
|
+
hash: 3062143665725502315
|
195
247
|
requirements: []
|
196
248
|
rubyforge_project: http_stub
|
197
249
|
rubygems_version: 1.8.25
|
@@ -207,6 +259,7 @@ test_files:
|
|
207
259
|
- ./spec/lib/http_stub/models/registry_spec.rb
|
208
260
|
- ./spec/lib/http_stub/models/stub_spec.rb
|
209
261
|
- ./spec/lib/http_stub/response_spec.rb
|
262
|
+
- ./spec/lib/http_stub/server_integration_spec.rb
|
210
263
|
- ./spec/lib/http_stub/server_spec.rb
|
211
264
|
- ./spec/lib/http_stub/start_server_rake_task_integration_spec.rb
|
212
265
|
- ./spec/spec_helper.rb
|