http_stub 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/http_stub/configurer/request/http/factory.rb +9 -16
- data/lib/http_stub/configurer/request/http/multipart.rb +6 -3
- data/lib/http_stub/configurer/server/facade.rb +7 -7
- data/lib/http_stub/rake/server_tasks.rb +2 -2
- data/lib/http_stub/server/application.rb +14 -10
- data/lib/http_stub/server/stub/stub.rb +1 -1
- data/lib/http_stub/server/views/{_stub_file_response.haml → _file_response.haml} +0 -0
- data/lib/http_stub/server/views/_match.haml +7 -14
- data/lib/http_stub/server/views/_request.haml +16 -0
- data/lib/http_stub/server/views/_response.haml +9 -0
- data/lib/http_stub/server/views/_stub.haml +9 -25
- data/lib/http_stub/server/views/{_stub_text_response.haml → _text_response.haml} +0 -0
- data/lib/http_stub/server/views/favicon.ico +0 -0
- data/lib/http_stub/server/views/layout.haml +4 -3
- data/lib/http_stub/version.rb +1 -1
- data/spec/acceptance/stub_match_spec.rb +64 -31
- data/spec/lib/http_stub/configurer/request/http/factory_spec.rb +21 -67
- data/spec/lib/http_stub/configurer/request/http/multipart_spec.rb +18 -7
- data/spec/lib/http_stub/configurer/server/command_processor_integration_spec.rb +1 -1
- data/spec/lib/http_stub/configurer/server/facade_spec.rb +25 -19
- data/spec/lib/http_stub/rake/server_daemon_tasks_smoke_spec.rb +1 -1
- data/spec/lib/http_stub/rake/server_tasks_smoke_spec.rb +1 -1
- data/spec/lib/http_stub/server/application_integration_spec.rb +4 -4
- data/spec/lib/http_stub/server/application_spec.rb +10 -10
- data/spec/lib/http_stub/server/stub/stub_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -1
- metadata +21 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDhkNDZhYjNiNzIwYTk3N2YwNmVkODE5ZDM4MmYzYWM2NmI3OTg5Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzZiOTc1Mjc1YzU1OWVmMGI3YTRkYmE0NTZlOWU5ZGU0MDEyOTJlMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWZiMWI1NzkxMTc2NWJhOGQ5ZjNmOTJmMjE5OGI2MzcxYzU0NWY4NGNkYjM2
|
10
|
+
Mzk1N2RiMjE0MzdmOWI3YWRmYzZkNmE2ODkxMGU4OWJiYTNkNjYyMDAwZTc0
|
11
|
+
OTNkNWNmNTg3NGNjYWIyYzUwYjI1MGIwYzhlOGNjMWI2YWE5MWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTI0MGY5NDNmNTczMjczMmQxNWYyZTlhODRjZDZjMGE1Mzc4MWUyNmNmMDlh
|
14
|
+
YzVlNDk3NDVhMTQxZDI0MzQ4YzkzYThmYjU0ZjEzMjU1MzAxMDA5NmU5ZjJk
|
15
|
+
MmVkNDU1MDRjZjJiZmFhNWJmN2Y0Y2RkYTI4OTVlYTRkMGU4MzM=
|
@@ -7,35 +7,28 @@ module HttpStub
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
-
def
|
11
|
-
HttpStub::Configurer::Request::Http::Multipart.new(
|
12
|
-
end
|
13
|
-
|
14
|
-
def scenario(model)
|
15
|
-
HttpStub::Configurer::Request::Http::Multipart.new("/stubs/scenarios", model)
|
16
|
-
end
|
17
|
-
|
18
|
-
alias_method :stub_activator, :scenario
|
19
|
-
|
20
|
-
def activate(uri)
|
21
|
-
get(uri.start_with?("/") ? uri : "/#{uri}")
|
10
|
+
def multipart(model)
|
11
|
+
HttpStub::Configurer::Request::Http::Multipart.new(model)
|
22
12
|
end
|
23
13
|
|
24
14
|
def get(path)
|
25
|
-
|
15
|
+
create_basic_request(:get, path.start_with?("/") ? path : "/#{path}")
|
26
16
|
end
|
27
17
|
|
28
18
|
def post(path)
|
29
|
-
|
19
|
+
create_basic_request(:post, path) { |http_request| http_request.body = "" }
|
30
20
|
end
|
31
21
|
|
32
22
|
def delete(path)
|
33
|
-
|
23
|
+
create_basic_request(:delete, path)
|
34
24
|
end
|
35
25
|
|
36
26
|
private
|
37
27
|
|
38
|
-
def
|
28
|
+
def create_basic_request(request_method, path, &block)
|
29
|
+
http_request_class = Net::HTTP.const_get(request_method.to_s.capitalize)
|
30
|
+
http_request = http_request_class.new(path)
|
31
|
+
block.call(http_request) if block_given?
|
39
32
|
HttpStub::Configurer::Request::Http::Basic.new(http_request)
|
40
33
|
end
|
41
34
|
|
@@ -5,17 +5,20 @@ module HttpStub
|
|
5
5
|
|
6
6
|
class Multipart
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@path = path
|
8
|
+
def initialize(model)
|
10
9
|
@model = model
|
11
10
|
end
|
12
11
|
|
13
12
|
def to_http_request
|
14
|
-
Net::HTTP::Post::Multipart.new(
|
13
|
+
Net::HTTP::Post::Multipart.new(path, parameters)
|
15
14
|
end
|
16
15
|
|
17
16
|
private
|
18
17
|
|
18
|
+
def path
|
19
|
+
"/http_stub/#{@model.class.name.demodulize.pluralize.underscore}"
|
20
|
+
end
|
21
|
+
|
19
22
|
def parameters
|
20
23
|
{ payload: @model.payload.to_json }.tap do |parameters|
|
21
24
|
@model.response_files.each do |response_file|
|
@@ -10,48 +10,48 @@ module HttpStub
|
|
10
10
|
|
11
11
|
def stub_response(model)
|
12
12
|
@request_processor.submit(
|
13
|
-
request: HttpStub::Configurer::Request::Http::Factory.
|
13
|
+
request: HttpStub::Configurer::Request::Http::Factory.multipart(model),
|
14
14
|
description: "stubbing '#{model}'"
|
15
15
|
)
|
16
16
|
end
|
17
17
|
|
18
18
|
def define_scenario(model)
|
19
19
|
@request_processor.submit(
|
20
|
-
request: HttpStub::Configurer::Request::Http::Factory.
|
20
|
+
request: HttpStub::Configurer::Request::Http::Factory.multipart(model),
|
21
21
|
description: "registering scenario '#{model}'"
|
22
22
|
)
|
23
23
|
end
|
24
24
|
|
25
25
|
def activate(uri)
|
26
26
|
@request_processor.submit(
|
27
|
-
request: HttpStub::Configurer::Request::Http::Factory.
|
27
|
+
request: HttpStub::Configurer::Request::Http::Factory.get(uri),
|
28
28
|
description: "activating '#{uri}'"
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
32
32
|
def remember_stubs
|
33
33
|
@request_processor.submit(
|
34
|
-
request: HttpStub::Configurer::Request::Http::Factory.post("/stubs/memory"),
|
34
|
+
request: HttpStub::Configurer::Request::Http::Factory.post("/http_stub/stubs/memory"),
|
35
35
|
description: "committing stubs to memory"
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
39
|
def recall_stubs
|
40
40
|
@request_processor.submit(
|
41
|
-
request: HttpStub::Configurer::Request::Http::Factory.get("/stubs/memory"),
|
41
|
+
request: HttpStub::Configurer::Request::Http::Factory.get("/http_stub/stubs/memory"),
|
42
42
|
description: "recalling stubs in memory"
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
46
46
|
def clear_stubs
|
47
47
|
@request_processor.submit(
|
48
|
-
request: HttpStub::Configurer::Request::Http::Factory.delete("/stubs"),
|
48
|
+
request: HttpStub::Configurer::Request::Http::Factory.delete("/http_stub/stubs"),
|
49
49
|
description: "clearing stubs")
|
50
50
|
end
|
51
51
|
|
52
52
|
def clear_scenarios
|
53
53
|
@request_processor.submit(
|
54
|
-
request: HttpStub::Configurer::Request::Http::Factory.delete("/
|
54
|
+
request: HttpStub::Configurer::Request::Http::Factory.delete("/http_stub/scenarios"),
|
55
55
|
description: "clearing scenarios"
|
56
56
|
)
|
57
57
|
end
|
@@ -14,7 +14,7 @@ module HttpStub
|
|
14
14
|
|
15
15
|
def define_start_task(args)
|
16
16
|
namespace :start do
|
17
|
-
desc "
|
17
|
+
desc "Start stub #{args[:name]} in the foreground"
|
18
18
|
task(:foreground) do
|
19
19
|
HttpStub::Server::Application.instance_eval do
|
20
20
|
set :environment, :test
|
@@ -26,7 +26,7 @@ module HttpStub
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def define_initialize_task(args)
|
29
|
-
desc "
|
29
|
+
desc "Configure stub #{args[:name]}"
|
30
30
|
task(:configure) { args[:configurer].initialize! }
|
31
31
|
end
|
32
32
|
|
@@ -33,49 +33,49 @@ module HttpStub
|
|
33
33
|
|
34
34
|
public
|
35
35
|
|
36
|
-
post "/stubs" do
|
36
|
+
post "/http_stub/stubs" do
|
37
37
|
response = @stub_controller.register(@http_stub_request, logger)
|
38
38
|
@response_pipeline.process(response)
|
39
39
|
end
|
40
40
|
|
41
|
-
get "/stubs" do
|
41
|
+
get "/http_stub/stubs" do
|
42
42
|
haml :stubs, {}, stubs: @stub_registry.all
|
43
43
|
end
|
44
44
|
|
45
|
-
delete "/stubs" do
|
45
|
+
delete "/http_stub/stubs" do
|
46
46
|
@stub_controller.clear(logger)
|
47
47
|
halt 200, "OK"
|
48
48
|
end
|
49
49
|
|
50
|
-
post "/stubs/memory" do
|
50
|
+
post "/http_stub/stubs/memory" do
|
51
51
|
@stub_registry.remember
|
52
52
|
halt 200, "OK"
|
53
53
|
end
|
54
54
|
|
55
|
-
get "/stubs/memory" do
|
55
|
+
get "/http_stub/stubs/memory" do
|
56
56
|
@stub_registry.recall
|
57
57
|
halt 200, "OK"
|
58
58
|
end
|
59
59
|
|
60
|
-
get "/stubs/matches" do
|
60
|
+
get "/http_stub/stubs/matches" do
|
61
61
|
haml :matches, {}, matches: @match_registry.all
|
62
62
|
end
|
63
63
|
|
64
|
-
post "/
|
64
|
+
post "/http_stub/scenarios" do
|
65
65
|
response = @scenario_controller.register(@http_stub_request, logger)
|
66
66
|
@response_pipeline.process(response)
|
67
67
|
end
|
68
68
|
|
69
|
-
get "/
|
69
|
+
get "/http_stub/scenarios" do
|
70
70
|
haml :scenarios, {}, scenarios: @scenario_registry.all.sort_by(&:uri)
|
71
71
|
end
|
72
72
|
|
73
|
-
delete "/
|
73
|
+
delete "/http_stub/scenarios" do
|
74
74
|
@scenario_controller.clear(logger)
|
75
75
|
halt 200, "OK"
|
76
76
|
end
|
77
77
|
|
78
|
-
get "/stubs/:id" do
|
78
|
+
get "/http_stub/stubs/:id" do
|
79
79
|
haml :stub, {}, the_stub: @stub_registry.find(params[:id], logger)
|
80
80
|
end
|
81
81
|
|
@@ -83,6 +83,10 @@ module HttpStub
|
|
83
83
|
sass :application
|
84
84
|
end
|
85
85
|
|
86
|
+
get "/favicon.ico" do
|
87
|
+
send_file File.expand_path("../views/favicon.ico", __FILE__)
|
88
|
+
end
|
89
|
+
|
86
90
|
any_request_type(//) do
|
87
91
|
response = @request_pipeline.process(@http_stub_request, logger)
|
88
92
|
@response_pipeline.process(response)
|
@@ -15,7 +15,7 @@ module HttpStub
|
|
15
15
|
@body = HttpStub::Server::Stub::Match::Rule::Body.create(args["body"])
|
16
16
|
@response = HttpStub::Server::Stub::Response.create(args["response"])
|
17
17
|
@triggers = HttpStub::Server::Stub::Triggers.new(args["triggers"])
|
18
|
-
@stub_uri = "/stubs/#{@id}"
|
18
|
+
@stub_uri = "/http_stub/stubs/#{@id}"
|
19
19
|
@description = args.to_s
|
20
20
|
end
|
21
21
|
|
File without changes
|
@@ -1,19 +1,12 @@
|
|
1
|
-
%table
|
1
|
+
%table{ class: :match }
|
2
2
|
%tr
|
3
|
-
%td
|
4
|
-
%td=
|
3
|
+
%td Request:
|
4
|
+
%td= partial :request, locals: { request: match.request }
|
5
5
|
%tr
|
6
|
-
%td
|
7
|
-
%td
|
8
|
-
|
9
|
-
|
10
|
-
%td=h(match.request.headers)
|
11
|
-
%tr
|
12
|
-
%td Parameters:
|
13
|
-
%td=h(match.request.parameters)
|
14
|
-
%tr
|
15
|
-
%td Body:
|
16
|
-
%td=h(match.request.body)
|
6
|
+
%td Response:
|
7
|
+
%td
|
8
|
+
%table{ class: :response }
|
9
|
+
= partial :response, locals: { response: match.stub.response }
|
17
10
|
%tr
|
18
11
|
%td Matched Stub:
|
19
12
|
%td
|
@@ -1,31 +1,15 @@
|
|
1
1
|
%table
|
2
2
|
%tr
|
3
|
-
%td
|
4
|
-
%td=
|
3
|
+
%td Request:
|
4
|
+
%td=partial :request, locals: { request: the_stub }
|
5
5
|
%tr
|
6
|
-
%td
|
7
|
-
%td
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
%td=h(the_stub.parameters)
|
14
|
-
%tr
|
15
|
-
%td Body:
|
16
|
-
%td=h(the_stub.body)
|
17
|
-
%tr
|
18
|
-
%td Response Status:
|
19
|
-
%td=the_stub.response.status
|
20
|
-
%tr
|
21
|
-
%td Response Headers:
|
22
|
-
%td=h(the_stub.response.headers)
|
23
|
-
%tr
|
24
|
-
%td Response Body:
|
25
|
-
%td=partial "stub_#{the_stub.response.type}_response".to_sym, locals: { response: the_stub.response }
|
26
|
-
%tr
|
27
|
-
%td Response Delay:
|
28
|
-
%td=h(the_stub.response.delay_in_seconds)
|
6
|
+
%td Response:
|
7
|
+
%td
|
8
|
+
%table
|
9
|
+
=partial :response, locals: { response: the_stub.response }
|
10
|
+
%tr
|
11
|
+
%td Delay:
|
12
|
+
%td=h(the_stub.response.delay_in_seconds)
|
29
13
|
%tr
|
30
14
|
%td Triggers:
|
31
15
|
%td
|
File without changes
|
Binary file
|
@@ -1,7 +1,8 @@
|
|
1
1
|
!!!
|
2
2
|
%html
|
3
3
|
%head
|
4
|
-
%
|
5
|
-
%link{
|
4
|
+
%link{ rel: "stylesheet", href: "/application.css", type: "text/css" }
|
5
|
+
%link{ rel: "icon", href: "/favicon.ico", type: "image/x-icon" }
|
6
|
+
%title http_stub server diagnostics
|
6
7
|
%body
|
7
|
-
=yield
|
8
|
+
=yield
|
data/lib/http_stub/version.rb
CHANGED
@@ -5,23 +5,46 @@ describe "Stub match acceptance" do
|
|
5
5
|
|
6
6
|
after(:example) { configurer.clear_stubs! }
|
7
7
|
|
8
|
-
describe "GET /stubs/matches" do
|
8
|
+
describe "GET /http_stub/stubs/matches" do
|
9
9
|
|
10
|
-
let(:
|
11
|
-
let(:request_method)
|
12
|
-
let(:
|
13
|
-
(1..3).reduce({}) { |result, i| result.tap { result["
|
10
|
+
let(:request_uri) { "/some/uri" }
|
11
|
+
let(:request_method) { :get }
|
12
|
+
let(:request_headers) do
|
13
|
+
(1..3).reduce({}) { |result, i| result.tap { result["request_header_#{i}"] = "request header value #{i}" } }
|
14
14
|
end
|
15
|
-
let(:
|
16
|
-
let(:
|
15
|
+
let(:request_parameters) { {} }
|
16
|
+
let(:request_body) { nil }
|
17
17
|
|
18
|
-
let(:response) { HTTParty.get("#{server_uri}/stubs/matches") }
|
18
|
+
let(:response) { HTTParty.get("#{server_uri}/http_stub/stubs/matches") }
|
19
19
|
let(:response_document) { Nokogiri::HTML(response.body) }
|
20
20
|
|
21
|
+
shared_context "registers a stub" do
|
22
|
+
|
23
|
+
let(:stub_response_status) { 203 }
|
24
|
+
let(:stub_response_headers) do
|
25
|
+
(1..3).reduce({}) { |result, i| result.tap { result["response_header_#{i}"] = "response header value #{i}" } }
|
26
|
+
end
|
27
|
+
let(:stub_response_body) { "Stub response body" }
|
28
|
+
|
29
|
+
def register_stub
|
30
|
+
@register_stub_response = stub_server.add_stub!(build_stub)
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_stub
|
34
|
+
stub_server.build_stub do |stub|
|
35
|
+
stub.match_requests(uri: request_uri, method: request_method,
|
36
|
+
headers: request_headers, parameters: request_parameters, body: request_body)
|
37
|
+
stub.respond_with(status: stub_response_status, headers: stub_response_headers, body: stub_response_body)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
21
44
|
shared_context "behaviours of a request that is recorded in the stub match log" do
|
22
45
|
|
23
46
|
it "returns a response body that contains the uri of the request" do
|
24
|
-
expect(response.body).to match(/#{escape_html(
|
47
|
+
expect(response.body).to match(/#{escape_html(request_uri)}/)
|
25
48
|
end
|
26
49
|
|
27
50
|
it "returns a response body that contains the method of the request" do
|
@@ -29,51 +52,55 @@ describe "Stub match acceptance" do
|
|
29
52
|
end
|
30
53
|
|
31
54
|
it "returns a response body that contains the headers of the request whose names are in uppercase" do
|
32
|
-
|
55
|
+
request_headers.each do |expected_header_key, expected_header_value|
|
33
56
|
expect(response.body).to match(/#{expected_header_key.upcase}:#{expected_header_value}/)
|
34
57
|
end
|
35
58
|
end
|
36
59
|
|
37
60
|
context "when the request contains parameters" do
|
38
61
|
|
39
|
-
let(:
|
62
|
+
let(:request_parameters) do
|
40
63
|
(1..3).reduce({}) { |result, i| result.tap { result["parameter_#{i}"] = "parameter value #{i}" } }
|
41
64
|
end
|
42
65
|
|
43
66
|
it "returns a response body that contain the parameters" do
|
44
|
-
|
67
|
+
request_parameters.each do |expected_parameter_key, expected_parameter_value|
|
45
68
|
expect(response.body).to match(/#{expected_parameter_key}=#{expected_parameter_value}/)
|
46
69
|
end
|
47
70
|
end
|
48
71
|
|
49
72
|
def issue_request
|
50
|
-
HTTParty.send(
|
73
|
+
HTTParty.send(
|
74
|
+
request_method, "#{server_uri}#{request_uri}", headers: request_headers, query: request_parameters
|
75
|
+
)
|
51
76
|
end
|
52
77
|
|
53
78
|
end
|
54
79
|
|
55
80
|
context "when the request contains a body" do
|
56
81
|
|
57
|
-
let(:
|
82
|
+
let(:request_body) { "Some <strong>request body</strong>" }
|
58
83
|
|
59
84
|
it "returns a response body that contains the body" do
|
60
|
-
expect(response.body).to match(/#{escape_html(
|
85
|
+
expect(response.body).to match(/#{escape_html(request_body)}/)
|
61
86
|
end
|
62
87
|
|
63
88
|
def issue_request
|
64
|
-
HTTParty.send(request_method, "#{server_uri}#{
|
89
|
+
HTTParty.send(request_method, "#{server_uri}#{request_uri}", headers: request_headers, body: request_body)
|
65
90
|
end
|
66
91
|
|
67
92
|
end
|
68
93
|
|
69
94
|
def issue_request
|
70
|
-
HTTParty.send(request_method, "#{server_uri}#{
|
95
|
+
HTTParty.send(request_method, "#{server_uri}#{request_uri}", headers: request_headers)
|
71
96
|
end
|
72
97
|
|
73
98
|
end
|
74
99
|
|
75
100
|
context "when a request has been made matching a stub" do
|
76
101
|
|
102
|
+
include_context "registers a stub"
|
103
|
+
|
77
104
|
before(:example) do
|
78
105
|
register_stub
|
79
106
|
|
@@ -82,6 +109,20 @@ describe "Stub match acceptance" do
|
|
82
109
|
|
83
110
|
include_context "behaviours of a request that is recorded in the stub match log"
|
84
111
|
|
112
|
+
it "returns a response body that contains stub response status" do
|
113
|
+
expect(response.body).to match(/#{escape_html(stub_response_status)}/)
|
114
|
+
end
|
115
|
+
|
116
|
+
it "returns a response body that contains stub response headers" do
|
117
|
+
stub_response_headers.each do |expected_header_key, expected_header_value|
|
118
|
+
expect(response.body).to match(/#{expected_header_key}:#{expected_header_value}/)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
it "returns a response body that contains stub response body" do
|
123
|
+
expect(response.body).to match(/#{escape_html(stub_response_body)}/)
|
124
|
+
end
|
125
|
+
|
85
126
|
it "returns a response body that contains a link to the matched stub" do
|
86
127
|
stub_link = response_document.css("a.stub").first
|
87
128
|
expect(full_stub_uri).to end_with(stub_link["href"])
|
@@ -103,20 +144,24 @@ describe "Stub match acceptance" do
|
|
103
144
|
|
104
145
|
context "when a request has been made configuring a stub" do
|
105
146
|
|
147
|
+
include_context "registers a stub"
|
148
|
+
|
106
149
|
before(:example) { register_stub }
|
107
150
|
|
108
151
|
it "should not be recorded in the stub request log" do
|
109
|
-
expect(response.body).to_not match(/#{
|
152
|
+
expect(response.body).to_not match(/#{request_uri}/)
|
110
153
|
end
|
111
154
|
|
112
155
|
end
|
113
156
|
|
114
157
|
context "when a request has been made configuring a scenarios" do
|
115
158
|
|
159
|
+
include_context "registers a stub"
|
160
|
+
|
116
161
|
before(:example) { register_scenario }
|
117
162
|
|
118
163
|
it "should not be recorded in the stub request log" do
|
119
|
-
expect(response.body).to_not match(/#{
|
164
|
+
expect(response.body).to_not match(/#{request_uri}/)
|
120
165
|
end
|
121
166
|
|
122
167
|
def register_scenario
|
@@ -125,18 +170,6 @@ describe "Stub match acceptance" do
|
|
125
170
|
|
126
171
|
end
|
127
172
|
|
128
|
-
def register_stub
|
129
|
-
@register_stub_response = stub_server.add_stub!(build_stub)
|
130
|
-
end
|
131
|
-
|
132
|
-
def build_stub
|
133
|
-
stub_server.build_stub do |stub|
|
134
|
-
stub.match_requests(uri: uri, method: request_method, headers: headers, parameters: parameters, body: body)
|
135
|
-
stub.respond_with(status: 200, body: "Some body")
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
173
|
end
|
141
174
|
|
142
175
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
describe HttpStub::Configurer::Request::Http::Factory do
|
2
2
|
|
3
|
-
describe "::
|
3
|
+
describe "::multipart" do
|
4
4
|
|
5
|
-
let(:model) {
|
5
|
+
let(:model) { double("HttpStub::Configurer::Request::SomeModel") }
|
6
6
|
let(:multipart_request) { instance_double(HttpStub::Configurer::Request::Http::Multipart) }
|
7
7
|
|
8
|
-
subject { HttpStub::Configurer::Request::Http::Factory.
|
8
|
+
subject { HttpStub::Configurer::Request::Http::Factory.multipart(model) }
|
9
9
|
|
10
10
|
before(:example) do
|
11
11
|
allow(HttpStub::Configurer::Request::Http::Multipart).to receive(:new).and_return(multipart_request)
|
12
12
|
end
|
13
13
|
|
14
|
-
it "creates a multipart request
|
15
|
-
expect(HttpStub::Configurer::Request::Http::Multipart).to receive(:new).with(
|
14
|
+
it "creates a multipart request with the provided model" do
|
15
|
+
expect(HttpStub::Configurer::Request::Http::Multipart).to receive(:new).with(model)
|
16
16
|
|
17
17
|
subject
|
18
18
|
end
|
@@ -23,89 +23,43 @@ describe HttpStub::Configurer::Request::Http::Factory do
|
|
23
23
|
|
24
24
|
end
|
25
25
|
|
26
|
-
describe "::
|
27
|
-
|
28
|
-
let(:model) { instance_double(HttpStub::Configurer::Request::Scenario) }
|
29
|
-
let(:multipart_request) { instance_double(HttpStub::Configurer::Request::Http::Multipart) }
|
30
|
-
|
31
|
-
subject { HttpStub::Configurer::Request::Http::Factory.scenario(model) }
|
32
|
-
|
33
|
-
before(:example) do
|
34
|
-
allow(HttpStub::Configurer::Request::Http::Multipart).to receive(:new).and_return(multipart_request)
|
35
|
-
end
|
36
|
-
|
37
|
-
it "creates a multipart request for the stub scenarios endpoint with the provided model" do
|
38
|
-
expect(HttpStub::Configurer::Request::Http::Multipart).to receive(:new).with("/stubs/scenarios", model)
|
39
|
-
|
40
|
-
subject
|
41
|
-
end
|
42
|
-
|
43
|
-
it "returns the created request" do
|
44
|
-
expect(subject).to eql(multipart_request)
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
describe "::activate" do
|
26
|
+
describe "::get" do
|
50
27
|
|
51
|
-
let(:
|
28
|
+
let(:path) { "some/get/path" }
|
29
|
+
let(:get_request) { instance_double(Net::HTTP::Get) }
|
52
30
|
let(:basic_request) { instance_double(HttpStub::Configurer::Request::Http::Basic) }
|
53
31
|
|
54
|
-
subject { HttpStub::Configurer::Request::Http::Factory.
|
32
|
+
subject { HttpStub::Configurer::Request::Http::Factory.get(path) }
|
55
33
|
|
56
34
|
before(:example) do
|
57
|
-
allow(
|
35
|
+
allow(Net::HTTP::Get).to receive(:new).and_return(get_request)
|
36
|
+
allow(HttpStub::Configurer::Request::Http::Basic).to receive(:new).and_return(basic_request)
|
58
37
|
end
|
59
38
|
|
60
|
-
context "when the
|
39
|
+
context "when the path is absolute" do
|
61
40
|
|
62
|
-
let(:
|
41
|
+
let(:path) { "/some/absolute/get/path" }
|
63
42
|
|
64
|
-
it "creates a
|
65
|
-
expect(
|
43
|
+
it "creates a GET request with the provided path" do
|
44
|
+
expect(Net::HTTP::Get).to receive(:new).with(path)
|
66
45
|
|
67
46
|
subject
|
68
47
|
end
|
69
48
|
|
70
49
|
end
|
71
50
|
|
72
|
-
context "when the
|
51
|
+
context "when the path is relative" do
|
73
52
|
|
74
|
-
let(:
|
53
|
+
let(:path) { "some/relative/get/path" }
|
75
54
|
|
76
|
-
it "creates a
|
77
|
-
expect(
|
55
|
+
it "creates a GET request with the path prefixed by '/'" do
|
56
|
+
expect(Net::HTTP::Get).to receive(:new).with("/#{path}")
|
78
57
|
|
79
58
|
subject
|
80
59
|
end
|
81
60
|
|
82
61
|
end
|
83
62
|
|
84
|
-
it "returns the created request" do
|
85
|
-
expect(subject).to eql(basic_request)
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "::get" do
|
91
|
-
|
92
|
-
let(:path) { "some/get/path" }
|
93
|
-
let(:get_request) { instance_double(Net::HTTP::Get) }
|
94
|
-
let(:basic_request) { instance_double(HttpStub::Configurer::Request::Http::Basic) }
|
95
|
-
|
96
|
-
subject { HttpStub::Configurer::Request::Http::Factory.get(path) }
|
97
|
-
|
98
|
-
before(:example) do
|
99
|
-
allow(Net::HTTP::Get).to receive(:new).and_return(get_request)
|
100
|
-
allow(HttpStub::Configurer::Request::Http::Basic).to receive(:new).and_return(basic_request)
|
101
|
-
end
|
102
|
-
|
103
|
-
it "creates a GET request with the provided path" do
|
104
|
-
expect(Net::HTTP::Get).to receive(:new).with(path)
|
105
|
-
|
106
|
-
subject
|
107
|
-
end
|
108
|
-
|
109
63
|
it "creates a basic request wrapping the GET request" do
|
110
64
|
expect(HttpStub::Configurer::Request::Http::Basic).to receive(:new).with(get_request)
|
111
65
|
|
@@ -120,7 +74,7 @@ describe HttpStub::Configurer::Request::Http::Factory do
|
|
120
74
|
|
121
75
|
describe "::post" do
|
122
76
|
|
123
|
-
let(:path) { "some/post/path" }
|
77
|
+
let(:path) { "/some/post/path" }
|
124
78
|
let(:post_request) { instance_double(Net::HTTP::Post).as_null_object }
|
125
79
|
let(:basic_request) { instance_double(HttpStub::Configurer::Request::Http::Basic) }
|
126
80
|
|
@@ -157,7 +111,7 @@ describe HttpStub::Configurer::Request::Http::Factory do
|
|
157
111
|
|
158
112
|
describe "::delete" do
|
159
113
|
|
160
|
-
let(:path) { "some/
|
114
|
+
let(:path) { "/some/delete/path" }
|
161
115
|
let(:delete_request) { instance_double(Net::HTTP::Delete) }
|
162
116
|
let(:basic_request) { instance_double(HttpStub::Configurer::Request::Http::Basic) }
|
163
117
|
|
@@ -1,10 +1,21 @@
|
|
1
1
|
describe HttpStub::Configurer::Request::Http::Multipart do
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
class HttpStub::Configurer::Request::SomeModel
|
4
|
+
|
5
|
+
attr_reader :payload, :response_files
|
6
|
+
|
7
|
+
def initialize(args)
|
8
|
+
@payload = args[:payload]
|
9
|
+
@response_files = args[:response_files]
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:payload) { { key: "value" } }
|
15
|
+
let(:response_files) { [] }
|
16
|
+
let(:model) { HttpStub::Configurer::Request::SomeModel.new(payload: payload, response_files: response_files) }
|
17
|
+
|
18
|
+
let(:multipart_request) { HttpStub::Configurer::Request::Http::Multipart.new(model) }
|
8
19
|
|
9
20
|
describe "#to_http_request" do
|
10
21
|
|
@@ -23,8 +34,8 @@ describe HttpStub::Configurer::Request::Http::Multipart do
|
|
23
34
|
expect(subject).to eql(http_multipart_request)
|
24
35
|
end
|
25
36
|
|
26
|
-
it "creates a HTTP request with the
|
27
|
-
expect(Net::HTTP::Post::Multipart).to receive(:new).with(
|
37
|
+
it "creates a HTTP request with a path to the pluralized name for the model" do
|
38
|
+
expect(Net::HTTP::Post::Multipart).to receive(:new).with("/http_stub/some_models", anything)
|
28
39
|
|
29
40
|
subject
|
30
41
|
end
|
@@ -22,7 +22,7 @@ describe HttpStub::Configurer::Server::CommandProcessor do
|
|
22
22
|
|
23
23
|
describe "and the server responds with a 200 response" do
|
24
24
|
|
25
|
-
let(:request) { create_get_request("/stubs") }
|
25
|
+
let(:request) { create_get_request("/http_stub/stubs") }
|
26
26
|
|
27
27
|
it "executes without error" do
|
28
28
|
expect { subject }.not_to raise_error
|
@@ -29,16 +29,16 @@ describe HttpStub::Configurer::Server::Facade do
|
|
29
29
|
|
30
30
|
before(:example) do
|
31
31
|
allow(request_processor).to receive(:submit)
|
32
|
-
allow(HttpStub::Configurer::Request::Http::Factory).to receive(:
|
32
|
+
allow(HttpStub::Configurer::Request::Http::Factory).to receive(:multipart).and_return(request)
|
33
33
|
end
|
34
34
|
|
35
|
-
it "creates a
|
36
|
-
expect(HttpStub::Configurer::Request::Http::Factory).to receive(:
|
35
|
+
it "creates a multipart request with the provided model" do
|
36
|
+
expect(HttpStub::Configurer::Request::Http::Factory).to receive(:multipart).with(model)
|
37
37
|
|
38
38
|
subject
|
39
39
|
end
|
40
40
|
|
41
|
-
it "submits the
|
41
|
+
it "submits the request via the request processor" do
|
42
42
|
expect(request_processor).to receive(:submit).with(hash_including(request: request))
|
43
43
|
|
44
44
|
subject
|
@@ -62,16 +62,16 @@ describe HttpStub::Configurer::Server::Facade do
|
|
62
62
|
|
63
63
|
before(:example) do
|
64
64
|
allow(request_processor).to receive(:submit)
|
65
|
-
allow(HttpStub::Configurer::Request::Http::Factory).to receive(:
|
65
|
+
allow(HttpStub::Configurer::Request::Http::Factory).to receive(:multipart).and_return(request)
|
66
66
|
end
|
67
67
|
|
68
|
-
it "creates a
|
69
|
-
expect(HttpStub::Configurer::Request::Http::Factory).to receive(:
|
68
|
+
it "creates a multipart request with the provided model" do
|
69
|
+
expect(HttpStub::Configurer::Request::Http::Factory).to receive(:multipart).with(model)
|
70
70
|
|
71
71
|
subject
|
72
72
|
end
|
73
73
|
|
74
|
-
it "submits the
|
74
|
+
it "submits the request via the request processor" do
|
75
75
|
expect(request_processor).to receive(:submit).with(hash_including(request: request))
|
76
76
|
|
77
77
|
subject
|
@@ -95,12 +95,12 @@ describe HttpStub::Configurer::Server::Facade do
|
|
95
95
|
subject { facade.activate(uri) }
|
96
96
|
|
97
97
|
before(:example) do
|
98
|
-
allow(HttpStub::Configurer::Request::Http::Factory).to receive(:
|
98
|
+
allow(HttpStub::Configurer::Request::Http::Factory).to receive(:get).and_return(request)
|
99
99
|
allow(request_processor).to receive(:submit)
|
100
100
|
end
|
101
101
|
|
102
|
-
it "creates an
|
103
|
-
expect(HttpStub::Configurer::Request::Http::Factory).to receive(:
|
102
|
+
it "creates an GET request for the uri" do
|
103
|
+
expect(HttpStub::Configurer::Request::Http::Factory).to receive(:get).with(uri).and_return(request)
|
104
104
|
|
105
105
|
subject
|
106
106
|
end
|
@@ -130,8 +130,10 @@ describe HttpStub::Configurer::Server::Facade do
|
|
130
130
|
allow(request_processor).to receive(:submit)
|
131
131
|
end
|
132
132
|
|
133
|
-
it "creates a POST request for /stubs/memory endpoint" do
|
134
|
-
expect(HttpStub::Configurer::Request::Http::Factory).to
|
133
|
+
it "creates a POST request for the /http_stub/stubs/memory endpoint" do
|
134
|
+
expect(HttpStub::Configurer::Request::Http::Factory).to(
|
135
|
+
receive(:post).with("/http_stub/stubs/memory").and_return(request)
|
136
|
+
)
|
135
137
|
|
136
138
|
subject
|
137
139
|
end
|
@@ -161,8 +163,10 @@ describe HttpStub::Configurer::Server::Facade do
|
|
161
163
|
allow(request_processor).to receive(:submit)
|
162
164
|
end
|
163
165
|
|
164
|
-
it "creates a GET request for /stubs/memory endpoint" do
|
165
|
-
expect(HttpStub::Configurer::Request::Http::Factory).to
|
166
|
+
it "creates a GET request for the /http_stub/stubs/memory endpoint" do
|
167
|
+
expect(HttpStub::Configurer::Request::Http::Factory).to(
|
168
|
+
receive(:get).with("/http_stub/stubs/memory").and_return(request)
|
169
|
+
)
|
166
170
|
|
167
171
|
subject
|
168
172
|
end
|
@@ -192,8 +196,10 @@ describe HttpStub::Configurer::Server::Facade do
|
|
192
196
|
allow(request_processor).to receive(:submit)
|
193
197
|
end
|
194
198
|
|
195
|
-
it "creates a DELETE request for the /stubs endpoint" do
|
196
|
-
expect(HttpStub::Configurer::Request::Http::Factory).to
|
199
|
+
it "creates a DELETE request for the /http_stub/stubs endpoint" do
|
200
|
+
expect(HttpStub::Configurer::Request::Http::Factory).to(
|
201
|
+
receive(:delete).with("/http_stub/stubs").and_return(request)
|
202
|
+
)
|
197
203
|
|
198
204
|
subject
|
199
205
|
end
|
@@ -223,9 +229,9 @@ describe HttpStub::Configurer::Server::Facade do
|
|
223
229
|
allow(request_processor).to receive(:submit)
|
224
230
|
end
|
225
231
|
|
226
|
-
it "creates a DELETE request for the /
|
232
|
+
it "creates a DELETE request for the /http_stub/scenarios endpoint" do
|
227
233
|
expect(HttpStub::Configurer::Request::Http::Factory).to(
|
228
|
-
receive(:delete).with("/
|
234
|
+
receive(:delete).with("/http_stub/scenarios").and_return(request)
|
229
235
|
)
|
230
236
|
|
231
237
|
subject
|
@@ -16,7 +16,7 @@ describe HttpStub::Rake::ServerDaemonTasks do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "starts a stub server that responds to stub requests" do
|
19
|
-
request = Net::HTTP::Post.new("/stubs")
|
19
|
+
request = Net::HTTP::Post.new("/http_stub/stubs")
|
20
20
|
request.body = { response: { status: 302, body: "Some Body" } }.to_json
|
21
21
|
|
22
22
|
response = Net::HTTP.new("localhost", 8002).start { |http| http.request(request) }
|
@@ -19,7 +19,7 @@ describe HttpStub::Rake::ServerTasks do
|
|
19
19
|
after(:example) { wait_until_server_has_stopped }
|
20
20
|
|
21
21
|
it "starts a stub server that responds to stub requests" do
|
22
|
-
request = Net::HTTP::Post.new("/stubs")
|
22
|
+
request = Net::HTTP::Post.new("/http_stub/stubs")
|
23
23
|
request.body = { "uri" => "/", "response" => { "status" => 302, "body" => "Some Body" } }.to_json
|
24
24
|
|
25
25
|
response = Net::HTTP.new("localhost", port).start { |http| http.request(request) }
|
@@ -9,7 +9,7 @@ describe HttpStub::Server::Application, "when the server is running" do
|
|
9
9
|
|
10
10
|
let(:response) do
|
11
11
|
HTTParty.post(
|
12
|
-
"#{server_uri}/stubs",
|
12
|
+
"#{server_uri}/http_stub/stubs",
|
13
13
|
body: { uri: "/some/path", method: "get", response: { status: 200, body: "Some body" } }.to_json
|
14
14
|
)
|
15
15
|
end
|
@@ -183,7 +183,7 @@ describe HttpStub::Server::Application, "when the server is running" do
|
|
183
183
|
|
184
184
|
before(:context) { (1..3).each { |i| HTTParty.get("#{server_uri}/scenario_#{i}") } }
|
185
185
|
|
186
|
-
let(:response) { HTTParty.get("#{server_uri}/stubs") }
|
186
|
+
let(:response) { HTTParty.get("#{server_uri}/http_stub/stubs") }
|
187
187
|
|
188
188
|
include_context "the response contains HTML describing the configurers stubs"
|
189
189
|
|
@@ -191,9 +191,9 @@ describe HttpStub::Server::Application, "when the server is running" do
|
|
191
191
|
|
192
192
|
end
|
193
193
|
|
194
|
-
describe "GET /
|
194
|
+
describe "GET /http_stub/scenarios" do
|
195
195
|
|
196
|
-
let(:response) { HTTParty.get("#{server_uri}/
|
196
|
+
let(:response) { HTTParty.get("#{server_uri}/http_stub/scenarios") }
|
197
197
|
|
198
198
|
it "returns a response whose body contains links to each scenario in alphabetical order" do
|
199
199
|
expected_scenario_links = %w{ nested_scenario scenario }.map do |scenario_name_prefix|
|
@@ -31,7 +31,7 @@ describe HttpStub::Server::Application do
|
|
31
31
|
let(:registration_response) { instance_double(HttpStub::Server::Stub::Response::Base) }
|
32
32
|
|
33
33
|
subject do
|
34
|
-
post "/stubs", { uri: "/a_path", method: "a method", response: { status: 200, body: "Foo" } }.to_json
|
34
|
+
post "/http_stub/stubs", { uri: "/a_path", method: "a method", response: { status: 200, body: "Foo" } }.to_json
|
35
35
|
end
|
36
36
|
|
37
37
|
before(:example) { allow(stub_controller).to receive(:register).and_return(registration_response) }
|
@@ -54,7 +54,7 @@ describe HttpStub::Server::Application do
|
|
54
54
|
|
55
55
|
let(:found_stubs) { [ HttpStub::Server::Stub::Empty::INSTANCE ] }
|
56
56
|
|
57
|
-
subject { get "/stubs" }
|
57
|
+
subject { get "/http_stub/stubs" }
|
58
58
|
|
59
59
|
it "retrieves the stubs from the registry" do
|
60
60
|
expect(stub_registry).to receive(:all).and_return(found_stubs)
|
@@ -69,7 +69,7 @@ describe HttpStub::Server::Application do
|
|
69
69
|
let(:stub_id) { SecureRandom.uuid }
|
70
70
|
let(:found_stub) { HttpStub::Server::Stub::Empty::INSTANCE }
|
71
71
|
|
72
|
-
subject { get "/stubs/#{stub_id}" }
|
72
|
+
subject { get "/http_stub/stubs/#{stub_id}" }
|
73
73
|
|
74
74
|
it "retrieves the stub from the registry" do
|
75
75
|
expect(stub_registry).to receive(:find).with(stub_id, anything).and_return(found_stub)
|
@@ -81,7 +81,7 @@ describe HttpStub::Server::Application do
|
|
81
81
|
|
82
82
|
context "when a request to clear the stubs is received" do
|
83
83
|
|
84
|
-
subject { delete "/stubs" }
|
84
|
+
subject { delete "/http_stub/stubs" }
|
85
85
|
|
86
86
|
it "delegates clearing to the stub controller" do
|
87
87
|
expect(stub_controller).to receive(:clear)
|
@@ -99,7 +99,7 @@ describe HttpStub::Server::Application do
|
|
99
99
|
|
100
100
|
context "when a request to commit the stubs to memory is received" do
|
101
101
|
|
102
|
-
subject { post "/stubs/memory" }
|
102
|
+
subject { post "/http_stub/stubs/memory" }
|
103
103
|
|
104
104
|
it "remembers the stubs in the stub registry" do
|
105
105
|
expect(stub_registry).to receive(:remember)
|
@@ -117,7 +117,7 @@ describe HttpStub::Server::Application do
|
|
117
117
|
|
118
118
|
context "when a request to recall the stubs in memory is received" do
|
119
119
|
|
120
|
-
subject { get "/stubs/memory" }
|
120
|
+
subject { get "/http_stub/stubs/memory" }
|
121
121
|
|
122
122
|
it "recalls the stubs remembered by the stub registry" do
|
123
123
|
expect(stub_registry).to receive(:recall)
|
@@ -137,7 +137,7 @@ describe HttpStub::Server::Application do
|
|
137
137
|
|
138
138
|
let(:found_matches) { [ HttpStub::Server::Stub::Match::MatchFixture.empty ] }
|
139
139
|
|
140
|
-
subject { get "/stubs/matches" }
|
140
|
+
subject { get "/http_stub/stubs/matches" }
|
141
141
|
|
142
142
|
it "retrieves the matches from the registry" do
|
143
143
|
expect(match_registry).to receive(:all).and_return(found_matches)
|
@@ -154,7 +154,7 @@ describe HttpStub::Server::Application do
|
|
154
154
|
before(:example) { allow(scenario_controller).to receive(:register).and_return(registration_response) }
|
155
155
|
|
156
156
|
subject do
|
157
|
-
post "/
|
157
|
+
post "/http_stub/scenarios",
|
158
158
|
{
|
159
159
|
uri: "/a_scenario_path",
|
160
160
|
stubs: [ { uri: "/a_path", method: "a method", response: { status: 200, body: "Foo" } } ],
|
@@ -180,7 +180,7 @@ describe HttpStub::Server::Application do
|
|
180
180
|
|
181
181
|
let(:found_scenarios) { [ HttpStub::Server::Scenario::ScenarioFixture.empty ] }
|
182
182
|
|
183
|
-
subject { get "/
|
183
|
+
subject { get "/http_stub/scenarios" }
|
184
184
|
|
185
185
|
it "retrieves the stubs from the registry" do
|
186
186
|
expect(scenario_registry).to receive(:all).and_return(found_scenarios)
|
@@ -192,7 +192,7 @@ describe HttpStub::Server::Application do
|
|
192
192
|
|
193
193
|
context "when a request to clear the scenarios has been received" do
|
194
194
|
|
195
|
-
subject { delete "/
|
195
|
+
subject { delete "/http_stub/scenarios" }
|
196
196
|
|
197
197
|
it "delegates clearing to the scenario controller" do
|
198
198
|
expect(scenario_controller).to receive(:clear)
|
@@ -266,7 +266,7 @@ describe HttpStub::Server::Stub::Stub do
|
|
266
266
|
context "when an id is provided in the payload" do
|
267
267
|
|
268
268
|
it "returns a relative uri to the stub that includes the id" do
|
269
|
-
expect(the_stub.stub_uri).to eql("/stubs/#{stub_id}")
|
269
|
+
expect(the_stub.stub_uri).to eql("/http_stub/stubs/#{stub_id}")
|
270
270
|
end
|
271
271
|
|
272
272
|
end
|
@@ -274,7 +274,7 @@ describe HttpStub::Server::Stub::Stub do
|
|
274
274
|
context "when an id is not provided in the payload" do
|
275
275
|
|
276
276
|
it "returns a relative uri to the stub that includes a generated id" do
|
277
|
-
expect(the_stub.stub_uri).to match(/\/stubs\/[a-zA-Z0-9-]+$/)
|
277
|
+
expect(the_stub.stub_uri).to match(/\/http_stub\/stubs\/[a-zA-Z0-9-]+$/)
|
278
278
|
end
|
279
279
|
|
280
280
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:development)
|
3
3
|
|
4
|
+
CodeClimate::TestReporter.start
|
5
|
+
|
4
6
|
SimpleCov.start do
|
5
7
|
coverage_dir "tmp/coverage"
|
6
8
|
|
7
9
|
add_filter "/spec/"
|
8
10
|
add_filter "/vendor/"
|
9
11
|
|
10
|
-
minimum_coverage 99.
|
12
|
+
minimum_coverage 99.85
|
11
13
|
refuse_coverage_drop
|
12
14
|
end if ENV["coverage"]
|
13
15
|
|
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.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Ueckerman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -263,6 +263,20 @@ dependencies:
|
|
263
263
|
- - ~>
|
264
264
|
- !ruby/object:Gem::Version
|
265
265
|
version: '0.1'
|
266
|
+
- !ruby/object:Gem::Dependency
|
267
|
+
name: codeclimate-test-reporter
|
268
|
+
requirement: !ruby/object:Gem::Requirement
|
269
|
+
requirements:
|
270
|
+
- - ~>
|
271
|
+
- !ruby/object:Gem::Version
|
272
|
+
version: '0.4'
|
273
|
+
type: :development
|
274
|
+
prerelease: false
|
275
|
+
version_requirements: !ruby/object:Gem::Requirement
|
276
|
+
requirements:
|
277
|
+
- - ~>
|
278
|
+
- !ruby/object:Gem::Version
|
279
|
+
version: '0.4'
|
266
280
|
description: fakeweb for a HTTP server, informing it to stub / fake responses
|
267
281
|
email: matthew.ueckerman@myob.com
|
268
282
|
executables: []
|
@@ -341,12 +355,15 @@ files:
|
|
341
355
|
- ./lib/http_stub/server/stub/response/text.rb
|
342
356
|
- ./lib/http_stub/server/stub/stub.rb
|
343
357
|
- ./lib/http_stub/server/stub/triggers.rb
|
358
|
+
- ./lib/http_stub/server/views/_file_response.haml
|
344
359
|
- ./lib/http_stub/server/views/_match.haml
|
360
|
+
- ./lib/http_stub/server/views/_request.haml
|
361
|
+
- ./lib/http_stub/server/views/_response.haml
|
345
362
|
- ./lib/http_stub/server/views/_scenario.haml
|
346
363
|
- ./lib/http_stub/server/views/_stub.haml
|
347
|
-
- ./lib/http_stub/server/views/
|
348
|
-
- ./lib/http_stub/server/views/_stub_text_response.haml
|
364
|
+
- ./lib/http_stub/server/views/_text_response.haml
|
349
365
|
- ./lib/http_stub/server/views/application.sass
|
366
|
+
- ./lib/http_stub/server/views/favicon.ico
|
350
367
|
- ./lib/http_stub/server/views/layout.haml
|
351
368
|
- ./lib/http_stub/server/views/matches.haml
|
352
369
|
- ./lib/http_stub/server/views/scenarios.haml
|