restspec 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -5
- data/examples/store-api-tests/Gemfile.lock +1 -1
- data/lib/restspec/schema/types/schema_id_type.rb +13 -2
- data/lib/restspec/version.rb +1 -1
- 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: c46f9f361a535a138b94517191fcd3622a7b45ef
|
4
|
+
data.tar.gz: 173ca11a7b1bc0d4a3be11a6cd491997da54f270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdf8602fb535055ee98dc6753db44c22b766a8fc7898ad8d50a6b6395ddc387e70384184aaba44caf060183d2255055de8851a42156b97d54d33b4f585947af7
|
7
|
+
data.tar.gz: 566e5a69dbed569b2558a1423966af4eda52d731bb9cf0613d672399be1c453b880d03fed843cf09ba1bd96a98d7519d729ae4a86dca8849681975640f2d98ce
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
0.1
|
2
2
|
---
|
3
|
-
- Added `:for` option to `schema` methods on the endpoint definition. This allows to specify schemas for payloads, schemas for responses and schemas for whatever. See: https://github.com/platanus/restspec/issues/2.
|
4
|
-
- Added `no_schema` method to endpoint definitions. This is a subtask of https://github.com/platanus/restspec/issues/2..
|
3
|
+
- FEATURE: Added `:for` option to `schema` methods on the endpoint definition. This allows to specify schemas for payloads, schemas for responses and schemas for whatever. See: https://github.com/platanus/restspec/issues/2.
|
4
|
+
- FEATURE: Added `no_schema` method to endpoint definitions. This is a subtask of https://github.com/platanus/restspec/issues/2..
|
5
5
|
|
6
6
|
0.2
|
7
7
|
---
|
8
|
-
- Fixed a problem with schema extensions (`:without`) not working due to the fact that endpoints saved schema clones that just were shallow clones. They still were sharing the internal attributes hash.
|
9
|
-
- Fixed `no_schema`. It was not working because the schema setting of the namepsace were happening after the `no_schema` call. From now, `all` definitions will happen before the specific schema definitions.
|
10
|
-
- Changed abilities of schemas related to endpoints to just be the same as the schema roles. It's preferrable to have attributes only for payload or only for responses than attributes only for examples or only for checks. This is the new feature of the release.
|
8
|
+
- FIX: Fixed a problem with schema extensions (`:without`) not working due to the fact that endpoints saved schema clones that just were shallow clones. They still were sharing the internal attributes hash.
|
9
|
+
- FIX: Fixed `no_schema`. It was not working because the schema setting of the namepsace were happening after the `no_schema` call. From now, `all` definitions will happen before the specific schema definitions.
|
10
|
+
- FEATURE: Changed abilities of schemas related to endpoints to just be the same as the schema roles. It's preferrable to have attributes only for payload or only for responses than attributes only for examples or only for checks. This is the new feature of the release.
|
11
|
+
|
12
|
+
0.3
|
13
|
+
---
|
14
|
+
- FIX: Fixed varios minor problems with internal access to hashes/openstructs related to properties with names of hashes methods.
|
15
|
+
- FIX: SchemaID was requiring the existence of the **index** endpoint.
|
16
|
+
- FIX: ChangedTilt dependency due to dependency problem with Rails 4.2.
|
17
|
+
- FEATURE: SchemaID's id property is now configurable. (SchemaId now can receive an `:id` option in case you don't want to use `:id`).
|
18
|
+
- FEATURE: Added `root` option to schema definition to allow wrapping the object in a root key.
|
@@ -9,8 +9,8 @@ module Restspec::Schema::Types
|
|
9
9
|
def example_for(attribute)
|
10
10
|
return sample_item[id_property] if sample_item.present?
|
11
11
|
|
12
|
-
if create_response.code == 201 && create_response
|
13
|
-
|
12
|
+
if create_response.code == 201 && value = response_property_value(create_response, id_property)
|
13
|
+
value
|
14
14
|
else
|
15
15
|
hardcoded_fallback
|
16
16
|
end
|
@@ -27,6 +27,17 @@ module Restspec::Schema::Types
|
|
27
27
|
|
28
28
|
attr_accessor :schema_name
|
29
29
|
|
30
|
+
def response_property_value(response, property)
|
31
|
+
schema = Restspec::SchemaStore.get(schema_name)
|
32
|
+
body = response.body
|
33
|
+
|
34
|
+
if schema.root?
|
35
|
+
body[schema.root_name][id_property]
|
36
|
+
else
|
37
|
+
body[id_property]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
30
41
|
def find_endpoint(name)
|
31
42
|
Restspec::EndpointStore.get(name)
|
32
43
|
end
|
data/lib/restspec/version.rb
CHANGED