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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d41fb030fd5379b0d4b7ebfa5b11f4ca75bdfbe
4
- data.tar.gz: c911b0e8737d4101434572e183124c1cc556d694
3
+ metadata.gz: c46f9f361a535a138b94517191fcd3622a7b45ef
4
+ data.tar.gz: 173ca11a7b1bc0d4a3be11a6cd491997da54f270
5
5
  SHA512:
6
- metadata.gz: 12f39219a3aab6c2d7bbddafc5c13ef0d61ce689d34305363a46fbb9d75134c790f4f1ddd0cf4bdd62b988c43d485b881e9e2ca2cd8641ca862e438927584b4a
7
- data.tar.gz: 4517a6136fe97b44156ece0da456fccc122be6bfcaa9fa04217ba255ced88709ef69df7dbaa634b2d63bdea5fd175743ebd0e173c4dee0e4751adf79dd0b2109
6
+ metadata.gz: bdf8602fb535055ee98dc6753db44c22b766a8fc7898ad8d50a6b6395ddc387e70384184aaba44caf060183d2255055de8851a42156b97d54d33b4f585947af7
7
+ data.tar.gz: 566e5a69dbed569b2558a1423966af4eda52d731bb9cf0613d672399be1c453b880d03fed843cf09ba1bd96a98d7519d729ae4a86dca8849681975640f2d98ce
@@ -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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ~/dev/projects/ruby/restspec
3
3
  specs:
4
- restspec (0.2.6)
4
+ restspec (0.3.0)
5
5
  activesupport (~> 4.0)
6
6
  faker (~> 1.4)
7
7
  hashie (~> 3.3)
@@ -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.body[id_property].present?
13
- create_response.body[id_property]
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
@@ -1,3 +1,3 @@
1
1
  module Restspec
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag