apiculture 0.1.3 → 0.1.4

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: 0bf044e0978c4650b72aa2b337fe9cb000ecd546
4
- data.tar.gz: 010b7cfb597e96aba2554b32e00b9fd3773e5169
3
+ metadata.gz: e16ee2ca91e6376b8c77247d26ec50e8139a2bba
4
+ data.tar.gz: cb3b9822eb86288b6f1a40b8c129c00169e97590
5
5
  SHA512:
6
- metadata.gz: 3b2db79c161620c9f1d8cd22cfb252d7e0ac6013c42de0e87368c819334df7c5b9f8b6a666e0ea380e847d8d0c52dca98afdf94db97e25b3670880f5dc0eff7d
7
- data.tar.gz: 2b89340ef4473feb21e7c5c49018f5b0bb68748dd8b0d536c5bc0090253bc1d1952db3900839dc40e412a19ba02051cd8889c4a5b0d5afa3fc03a86eeec5816e
6
+ metadata.gz: 2dc459a07daf3484a231d7b67841be88f95dc51955081a817f3540ba96f2c997638659ec2571ec17efed8d5d323402fc05792685e03960969f8fe3d8af7d8186
7
+ data.tar.gz: 5b59c5d1b9480a88010081c4d7c6e355bd73c5e2ffbea90ae84941e7d76dff099a5b329cac03aa2b49a65f0e6c2aae76261b1f6ae15c047855388c8076f1d97b
data/.travis.yml CHANGED
@@ -2,12 +2,13 @@ gemfile:
2
2
  - gemfiles/Gemfile.rack-1.x
3
3
  - gemfiles/Gemfile.rack-2.x
4
4
  rvm:
5
- - 2.3.7
6
- - 2.4.4
7
- - 2.5.1
8
- - 2.6.0-preview1
5
+ - '2.3.8'
6
+ - '2.4.6'
7
+ - '2.5.5'
8
+ - '2.6.3'
9
+ - '2.7.0-preview1'
9
10
  sudo: false
10
11
  cache: bundler
11
12
  matrix:
12
13
  allow_failures:
13
- - rvm: 2.6.0-preview1
14
+ - rvm: 2.7.0-preview1
@@ -96,8 +96,8 @@
96
96
  }
97
97
  </style>
98
98
  </head>
99
-
99
+
100
100
  <body>
101
101
  {{& html_fragment }}
102
102
  </body>
103
- </html>
103
+ </html>
@@ -1,3 +1,3 @@
1
1
  module Apiculture
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -1,35 +1,35 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
3
  describe "Apiculture.api_documentation" do
4
- let(:app) {
4
+ let(:app) do
5
5
  Class.new(Apiculture::App) do
6
6
  extend Apiculture
7
-
7
+
8
8
  markdown_string 'This API is very important. Because it has to do with pancakes.'
9
-
9
+
10
10
  documentation_build_time!
11
-
11
+
12
12
  desc 'Order a pancake'
13
13
  required_param :diameter, "Diameter of the pancake. The pancake will be **bold**", Integer
14
14
  param :topping, 'Type of topping', String
15
15
  pancake_response_info = <<~EOS
16
- When the pancake has been baked succesfully
16
+ When the pancake has been baked successfully
17
17
  The pancake will have the following properties:
18
-
18
+
19
19
  * It is going to be round
20
20
  * It is going to be delicious
21
- EOS
22
- responds_with 200, pancake_response_info, {id: 'abdef..c21'}
21
+ EOS
22
+ responds_with 200, pancake_response_info, { id: 'abdef..c21' }
23
23
  api_method :post, '/pancakes' do
24
24
  end
25
-
25
+
26
26
  desc 'Check the pancake status'
27
27
  route_param :id, 'Pancake ID to check status on'
28
- responds_with 200, 'When the pancake is found', {status: 'Baking'}
29
- responds_with 404, 'When no such pancake exists', {status: 'No such pancake'}
28
+ responds_with 200, 'When the pancake is found', { status: 'Baking' }
29
+ responds_with 404, 'When no such pancake exists', { status: 'No such pancake' }
30
30
  api_method :get, '/pancake/:id' do
31
31
  end
32
-
32
+
33
33
  desc 'Throw away the pancake'
34
34
  route_param :id, 'Pancake ID to delete'
35
35
  api_method :delete, '/pancake/:id' do
@@ -40,21 +40,21 @@ describe "Apiculture.api_documentation" do
40
40
  api_method :get, '/pancake/with/:topping_id' do |topping_id|
41
41
  end
42
42
  end
43
- }
44
-
43
+ end
44
+
45
45
  it 'generates app documentation as HTML without the body element' do
46
46
  docco = app.api_documentation
47
47
  generated_html = docco.to_html_fragment
48
-
48
+
49
49
  expect(generated_html).not_to include('<body')
50
50
  expect(generated_html).to include('Pancake ID to check status on')
51
51
  expect(generated_html).to include('Pancake ID to delete')
52
52
  end
53
-
53
+
54
54
  it 'generates app documentation in HTML' do
55
55
  docco = app.api_documentation
56
56
  generated_html = docco.to_html
57
-
57
+
58
58
  if ENV['SHOW_TEST_DOC']
59
59
  File.open('t.html', 'w') do |f|
60
60
  f.write(generated_html)
@@ -62,21 +62,22 @@ describe "Apiculture.api_documentation" do
62
62
  `open #{f.path}`
63
63
  end
64
64
  end
65
-
65
+
66
66
  expect(generated_html).to include('<body')
67
67
  expect(generated_html).to include('Pancake ID to check status on')
68
- expect(generated_html).to include('When the pancake has been baked succesfully')
68
+ expect(generated_html).to include('When the pancake has been baked successfully')
69
69
  expect(generated_html).to include('"id": "abdef..c21"')
70
+ expect(generated_html).to end_with("\n")
70
71
  end
71
-
72
+
72
73
  it 'generates app documentation in Markdown' do
73
74
  docco = app.api_documentation
74
75
  generated_markdown = docco.to_markdown
75
-
76
+
76
77
  expect(generated_markdown).not_to include('<body')
77
78
  expect(generated_markdown).to include('## POST /pancakes')
78
79
  end
79
-
80
+
80
81
  it 'generates app documentation honoring the mount point' do
81
82
  overridden = Class.new(Apiculture::App) do
82
83
  extend Apiculture
@@ -84,11 +85,11 @@ describe "Apiculture.api_documentation" do
84
85
  api_method :get, '/pancakes' do
85
86
  end
86
87
  end
87
-
88
+
88
89
  generated_markdown = overridden.api_documentation.to_markdown
89
90
  expect(generated_markdown).to include('## GET /api/v2/pancakes')
90
91
  end
91
-
92
+
92
93
  it 'generates app documentation injecting the inline Markdown strings' do
93
94
  app_class = Class.new(Apiculture::App) do
94
95
  extend Apiculture
@@ -98,16 +99,16 @@ describe "Apiculture.api_documentation" do
98
99
  markdown_string '# This describes even more important stuff'
99
100
  markdown_string 'This is a paragraph'
100
101
  end
101
-
102
+
102
103
  generated_html = app_class.api_documentation.to_html
103
104
  expect(generated_html).to include('<h2>GET /pancakes</h2>')
104
105
  expect(generated_html).to include('<h1>This describes even more important stuff')
105
106
  expect(generated_html).to include('<h1>This describes important stuff')
106
107
  expect(generated_html).to include('<p>This is a paragraph')
107
108
  end
108
-
109
+
109
110
  context 'with a file containing Markdown that has to be spliced into the docs' do
110
- before(:each) { File.open('./TEST.md', 'w') {|f| f << "# This is an important header"} }
111
+ before(:each) { File.open('./TEST.md', 'w') { |f| f << "# This is an important header" } }
111
112
  after(:each) { File.unlink('./TEST.md') }
112
113
  it 'splices the contents of the file using markdown_file' do
113
114
  app_class = Class.new(Apiculture::App) do
@@ -116,7 +117,7 @@ describe "Apiculture.api_documentation" do
116
117
  api_method :get, '/pancakes' do
117
118
  end
118
119
  end
119
-
120
+
120
121
  generated_html = app_class.api_documentation.to_html
121
122
  expect(generated_html).to include('<h2>GET /pancakes</h2>')
122
123
  expect(generated_html).to include('<h1>This is an important header')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiculture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-21 00:00:00.000000000 Z
12
+ date: 2019-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mustermann