grape-swagger 0.26.0 → 0.26.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.gitignore +1 -0
- data/.rspec +0 -1
- data/.rubocop.yml +4 -0
- data/.travis.yml +26 -24
- data/CHANGELOG.md +14 -0
- data/Gemfile +3 -5
- data/README.md +9 -85
- data/UPGRADING.md +9 -0
- data/lib/grape-swagger.rb +20 -71
- data/lib/grape-swagger/doc_methods.rb +4 -6
- data/lib/grape-swagger/doc_methods/parse_params.rb +5 -9
- data/lib/grape-swagger/doc_methods/tag_name_description.rb +18 -5
- data/lib/grape-swagger/endpoint.rb +8 -10
- data/lib/grape-swagger/errors.rb +7 -6
- data/lib/grape-swagger/rake/oapi_tasks.rb +5 -1
- data/lib/grape-swagger/version.rb +1 -1
- data/spec/issues/532_allow_custom_format_spec.rb +36 -0
- data/spec/issues/537_enum_values_spec.rb +47 -0
- data/spec/issues/572_array_post_body_spec.rb +49 -0
- data/spec/lib/endpoint_spec.rb +42 -1
- data/spec/lib/extensions_spec.rb +42 -0
- data/spec/lib/oapi_tasks_spec.rb +13 -2
- data/spec/lib/operation_id_spec.rb +1 -5
- data/spec/lib/parse_params_spec.rb +58 -0
- data/spec/lib/tag_name_description_spec.rb +77 -0
- data/spec/lib/version_spec.rb +26 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +1 -77
- data/spec/swagger_v2/description_not_initialized.rb +1 -1
- data/spec/swagger_v2/guarded_endpoint_spec.rb +2 -2
- metadata +16 -9
- data/lib/grape-swagger/markdown/kramdown_adapter.rb +0 -37
- data/lib/grape-swagger/markdown/redcarpet_adapter.rb +0 -92
- data/spec/markdown/kramdown_adapter_spec.rb +0 -31
- data/spec/markdown/redcarpet_adapter_spec.rb +0 -66
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe GrapeSwagger::Markdown::KramdownAdapter do
|
4
|
-
context 'initialization' do
|
5
|
-
it 'uses GFM as default input and disable coderay' do
|
6
|
-
adapter = GrapeSwagger::Markdown::KramdownAdapter.new
|
7
|
-
|
8
|
-
expect(adapter.options).to eq(input: 'GFM', enable_coderay: false)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'overrides default values' do
|
12
|
-
options = { input: 'kramdown', enable_coderay: true }
|
13
|
-
|
14
|
-
adapter = GrapeSwagger::Markdown::KramdownAdapter.new options
|
15
|
-
|
16
|
-
expect(adapter.options).to eq(options)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'markdown' do
|
21
|
-
it 'marks down with the configured options' do
|
22
|
-
text = '# hello world'
|
23
|
-
options = { input: 'GFM', enable_coderay: true, auto_ids: false, hard_wrap: true }
|
24
|
-
expect(GrapeSwagger::Markdown::KramdownAdapter).to receive(:new).with(options).and_call_original
|
25
|
-
|
26
|
-
output = GrapeSwagger::Markdown::KramdownAdapter.new(options).markdown(text)
|
27
|
-
|
28
|
-
expect(output).to include('<h1>hello world</h1>')
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe GrapeSwagger::Markdown::RedcarpetAdapter, unless: RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx') do
|
4
|
-
context 'initialization' do
|
5
|
-
context 'initialization' do
|
6
|
-
it 'uses fenced_code_blocks, auto_links and rouge as default.' do
|
7
|
-
expect_any_instance_of(GrapeSwagger::Markdown::RedcarpetAdapter).to receive(:new_redcarpet_renderer).with(:rouge).and_call_original
|
8
|
-
|
9
|
-
adapter = GrapeSwagger::Markdown::RedcarpetAdapter.new
|
10
|
-
|
11
|
-
expect(adapter.extension_options).to eq(fenced_code_blocks: true, autolink: true)
|
12
|
-
expect(adapter.render_options).to eq({})
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'initializes with no highlighter.' do
|
16
|
-
expect_any_instance_of(GrapeSwagger::Markdown::RedcarpetAdapter).to receive(:new_redcarpet_renderer).with(:none).and_call_original
|
17
|
-
|
18
|
-
adapter = GrapeSwagger::Markdown::RedcarpetAdapter.new render_options: { highlighter: :none }
|
19
|
-
|
20
|
-
expect(adapter.extension_options).to eq(fenced_code_blocks: true, autolink: true)
|
21
|
-
expect(adapter.render_options).to eq({})
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'overrides default values' do
|
25
|
-
extensions = { fenced_code_blocks: true, autolink: true }
|
26
|
-
render_options = { highlighter: :none, no_links: true }
|
27
|
-
|
28
|
-
adapter = GrapeSwagger::Markdown::RedcarpetAdapter.new extensions: extensions, render_options: render_options
|
29
|
-
|
30
|
-
expect(adapter.extension_options).to eq(extensions)
|
31
|
-
expect(adapter.render_options).to eq(no_links: true)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'markdown' do
|
36
|
-
it 'marks down with the configured options' do
|
37
|
-
text = '# hello world #'
|
38
|
-
extensions = { fenced_code_blocks: true, autolink: true }
|
39
|
-
render_options = { highlighter: :none, no_links: true }
|
40
|
-
expect_any_instance_of(Redcarpet::Markdown).to receive(:render).with(text).and_call_original
|
41
|
-
|
42
|
-
output = GrapeSwagger::Markdown::RedcarpetAdapter.new(extensions: extensions, render_options: render_options).markdown(text)
|
43
|
-
|
44
|
-
expect(output).to include('<h1>hello world</h1>')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context 'new_redcarpet_renderer' do
|
49
|
-
it 'returns a rouge syntax highlighter' do
|
50
|
-
adapter = GrapeSwagger::Markdown::RedcarpetAdapter.new
|
51
|
-
renderer = adapter.send(:new_redcarpet_renderer, :rouge)
|
52
|
-
|
53
|
-
expect(renderer).to include(Rouge::Plugins::Redcarpet)
|
54
|
-
expect(renderer.superclass).to be(Redcarpet::Render::HTML)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'returns a default syntax highlighter' do
|
58
|
-
adapter = GrapeSwagger::Markdown::RedcarpetAdapter.new
|
59
|
-
renderer = adapter.send(:new_redcarpet_renderer, :none)
|
60
|
-
|
61
|
-
expect(renderer).to include(GrapeSwagger::Markdown::RedcarpetAdapter::RenderWithoutSyntaxHighlighter)
|
62
|
-
expect(renderer.superclass).to be(Redcarpet::Render::HTML)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|