fitting 2.0.2 → 2.0.3

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: fbd655c211eaa536ad6f96ab3eb3fdda3d9992ae
4
- data.tar.gz: 41df47d60aee994fba69f86996fbb15434168d9e
3
+ metadata.gz: adba51bf994a83f976b645f80537581c51da7fd2
4
+ data.tar.gz: 56df90a70b7dc86516d58706b945f35556e0c771
5
5
  SHA512:
6
- metadata.gz: a1ca45ac1f202b95d1ecb4da4ccf0285db1da6b4ea49a5f7449ac299d8d4bbd7a5b65a44fa5f4840e9c9552caf89d204c62916427c0d52a09b580aecfc9593a4
7
- data.tar.gz: 971fa62d13ad32c656e60a7a988b3cac20c452feabc12b7021fda715046ad129b9d91704a2c669a5288673a93f3962044a65aff24001e2a2107172b548f29d69
6
+ metadata.gz: 4beb00e43f17d6cd07a9eb0e14a62e7c384773f9285e12f44cd5dfa6c7342cfbfe2fcba1af8deab170b33d2837c6356710fe233b22ec5cb42d665537878d8f45
7
+ data.tar.gz: 2be9f6e2ffb542e0b0391266ad8281ed435dd805027358b443ea875dfd807f1fc971fe28550fb4607740f9d9b887d282516ced737dd4735b64dbec2d61613d55
data/CHANGELOG.md CHANGED
@@ -4,3 +4,8 @@
4
4
 
5
5
  * bug fixes
6
6
  * Validate html response
7
+
8
+ ### 2.0.3 - 2017-05-02
9
+
10
+ * bug fixes
11
+ * Skip expect if prefix not match
data/README.md CHANGED
@@ -127,7 +127,7 @@ Default `false`. If `true` then all properties are condisidered to have `"requir
127
127
 
128
128
  ### prefix
129
129
 
130
- Prefix of API requests. Example: `'/api'`.
130
+ Prefix of API requests. Example: `'/api'`. Validation will not be performed if the request path does not start with a prefix.
131
131
 
132
132
  ### white_list
133
133
 
@@ -1,5 +1,6 @@
1
1
  require 'fitting/response'
2
2
  require 'fitting/storage/documentation'
3
+ require 'fitting/configuration'
3
4
 
4
5
  module Fitting
5
6
  module Matchers
@@ -9,7 +10,11 @@ module Fitting
9
10
  response,
10
11
  Fitting::Storage::Documentation.tomogram
11
12
  )
12
- @response.fully_validates.valid?
13
+ if @response.within_prefix?(Fitting.configuration.prefix)
14
+ @response.fully_validates.valid?
15
+ else
16
+ true
17
+ end
13
18
  end
14
19
 
15
20
  def ===(other)
@@ -7,9 +7,6 @@ module Fitting
7
7
  @path = env_request.env['PATH_INFO'] || env_request.fullpath
8
8
  @body = env_request.env['action_dispatch.request.request_parameters']
9
9
  @schema = tomogram.find_request(method: @method, path: @path)
10
- @fully_validate = JSON::Validator.fully_validate(@schema.request, @body) if @schema
11
- @valid = false
12
- @valid = true if @fully_validate == []
13
10
  self
14
11
  end
15
12
 
@@ -28,5 +25,9 @@ module Fitting
28
25
  end
29
26
  end
30
27
  end
28
+
29
+ def within_prefix?(prefix)
30
+ @path.start_with?(prefix)
31
+ end
31
32
  end
32
33
  end
@@ -12,6 +12,10 @@ module Fitting
12
12
  @schemas = @request.schemas_of_possible_responses(status: @status)
13
13
  end
14
14
 
15
+ def within_prefix?(prefix)
16
+ @request.within_prefix?(prefix)
17
+ end
18
+
15
19
  def fully_validates
16
20
  @fully_validates ||= Fitting::Response::FullyValidates.craft(@schemas, @body, false)
17
21
  end
@@ -1,3 +1,3 @@
1
1
  module Fitting
2
- VERSION = '2.0.2'.freeze
2
+ VERSION = '2.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitting
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - d.efimov