textualize 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/textualize/tasks/helpers/route_hash_creator.rb +8 -0
- data/lib/textualize/tasks/request_specs.rb +8 -1
- data/lib/textualize/templates/new/apis/base.raml +2 -2
- data/lib/textualize/templates/request_specs/delete_collection-item.rb.erb +15 -0
- data/lib/textualize/templates/request_specs/patch_collection-item.rb.erb +14 -0
- data/lib/textualize/templates/request_specs/post_collection.rb.erb +7 -1
- data/lib/textualize/version.rb +1 -1
- data/textualize.gemspec +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0004fe0730f678c98c0b08e94bd3bece7a42bf6e
|
4
|
+
data.tar.gz: 60c9fd0ddbac322e698b77067bd5476dd42dbab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0ecaa24c69b83455a92a2a54e4d41a8240061a53f234c014d5759d761a484cf215c549b6dcc4b6ff4f128fbded452bf6c6d9b2fbe5f3ab3cbbcb5a0ab285504
|
7
|
+
data.tar.gz: 98e0b6d410a04a5d7b51e8be91a454ffb5b673badda5fdf60d6a886d80f451abaa6c1e6b72c560611966d73ab718639802dccfbb267868ffca382122ea354a5a
|
@@ -24,7 +24,15 @@ module Textualize
|
|
24
24
|
method_hashes = []
|
25
25
|
method_hashes += resource.fetch('methods').map do |method|
|
26
26
|
method_hash = Hashie::Mash.new
|
27
|
+
|
27
28
|
method_hash.verb = method.fetch('method')
|
29
|
+
|
30
|
+
if method_hash.verb == 'post'
|
31
|
+
method_hash.schema = method.fetch('body').
|
32
|
+
fetch('application/json').
|
33
|
+
fetch('schema')
|
34
|
+
end
|
35
|
+
|
28
36
|
method_hash.url = base_path + relative_path
|
29
37
|
method_hash.relative_path = relative_path
|
30
38
|
method_hash.type = resource.fetch('type').keys.first
|
@@ -20,10 +20,17 @@ module Textualize
|
|
20
20
|
|
21
21
|
def add_airborne_specs
|
22
22
|
RouteHashes.hashes.each do |route_hash|
|
23
|
+
|
24
|
+
# replace sample ids with interpolated ruby
|
25
|
+
modified_hash = route_hash
|
26
|
+
|
27
|
+
modified_hash.relative_path.gsub!(/({|_id)/, '{' => '#{', '_id' => '.id')
|
28
|
+
modified_hash.url.gsub!(/({|_id)/, '{' => '#{', '_id' => '.id')
|
29
|
+
|
23
30
|
File.open(
|
24
31
|
"#{RS_DIRECTORY}#{route_hash.verb}_#{route_hash.name}_spec.rb", 'w'
|
25
32
|
) do |file|
|
26
|
-
file.write(request_spec_template(
|
33
|
+
file.write(request_spec_template(modified_hash))
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
@@ -13,8 +13,8 @@ securitySchemes:
|
|
13
13
|
- oauth_2_0: !include ./documentation/authentication.yaml
|
14
14
|
|
15
15
|
schemas:
|
16
|
-
-
|
17
|
-
-
|
16
|
+
- item: !include ./base/schemas/item.json
|
17
|
+
- order: !include ./base/schemas/order.json
|
18
18
|
|
19
19
|
resourceTypes:
|
20
20
|
- !include ./resourceTypes/collection.yaml
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'airborne'
|
2
|
+
|
3
|
+
describe 'DELETE <%= url %>' do
|
4
|
+
let!(:<%= name %>) { create(:<%= name %>) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
add_header_tokens(<%= secured_by %>)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'returns expected json' do
|
11
|
+
delete "<%= url %>"
|
12
|
+
expect_status <%= response_code %>
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'airborne'
|
2
|
+
|
3
|
+
describe 'PATCH <%= url %>' do
|
4
|
+
let!(:<%= name %>) { create(:<%= name %>) }
|
5
|
+
|
6
|
+
before do
|
7
|
+
add_header_tokens(<%= secured_by %>)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'returns expected json' do
|
11
|
+
patch "<%= url %>"
|
12
|
+
expect_status <%= response_code %>
|
13
|
+
end
|
14
|
+
|
@@ -6,7 +6,13 @@ describe 'POST <%= url %>' do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'returns the saved record' do
|
9
|
-
post "<%= url %>"
|
9
|
+
post "<%= url %>", {
|
10
|
+
<%= properties = JSON.parse(schema).fetch('properties');
|
11
|
+
properties.fetch('required').map { |required_param|
|
12
|
+
"\"#{required_param}\" => "\
|
13
|
+
"\"#{properties.fetch(required_param).fetch('type')}\""
|
14
|
+
}.join("\n") %>
|
15
|
+
}
|
10
16
|
expect_status <%= response_code %>
|
11
17
|
end
|
12
18
|
end
|
data/lib/textualize/version.rb
CHANGED
data/textualize.gemspec
CHANGED
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
end
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_runtime_dependency 'thor',
|
31
|
-
spec.add_runtime_dependency 'attr_extras',
|
32
|
-
spec.add_runtime_dependency 'hashie',
|
33
|
-
spec.add_runtime_dependency 'uglifier',
|
30
|
+
spec.add_runtime_dependency 'thor', '~> 0'
|
31
|
+
spec.add_runtime_dependency 'attr_extras', '~> 4'
|
32
|
+
spec.add_runtime_dependency 'hashie', '~> 3'
|
33
|
+
spec.add_runtime_dependency 'uglifier', '~> 2'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'aruba', '~> 0'
|
36
36
|
spec.add_development_dependency 'byebug', '~> 3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: textualize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Q-Centrix Dev Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|