wiremock_mapper 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/builders/request_builder.rb +9 -9
- data/lib/version.rb +1 -1
- data/spec/request_builder_spec.rb +16 -16
- data/spec/wiremock_mapper_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8ae7fc5b24332ff8f6cf752b9a1b30944080e3f
|
4
|
+
data.tar.gz: cc69e9a04da8e7883b3af48b79eaee56b5cf115b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34f6165b49809071f1437bab5dd1b818131bd3cd2bf245b0370216ad9a09649d5f87a043e586f41136a3e7c93c1d908c840ec17d8dd48ed5790a28b5ecc4db8a
|
7
|
+
data.tar.gz: 9f354bb62c1c16337c17e5354304d3619364452ebf47d94940d1c9015019e836ac990d64aef019ff3aadd03600cb7e7f2df90439ae039856580147ad0a901e4a
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ WireMockMapper::Configuration.create_global_mapping do |request, respond|
|
|
19
19
|
end
|
20
20
|
|
21
21
|
WireMockMapper.create_mapping do |request, respond|
|
22
|
-
request.
|
22
|
+
request.is_a_post
|
23
23
|
.with_url_path.equal_to('path/to/stub')
|
24
24
|
.with_header('Some-Other-Header').equal_to('some_other_value')
|
25
25
|
.with_cookie('Some-Other-Cookie').equal_to('some_other_cookie_value')
|
@@ -9,49 +9,49 @@ module WireMockMapper
|
|
9
9
|
end
|
10
10
|
|
11
11
|
##
|
12
|
-
# @!method
|
12
|
+
# @!method is_a_any
|
13
13
|
# Sets the request HTTP method to ANY
|
14
14
|
# @return [RequestBuilder] request builder for chaining
|
15
15
|
|
16
16
|
##
|
17
|
-
# @!method
|
17
|
+
# @!method is_a_delete
|
18
18
|
# Sets the request HTTP method to DELETE
|
19
19
|
# @return [RequestBuilder] request builder for chaining
|
20
20
|
|
21
21
|
##
|
22
|
-
# @!method
|
22
|
+
# @!method is_a_get
|
23
23
|
# Sets the request HTTP method to GET
|
24
24
|
# @return [RequestBuilder] request builder for chaining
|
25
25
|
|
26
26
|
##
|
27
|
-
# @!method
|
27
|
+
# @!method is_a_head
|
28
28
|
# Sets the request HTTP method to HEAD
|
29
29
|
# @return [RequestBuilder] request builder for chaining
|
30
30
|
|
31
31
|
##
|
32
|
-
# @!method
|
32
|
+
# @!method is_a_options
|
33
33
|
# Sets the request HTTP method to OPTIONS
|
34
34
|
# @return [RequestBuilder] request builder for chaining
|
35
35
|
|
36
36
|
##
|
37
|
-
# @!method
|
37
|
+
# @!method is_a_post
|
38
38
|
# Sets the request HTTP method to POST
|
39
39
|
# @return [RequestBuilder] request builder for chaining
|
40
40
|
|
41
41
|
##
|
42
|
-
# @!method
|
42
|
+
# @!method is_a_put
|
43
43
|
# Sets the request HTTP method to PUT
|
44
44
|
# @return [RequestBuilder] request builder for chaining
|
45
45
|
|
46
46
|
##
|
47
|
-
# @!method
|
47
|
+
# @!method is_a_trace
|
48
48
|
# Sets the request HTTP method to TRACE
|
49
49
|
# @return [RequestBuilder] request builder for chaining
|
50
50
|
HTTP_VERBS = %w(ANY DELETE GET HEAD OPTIONS POST PUT TRACE).freeze
|
51
51
|
private_constant :HTTP_VERBS
|
52
52
|
|
53
53
|
HTTP_VERBS.each do |verb|
|
54
|
-
define_method("
|
54
|
+
define_method("is_a_#{verb.downcase}") do
|
55
55
|
@options[:method] = verb
|
56
56
|
self
|
57
57
|
end
|
data/lib/version.rb
CHANGED
@@ -3,65 +3,65 @@ require 'spec_helper'
|
|
3
3
|
describe WireMockMapper::Builders::RequestBuilder do
|
4
4
|
let(:builder) { WireMockMapper::Builders::RequestBuilder.new }
|
5
5
|
|
6
|
-
describe '
|
6
|
+
describe 'is_a_any' do
|
7
7
|
it 'sets the http method and url path' do
|
8
|
-
builder.
|
8
|
+
builder.is_a_any
|
9
9
|
result = builder.to_hash
|
10
10
|
expect(result[:method]).to eq('ANY')
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe '
|
14
|
+
describe 'is_a_delete' do
|
15
15
|
it 'sets the http method and url path' do
|
16
|
-
builder.
|
16
|
+
builder.is_a_delete
|
17
17
|
result = builder.to_hash
|
18
18
|
expect(result[:method]).to eq('DELETE')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe '
|
22
|
+
describe 'is_a_get' do
|
23
23
|
it 'sets the http method and url path' do
|
24
|
-
builder.
|
24
|
+
builder.is_a_get
|
25
25
|
result = builder.to_hash
|
26
26
|
expect(result[:method]).to eq('GET')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
describe '
|
30
|
+
describe 'is_a_head' do
|
31
31
|
it 'sets the http method and url path' do
|
32
|
-
builder.
|
32
|
+
builder.is_a_head
|
33
33
|
result = builder.to_hash
|
34
34
|
expect(result[:method]).to eq('HEAD')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe '
|
38
|
+
describe 'is_a_options' do
|
39
39
|
it 'sets the http method and url path' do
|
40
|
-
builder.
|
40
|
+
builder.is_a_options
|
41
41
|
result = builder.to_hash
|
42
42
|
expect(result[:method]).to eq('OPTIONS')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe '
|
46
|
+
describe 'is_a_put' do
|
47
47
|
it 'sets the http method and url path' do
|
48
|
-
builder.
|
48
|
+
builder.is_a_put
|
49
49
|
result = builder.to_hash
|
50
50
|
expect(result[:method]).to eq('PUT')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
describe '
|
54
|
+
describe 'is_a_post' do
|
55
55
|
it 'sets the http method and url path' do
|
56
|
-
builder.
|
56
|
+
builder.is_a_post
|
57
57
|
result = builder.to_hash
|
58
58
|
expect(result[:method]).to eq('POST')
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
describe '
|
62
|
+
describe 'is_a_trace' do
|
63
63
|
it 'sets the http method and url path' do
|
64
|
-
builder.
|
64
|
+
builder.is_a_trace
|
65
65
|
result = builder.to_hash
|
66
66
|
expect(result[:method]).to eq('TRACE')
|
67
67
|
end
|
@@ -14,7 +14,7 @@ describe WireMockMapper do
|
|
14
14
|
stub_request(:post, "#{url}/__admin/mappings/new").with(body: expected_request_body)
|
15
15
|
|
16
16
|
WireMockMapper.create_mapping(url) do |request, respond|
|
17
|
-
request.
|
17
|
+
request.is_a_post
|
18
18
|
.with_url_path.equal_to('/some/path')
|
19
19
|
.with_header('some_header').equal_to('some header value')
|
20
20
|
.with_body.matching('some request body')
|
@@ -40,7 +40,7 @@ describe WireMockMapper do
|
|
40
40
|
expect(WireMockMapper::Configuration).to receive(:request_builder).and_return(request_builder)
|
41
41
|
|
42
42
|
WireMockMapper.create_mapping(url) do |request, respond|
|
43
|
-
request.
|
43
|
+
request.is_a_post
|
44
44
|
.with_url.equal_to('/some/url')
|
45
45
|
.with_header('some_header').equal_to('some header value')
|
46
46
|
.with_body.matching('some request body')
|