fictium 0.4 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abb23f9ae6488365b514b80f6cc2c23aef50fb4e4d20ffe23183d9b18d562155
4
- data.tar.gz: 3739c58b555069e051f1f932aa7fd446db0eec591e350512ab22706376cfb484
3
+ metadata.gz: c1a54edc49ccfb9c176f88c38fa85b3e082d10e94de2843900f864b12ed9dfa0
4
+ data.tar.gz: 115563764808af6b7b1bb86ac7e07cecdcf2ecb99f178152facb811b64550594
5
5
  SHA512:
6
- metadata.gz: c0eff8c382ebe9954fe1ef600f5fb1ab2ef4cc44fa1f4ca2aa0909359978d4479c9c18b072a93d7f9ddff1d10635b2aba79c532c9f543b26e3f33d57aecc3f8f
7
- data.tar.gz: e52b5936e1b76290b3d09d150c6f7c5668c1d0a9d7ff1fc073e00d599ffa1b633139a59a3a6b25b2e09ed51a9657f02b11ad7f9df0c7a0dd76671fbffd4972c4
6
+ metadata.gz: d72bf0d0cb122fb665c0ea59d02460cea824fa3ad51093cdb8c40a39484f7c077b5b0bde8591eb5ebffdaa5c63e9800eef852b14d6e8d98b17f28a7c283ebdf6
7
+ data.tar.gz: 2d03e36da0f6e8adbd8473951d5c4b5624f3016a2a36f1275cd9208236a5924ec292031e270a738ded4f6eb9b55924a9852b2c818020e1fb41d51532f1dd2eed
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: bug
6
+ assignees: holywyvern
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Rails version (please complete the following information):**
27
+ **Ruby version (please complete the following information):**
28
+ **Fictium version (please complete the following information):**
29
+
30
+ **Additional context**
31
+ Add any other context about the problem here.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: enhancement
6
+ assignees: holywyvern
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
21
+
22
+ **Fictium version you want this feature:**
@@ -17,6 +17,14 @@
17
17
 
18
18
  ## LOG
19
19
 
20
+ ### 0.4.1 (2019-12-18)
21
+
22
+ Allowing to test specific lines.
23
+
24
+ #### Changes
25
+
26
+ - Fictium won't crash anymore when running tests for specific lines.
27
+
20
28
  ### 0.4.0 (2019-11-28)
21
29
 
22
30
  Error messages
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fictium (0.4)
4
+ fictium (0.4.1)
5
5
  activesupport (>= 5.1, < 6.2)
6
6
  json-schema (~> 2.8)
7
7
  verbs (~> 2.1.4)
data/README.md CHANGED
@@ -46,7 +46,7 @@ Fictium is closely tied to RSpec and Rails, but it's developed in a way to suppo
46
46
 
47
47
  The primary goal is for generating OpenAPI Documentation, but, just like with RSpec, future versions may provide other output types.
48
48
 
49
- [Check out the wiki too!](./wiki)
49
+ [Check out the wiki too!](https://github.com/Wolox/fictium/wiki)
50
50
 
51
51
 
52
52
  ### Common terminology of this gem
@@ -10,6 +10,7 @@ module Fictium
10
10
  private
11
11
 
12
12
  def format_request(example)
13
+ return '' if example.request.blank?
13
14
  return '' if example.request[:body].blank?
14
15
 
15
16
  result = request_head(example)
@@ -19,6 +20,8 @@ module Fictium
19
20
  end
20
21
 
21
22
  def format_response(example)
23
+ return '' if example.response.blank?
24
+
22
25
  result = response_head(example)
23
26
  result += parse_http_object(example.response)
24
27
  result
@@ -3,6 +3,8 @@ module Fictium
3
3
  class V3Exporter
4
4
  class PathFormatter
5
5
  def add_path(paths, action)
6
+ return if action.method.blank?
7
+
6
8
  path_object = paths[action.full_path] || default_path_object
7
9
  path_object[action.method.to_sym] = create_operation(action)
8
10
  paths[action.full_path] = path_object
@@ -41,12 +43,16 @@ module Fictium
41
43
 
42
44
  example_formatter.format_default(operation, responses, default_example)
43
45
  other_examples = action.examples.reject { |example| example == default_example }
44
- other_examples.each do |example|
45
- responses[example.response[:status]] = example_formatter.format(example)
46
- end
46
+ other_examples.each { |example| format_example(responses, example) }
47
47
  end
48
48
  end
49
49
 
50
+ def format_example(responses, example)
51
+ return if example.response.blank?
52
+
53
+ responses[example.response[:status]] = example_formatter.format(example)
54
+ end
55
+
50
56
  def example_formatter
51
57
  @example_formatter ||= ExampleFormatter.new
52
58
  end
@@ -3,6 +3,8 @@ module Fictium
3
3
  class V2Exporter
4
4
  class BodyFormatter
5
5
  def format(http_subject, response: false)
6
+ return if http_subject.blank?
7
+
6
8
  body = http_subject[:body]
7
9
  return if body.blank?
8
10
  return body if response
@@ -3,6 +3,8 @@ module Fictium
3
3
  class V2Exporter
4
4
  class HeaderFormatter
5
5
  def format(http_subject)
6
+ return [] if http_subject.blank?
7
+
6
8
  [].tap do |header|
7
9
  content = http_subject[:content_type]
8
10
  header << { key: 'Content-Type', value: content } if content.present?
@@ -29,6 +29,8 @@ module Fictium
29
29
  end
30
30
 
31
31
  def full_path(example)
32
+ return '' if example.request.blank?
33
+
32
34
  "#{api_url}#{convert_path(example.action)}#{query_params_for(example)}"
33
35
  end
34
36
 
@@ -52,6 +54,8 @@ module Fictium
52
54
  end
53
55
 
54
56
  def format_query(example)
57
+ return [] if example.request.blank?
58
+
55
59
  example.request[:query_parameters].map do |key, value|
56
60
  result = { key: key, value: value.to_json }
57
61
  description = example.action[:query][key] && example.action[:query][key][:description]
@@ -61,6 +65,8 @@ module Fictium
61
65
  end
62
66
 
63
67
  def format_variable(example)
68
+ return [] if example.request.blank?
69
+
64
70
  [].tap do |result|
65
71
  example.action[:path].each do |name, _|
66
72
  data = { id: name, key: name }
@@ -72,6 +78,8 @@ module Fictium
72
78
  end
73
79
 
74
80
  def add_optional_values(example, result)
81
+ return if example.request.blank?
82
+
75
83
  body = body_formatter.format(example.request)
76
84
  result[:body] = body if body.present?
77
85
  end
@@ -14,6 +14,8 @@ module Fictium
14
14
  private
15
15
 
16
16
  def base_info_for(example)
17
+ return {} if example.response.blank?
18
+
17
19
  status = example.response[:status]
18
20
  formatted_status = format_status(status, example)
19
21
  {
@@ -1,5 +1,5 @@
1
1
  module Fictium
2
- VERSION = '0.4'.freeze
2
+ VERSION = '0.4.1'.freeze
3
3
  RAILS_MIN_VERSION = '>= 5.1'.freeze
4
4
  RAILS_MAX_VERSION = '< 6.2'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fictium
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramiro Rojo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-28 00:00:00.000000000 Z
11
+ date: 2019-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -240,6 +240,8 @@ extensions: []
240
240
  extra_rdoc_files: []
241
241
  files:
242
242
  - ".codeclimate.yml"
243
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
244
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
243
245
  - ".github/pull_request_template.md"
244
246
  - ".gitignore"
245
247
  - ".rspec"