td_rspec-api-blueprint-formatter 0.2.0 → 0.3.0

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: 59a8e91cd531a25b3b19452d5dce0beef7f3f22d
4
- data.tar.gz: 49503ca3349755f31f1caf88a65c0c1c175db506
3
+ metadata.gz: 93a86ce777e42ffc18339a18c17a7b428ec7c7ac
4
+ data.tar.gz: efb414481426310828bf7b03f67620f5e121401a
5
5
  SHA512:
6
- metadata.gz: 2933fc8ed8472b06ffd1874537fd4771a2e1f8b0225469cf51d0657772479197db49a6770dda24ebe52ee53e40af5443c7be5f08c9353455e045a50ce4e7cb66
7
- data.tar.gz: 2715f7b0116bad33ef7d8bdc189d812917d60e77cddb683ffc7237d375d36fb4ca8ee56759b081bc9d7007d8cc3538fa8b617e1bb1d769c1579fdc9b3e8e4817
6
+ metadata.gz: 05dcfcf8e404e5619191895750e3af65e77f952d0158e35dfe3c526c08490a68dff7d00f470a373f57418a017efc4a96015e8e0396c36c39476bd51f0789507e
7
+ data.tar.gz: 5bc1d6505dd7daaa6838fa08141bb75c77f7f6c414059919d1cb66f9e4fda0fa06a2de5a10ae885ea3e184869a7f128ca6c91ba8bb9c167be9cc005032be0c3c
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'api_blueprint_formatter'
data/lib/api_blueprint.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'api_blueprint/rspec_formatter'
2
4
 
3
5
  # keeping reference for backwards compatibility
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module APIBlueprint
2
4
  module Configurable
3
5
  def configure
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module APIBlueprint
2
4
  class Configuration
3
5
  attr_accessor :output_source
@@ -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
- metadata[:description].tr('()', '/')
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'.freeze
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(metadata,
40
- passed.example.instance_variable_get(:@example_block),
41
- @example_group_instance.request,
42
- @example_group_instance.response)
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe ApiBlueprint do
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
4
  require 'api_blueprint'
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.2.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: 2016-12-21 00:00:00.000000000 Z
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.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.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.45'
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.45'
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.4.5
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