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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +1 -0
  4. data/.rspec +0 -1
  5. data/.rubocop.yml +4 -0
  6. data/.travis.yml +26 -24
  7. data/CHANGELOG.md +14 -0
  8. data/Gemfile +3 -5
  9. data/README.md +9 -85
  10. data/UPGRADING.md +9 -0
  11. data/lib/grape-swagger.rb +20 -71
  12. data/lib/grape-swagger/doc_methods.rb +4 -6
  13. data/lib/grape-swagger/doc_methods/parse_params.rb +5 -9
  14. data/lib/grape-swagger/doc_methods/tag_name_description.rb +18 -5
  15. data/lib/grape-swagger/endpoint.rb +8 -10
  16. data/lib/grape-swagger/errors.rb +7 -6
  17. data/lib/grape-swagger/rake/oapi_tasks.rb +5 -1
  18. data/lib/grape-swagger/version.rb +1 -1
  19. data/spec/issues/532_allow_custom_format_spec.rb +36 -0
  20. data/spec/issues/537_enum_values_spec.rb +47 -0
  21. data/spec/issues/572_array_post_body_spec.rb +49 -0
  22. data/spec/lib/endpoint_spec.rb +42 -1
  23. data/spec/lib/extensions_spec.rb +42 -0
  24. data/spec/lib/oapi_tasks_spec.rb +13 -2
  25. data/spec/lib/operation_id_spec.rb +1 -5
  26. data/spec/lib/parse_params_spec.rb +58 -0
  27. data/spec/lib/tag_name_description_spec.rb +77 -0
  28. data/spec/lib/version_spec.rb +26 -0
  29. data/spec/spec_helper.rb +11 -0
  30. data/spec/swagger_v2/api_swagger_v2_detail_spec.rb +1 -77
  31. data/spec/swagger_v2/description_not_initialized.rb +1 -1
  32. data/spec/swagger_v2/guarded_endpoint_spec.rb +2 -2
  33. metadata +16 -9
  34. data/lib/grape-swagger/markdown/kramdown_adapter.rb +0 -37
  35. data/lib/grape-swagger/markdown/redcarpet_adapter.rb +0 -92
  36. data/spec/markdown/kramdown_adapter_spec.rb +0 -31
  37. 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