td_rspec-api-blueprint-formatter 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/bin/console +1 -0
 - data/lib/api_blueprint.rb +2 -0
 - data/lib/api_blueprint/configurable.rb +2 -0
 - data/lib/api_blueprint/configuration.rb +2 -0
 - data/lib/api_blueprint/output_collector.rb +3 -1
 - data/lib/api_blueprint/output_printer.rb +3 -0
 - data/lib/api_blueprint/rspec_formatter.rb +15 -5
 - data/spec/rspec/api/blueprint/formatter_spec.rb +2 -0
 - data/spec/spec_helper.rb +3 -1
 - metadata +9 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 93a86ce777e42ffc18339a18c17a7b428ec7c7ac
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: efb414481426310828bf7b03f67620f5e121401a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 05dcfcf8e404e5619191895750e3af65e77f952d0158e35dfe3c526c08490a68dff7d00f470a373f57418a017efc4a96015e8e0396c36c39476bd51f0789507e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5bc1d6505dd7daaa6838fa08141bb75c77f7f6c414059919d1cb66f9e4fda0fa06a2de5a10ae885ea3e184869a7f128ca6c91ba8bb9c167be9cc005032be0c3c
         
     | 
    
        data/bin/console
    CHANGED
    
    
    
        data/lib/api_blueprint.rb
    CHANGED
    
    
| 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module APIBlueprint
         
     | 
| 
       2 
4 
     | 
    
         
             
              # Collects example for API documentation
         
     | 
| 
       3 
5 
     | 
    
         
             
              class OutputCollector
         
     | 
| 
         @@ -31,7 +33,7 @@ module APIBlueprint 
     | 
|
| 
       31 
33 
     | 
    
         | 
| 
       32 
34 
     | 
    
         
             
                def build_action(example_block, metadata, request, response)
         
     | 
| 
       33 
35 
     | 
    
         
             
                  example_description = metadata[:example_description] ||
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
                                        metadata[:description].tr('()', '/')
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
       36 
38 
     | 
    
         
             
                  {
         
     | 
| 
       37 
39 
     | 
    
         
             
                    description: metadata[:action_description],
         
     | 
| 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            module APIBlueprint
         
     | 
| 
       2 
4 
     | 
    
         
             
              # Prints API blueprint output
         
     | 
| 
       3 
5 
     | 
    
         
             
              class OutputPrinter
         
     | 
| 
         @@ -51,6 +53,7 @@ module APIBlueprint 
     | 
|
| 
       51 
53 
     | 
    
         | 
| 
       52 
54 
     | 
    
         
             
                def validate_resource_name(resource_name)
         
     | 
| 
       53 
55 
     | 
    
         
             
                  return if resource_name =~ %r{^[^\[\]]*\[/[^\]]+\]}
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
       54 
57 
     | 
    
         
             
                  raise "resource: '#{resource_name}' is invalid. :resource needs to be "\
         
     | 
| 
       55 
58 
     | 
    
         
             
                      'specified according to https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md#resource-section'
         
     | 
| 
       56 
59 
     | 
    
         
             
                end
         
     | 
| 
         @@ -1,3 +1,5 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            require 'rspec/core/formatters'
         
     | 
| 
       2 
4 
     | 
    
         
             
            require 'rspec/core/formatters/base_formatter'
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
         @@ -9,7 +11,7 @@ require_relative 'configuration' 
     | 
|
| 
       9 
11 
     | 
    
         
             
            module APIBlueprint
         
     | 
| 
       10 
12 
     | 
    
         
             
              # RSpec formatter for API blueprint
         
     | 
| 
       11 
13 
     | 
    
         
             
              class RspecFormatter < RSpec::Core::Formatters::BaseFormatter
         
     | 
| 
       12 
     | 
    
         
            -
                VERSION = '0.1.0' 
     | 
| 
      
 14 
     | 
    
         
            +
                VERSION = '0.1.0'
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
       14 
16 
     | 
    
         
             
                extend Configurable
         
     | 
| 
       15 
17 
     | 
    
         | 
| 
         @@ -36,10 +38,10 @@ module APIBlueprint 
     | 
|
| 
       36 
38 
     | 
    
         
             
                     metadata[:action_description]
         
     | 
| 
       37 
39 
     | 
    
         | 
| 
       38 
40 
     | 
    
         
             
                    @output_collector
         
     | 
| 
       39 
     | 
    
         
            -
                      .add_example( 
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
                      .add_example(
         
     | 
| 
      
 42 
     | 
    
         
            +
                        metadata, passed.example.instance_variable_get(:@example_block),
         
     | 
| 
      
 43 
     | 
    
         
            +
                        request, response
         
     | 
| 
      
 44 
     | 
    
         
            +
                      )
         
     | 
| 
       43 
45 
     | 
    
         
             
                  end
         
     | 
| 
       44 
46 
     | 
    
         
             
                end
         
     | 
| 
       45 
47 
     | 
    
         | 
| 
         @@ -56,5 +58,13 @@ module APIBlueprint 
     | 
|
| 
       56 
58 
     | 
    
         
             
                def configuration
         
     | 
| 
       57 
59 
     | 
    
         
             
                  self.class.configuration
         
     | 
| 
       58 
60 
     | 
    
         
             
                end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                def request
         
     | 
| 
      
 63 
     | 
    
         
            +
                  @example_group_instance.instance_variable_get('@request')
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                def response
         
     | 
| 
      
 67 
     | 
    
         
            +
                  @example_group_instance.instance_variable_get('@response')
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
       59 
69 
     | 
    
         
             
              end
         
     | 
| 
       60 
70 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: td_rspec-api-blueprint-formatter
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nam Chu Hoai
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-01-02 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rspec
         
     | 
| 
         @@ -16,14 +16,14 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: '3. 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '3.6'
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
24 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: '3. 
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '3.6'
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: bundler
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -58,20 +58,20 @@ dependencies: 
     | 
|
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0.61'
         
     | 
| 
       62 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: '0. 
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0.61'
         
     | 
| 
       69 
69 
     | 
    
         
             
            description: Use your Rspec tests to build your API documentation
         
     | 
| 
       70 
70 
     | 
    
         
             
            email:
         
     | 
| 
       71 
71 
     | 
    
         
             
            - nambrot@googlemail.com
         
     | 
| 
       72 
72 
     | 
    
         
             
            executables:
         
     | 
| 
       73 
     | 
    
         
            -
            - console
         
     | 
| 
       74 
73 
     | 
    
         
             
            - setup
         
     | 
| 
      
 74 
     | 
    
         
            +
            - console
         
     | 
| 
       75 
75 
     | 
    
         
             
            extensions: []
         
     | 
| 
       76 
76 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       77 
77 
     | 
    
         
             
            files:
         
     | 
| 
         @@ -106,10 +106,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       106 
106 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       107 
107 
     | 
    
         
             
            requirements: []
         
     | 
| 
       108 
108 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       109 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 109 
     | 
    
         
            +
            rubygems_version: 2.6.14.1
         
     | 
| 
       110 
110 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       111 
111 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       112 
112 
     | 
    
         
             
            summary: Use your Rspec tests to build your API documentation
         
     | 
| 
       113 
113 
     | 
    
         
             
            test_files:
         
     | 
| 
       114 
     | 
    
         
            -
            - spec/rspec/api/blueprint/formatter_spec.rb
         
     | 
| 
       115 
114 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - spec/rspec/api/blueprint/formatter_spec.rb
         
     |