vigia 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/vigia/adapters/blueprint.rb +22 -0
- data/lib/vigia/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWJmOWE0NTllY2M5OWM1ODVlYzQwOTVhMmZjM2ExMTRmZDQ0NjA0ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTg5ZDljZmVmODNiNDIxN2ZhNjIyN2NjODYwNDdjMmY1MmE3ZjRmOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzA4ODNkYTIzODZmYTc0ODZmNDZjYWU3YTdmYmRkMzJiMjZhNzhmZWU0N2Q3
|
10
|
+
YjRmNGQyMGU1MmJjNTVjMWZhYzQyNDk5N2I1ZjU4N2E0MzBlYjM4ZWQ5Y2E2
|
11
|
+
Mjc0ZTFmOWMwNTRmYTUyYTUxNDRiNzA0NWEwMWE3Zjc0MTYyNjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWU1MDFjZjE3NWM0OTQ4MzFkNmZjODk1ZTQyN2E5MGYzODMwMzgxNjk3YmQz
|
14
|
+
ZGVmNjQwZmI1Mzg5NGQ3ZDYyNGIwZTcxODc4ZTA1ZjRkN2NiNzI5NDY2YzBh
|
15
|
+
MDcyZTNhN2RjNmFhZjM0NTU1NjQyOTM1ZTE3Y2U4MjIwMjZiMmI=
|
data/README.md
CHANGED
@@ -9,9 +9,9 @@ Vigia
|
|
9
9
|
|
10
10
|
<img src="http://singularities.org/vigia.png" width="96" height="96" class="right" alt="Vigia logo" />
|
11
11
|
|
12
|
-
Vigia is a gem to perform integration tests using RSpec and a compatible adapter (See [Adapters](
|
12
|
+
Vigia is a gem to perform integration tests using RSpec and a compatible adapter (See [Adapters](https://github.com/lonelyplanet/vigia/wiki/Adapters)). The adapter creates the structure of the test (groups and context) and sets up all the variables (See [Context variables](https://github.com/lonelyplanet/vigia/wiki/Context-variables)) used to perform the http request.
|
13
13
|
|
14
|
-
These results and expectations objects can be used to run examples that will compare the expected value with the server response value. Vigia allows to use a variety of different ways to execute these comparisons (See [Vigia Examples](
|
14
|
+
These results and expectations objects can be used to run examples that will compare the expected value with the server response value. Vigia allows to use a variety of different ways to execute these comparisons (See [Vigia Examples](https://github.com/lonelyplanet/vigia/wiki/Expectations---Examples) and [Custom Shared Examples](https://github.com/lonelyplanet/vigia/wiki/Shared-examples))
|
15
15
|
|
16
16
|
# Installation
|
17
17
|
|
@@ -39,6 +39,7 @@ module Vigia
|
|
39
39
|
description: -> { "Running Response #{ response.name }" }
|
40
40
|
|
41
41
|
context :default,
|
42
|
+
contexts: [:required_parameters_only],
|
42
43
|
http_client_options: {
|
43
44
|
headers: -> { adapter.headers_for(action, transactional_example, response) },
|
44
45
|
method: -> { action.method },
|
@@ -51,6 +52,21 @@ module Vigia
|
|
51
52
|
headers: -> { adapter.headers_for(action, transactional_example, response, include_payload = false) },
|
52
53
|
body: -> { response.body }
|
53
54
|
}
|
55
|
+
|
56
|
+
# TODO: Tidy up context options. Each one of them should behave as let memos.
|
57
|
+
context :required_parameters_only,
|
58
|
+
examples: [ :code_match, :include_headers ],
|
59
|
+
http_client_options: {
|
60
|
+
headers: -> { adapter.headers_for(action, transactional_example, response) },
|
61
|
+
method: -> { action.method },
|
62
|
+
uri_template: -> { resource.uri_template },
|
63
|
+
parameters: -> { adapter.required_parameters_for(resource, action) },
|
64
|
+
payload: -> { adapter.payload_for(transactional_example, response) if adapter.with_payload?(action) }
|
65
|
+
},
|
66
|
+
expectations: {
|
67
|
+
code: -> { response.name.to_i },
|
68
|
+
headers: -> { adapter.headers_for(action, transactional_example, response, include_payload = false) },
|
69
|
+
body: -> { response.body } }
|
54
70
|
end
|
55
71
|
|
56
72
|
def headers_for(action, transactional_example, response, include_payload = true)
|
@@ -65,6 +81,12 @@ module Vigia
|
|
65
81
|
end
|
66
82
|
end
|
67
83
|
|
84
|
+
def required_parameters_for(resource, action)
|
85
|
+
parameters_for(resource, action).select do |param|
|
86
|
+
param[:required]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
68
90
|
def with_payload?(action)
|
69
91
|
%w(POST PUT PATCH).include? action.method
|
70
92
|
end
|
data/lib/vigia/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vigia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Tapiador
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|