api_rspecta 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -4
- data/api_rspecta.gemspec +22 -1
- data/lib/api_rspecta/version.rb +1 -1
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f9ad7a7e4afbb26bed3abbc65cf71cee50f2fd5
|
4
|
+
data.tar.gz: 2daa834109d5baf75cfe27255090b2bfa7b0c62c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ae5f26d9607ae52ae990b497fbcae537f6ae5c7c9f37cbfe116374ac5ac820ae2f4bd6ecd3118ab42807acb1c9dbc835ea1998ca89818f8a3d6370a14f46ac5
|
7
|
+
data.tar.gz: 7ef96b62126652da8dd16336c9d92e9f6cea53e2e239f9fb26c7092faa892aa9fd9c1cc85433840d473893936eb4cc4e53d1dfbd26e076dfa99f77d7012ee695
|
data/README.md
CHANGED
@@ -1,6 +1,24 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# API_RSpecta
|
2
|
+
|
3
|
+
`api_rspecta` adds following helper methods to test your JSON APIs with RSpec:
|
4
|
+
|
5
|
+
**JSON:**
|
6
|
+
- `#json` returns parsed `last_response.body`
|
7
|
+
- `#refresh_json` reparses `last_response.body`
|
8
|
+
- `#print_json` to `JSON.pretty_generate` last response JSON
|
9
|
+
- `#json_has_key` tells you if passed json object has a `key`
|
10
|
+
- `#json_has_keys` same as above but for a list of keys
|
11
|
+
- `#json_has_no_key` is opposite to `#json_has_key`
|
12
|
+
|
13
|
+
**Response:**
|
14
|
+
- `should_respond_ok` checks if `last_response.status` was 200
|
15
|
+
- `should_respond_created` checks if `last_response.status` was 201
|
16
|
+
- `should_respond_with_no_content` checks if `last_response.status` was 204
|
17
|
+
- `should_respond_not_authenticated` checks if `last_response.status` was 401
|
18
|
+
- `should_respond_not_authorized` checks if `last_response.status` was 403
|
19
|
+
- `should_respond_not_found` checks if `last_response.status` was 404
|
20
|
+
- `should_respond_with_error_for` checks if `last_response.status` was 422 and that `json` has `errors` for passed `field`
|
21
|
+
- `should_respond_with_errors_for` same as above but for a list of errors
|
4
22
|
|
5
23
|
## Installation
|
6
24
|
|
@@ -24,7 +42,7 @@ TODO: Write usage instructions here
|
|
24
42
|
|
25
43
|
## Contributing
|
26
44
|
|
27
|
-
1. Fork it ( https://github.com/
|
45
|
+
1. Fork it ( https://github.com/SmartCloud/api_rspecta/fork )
|
28
46
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
47
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
48
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/api_rspecta.gemspec
CHANGED
@@ -9,7 +9,28 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Smart Cloud, Inc.", "Alex Bush", "Alex Petropavlovsky"]
|
10
10
|
spec.email = ["alex.v.bush@gmail.com", "petalvlad@gmail.com"]
|
11
11
|
spec.summary = %q{ api_rspecta adds convenient methods to your RSpec to test JSON APIs. }
|
12
|
-
spec.description = %q{
|
12
|
+
spec.description = %q{
|
13
|
+
`api_rspecta` adds following helper methods to test your JSON APIs with RSpec:
|
14
|
+
|
15
|
+
**JSON:**
|
16
|
+
- `#json` returns parsed `last_response.body`
|
17
|
+
- `#refresh_json` reparses `last_response.body`
|
18
|
+
- `#print_json` to `JSON.pretty_generate` last response JSON
|
19
|
+
- `#json_has_key` tells you if passed json object has a `key`
|
20
|
+
- `#json_has_keys` same as above but for a list of keys
|
21
|
+
- `#json_has_no_key` is opposite to `#json_has_key`
|
22
|
+
|
23
|
+
**Response:**
|
24
|
+
- `should_respond_ok` checks if `last_response.status` was 200
|
25
|
+
- `should_respond_created` checks if `last_response.status` was 201
|
26
|
+
- `should_respond_with_no_content` checks if `last_response.status` was 204
|
27
|
+
- `should_respond_not_authenticated` checks if `last_response.status` was 401
|
28
|
+
- `should_respond_not_authorized` checks if `last_response.status` was 403
|
29
|
+
- `should_respond_not_found` checks if `last_response.status` was 404
|
30
|
+
- `should_respond_with_error_for` checks if `last_response.status` was 422 and that `json` has `errors` for passed `field`
|
31
|
+
- `should_respond_with_errors_for` same as above but for a list of errors
|
32
|
+
|
33
|
+
}
|
13
34
|
spec.homepage = "https://github.com/SmartCloud/api_rspecta"
|
14
35
|
spec.license = "MIT"
|
15
36
|
|
data/lib/api_rspecta/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_rspecta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Smart Cloud, Inc.
|
@@ -54,7 +54,20 @@ dependencies:
|
|
54
54
|
- - ~>
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 3.0.0
|
57
|
-
description:
|
57
|
+
description: " \n `api_rspecta` adds following helper methods to test your JSON
|
58
|
+
APIs with RSpec:\n\n **JSON:**\n - `#json` returns parsed `last_response.body`\n
|
59
|
+
\ - `#refresh_json` reparses `last_response.body`\n - `#print_json` to `JSON.pretty_generate`
|
60
|
+
last response JSON\n - `#json_has_key` tells you if passed json object has a
|
61
|
+
`key`\n - `#json_has_keys` same as above but for a list of keys\n - `#json_has_no_key`
|
62
|
+
is opposite to `#json_has_key`\n\n **Response:**\n - `should_respond_ok`
|
63
|
+
checks if `last_response.status` was 200\n - `should_respond_created` checks
|
64
|
+
if `last_response.status` was 201\n - `should_respond_with_no_content` checks
|
65
|
+
if `last_response.status` was 204\n - `should_respond_not_authenticated` checks
|
66
|
+
if `last_response.status` was 401\n - `should_respond_not_authorized` checks
|
67
|
+
if `last_response.status` was 403\n - `should_respond_not_found` checks if `last_response.status`
|
68
|
+
was 404\n - `should_respond_with_error_for` checks if `last_response.status`
|
69
|
+
was 422 and that `json` has `errors` for passed `field`\n - `should_respond_with_errors_for`
|
70
|
+
same as above but for a list of errors\n\n "
|
58
71
|
email:
|
59
72
|
- alex.v.bush@gmail.com
|
60
73
|
- petalvlad@gmail.com
|