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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmE1ZDljN2M0MTU3NDI2NGE5ZTU2YjY4OTkyYWY1OTM4ZjgxMjQxOA==
4
+ YWJmOWE0NTllY2M5OWM1ODVlYzQwOTVhMmZjM2ExMTRmZDQ0NjA0ZA==
5
5
  data.tar.gz: !binary |-
6
- YTM0ZWFlYzYwNDBhODhjOGExZjUyZGY1MDkyYmY3Y2E0M2RiOWM5MA==
6
+ ZTg5ZDljZmVmODNiNDIxN2ZhNjIyN2NjODYwNDdjMmY1MmE3ZjRmOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzU4YjhiZTgyNTMzZTU3ZDU2ZmJmMzFiNDQyY2M3MWQ1NjFhN2ExZjU5NWY5
10
- MWM3N2ViNmRjMzM3MDAzMGVkODE2MWFiYTY0NTAwNWM0NGRiNTVlM2E2Yzll
11
- ZGY3NzdhNTI2ZTgzOWQwMzE3ODA2MzkzOTQ1YzExMzdlMmYzM2E=
9
+ NzA4ODNkYTIzODZmYTc0ODZmNDZjYWU3YTdmYmRkMzJiMjZhNzhmZWU0N2Q3
10
+ YjRmNGQyMGU1MmJjNTVjMWZhYzQyNDk5N2I1ZjU4N2E0MzBlYjM4ZWQ5Y2E2
11
+ Mjc0ZTFmOWMwNTRmYTUyYTUxNDRiNzA0NWEwMWE3Zjc0MTYyNjY=
12
12
  data.tar.gz: !binary |-
13
- YmI2MTZlODQ1NjRmNGQ1YjdiYzFlOGFiOTI3OTE4Y2Y3ZDliZWU0OTZlZjEz
14
- NWI1MGY0YzYyMDVkZmUwMGNkMDhiYjc4MDEwMGEwYTk4NDA0YWU2YmFiYThh
15
- NDFlYTZjNzkxZmJlNmQxMzZkYzE3Y2FiZTI0M2Y1ZDExOWMyOWM=
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](#adapters)). The adapter creates the structure of the test (groups and context) and sets up all the variables (See [Context variables](#context-variables)) used to perform the http request.
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](#vigia-examples) and [Custom Shared Examples](#custom-shared-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
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Vigia
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
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.3
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-23 00:00:00.000000000 Z
12
+ date: 2015-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake