onlyoffice_tcm_helper 0.3.2 → 1.0.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
  SHA256:
3
- metadata.gz: cc4e2dd6c7b9d47f691caabbdb0893405b75c90a71286e0ed0baf327a5a3f6e3
4
- data.tar.gz: 88652015778c14e331d8dd7fe857cbba357572f0ef5f090da395d5a06357cb70
3
+ metadata.gz: 6d1a4abfb14b26d6407481b9eefdb54133aa7f2f59d4736e6f98ded99b232e3e
4
+ data.tar.gz: bb605ec0a0e5d534775a49e70408f81e3fbdbb07ac75c18a2d0560f93399f3c0
5
5
  SHA512:
6
- metadata.gz: 1ed58205f39d78c73c355ce4032c59010bd523ccd1c89232c55d99ed6d806a11f4de52bd2052bf9f7a6f84cc7400074f25bb4ba96be7e3df2a2f07f53249b0e9
7
- data.tar.gz: 4426f7931f7088156736c836f3316cd7b6ccaf96a1858712f446dc26cede2de44f71651ec34465969cbe96f31b0bbc04d80bacd54849d865e6aa68903c9d9849
6
+ metadata.gz: 88403a96305b3f4da2996a263a27ae04f6614a869a1c8c223c02cdf7d12a25dc019d92dcf7180d4c498813724201ca579be87490dc0eca531cdf67e91c8f6f4d
7
+ data.tar.gz: e7bdb7282768988d0a538cc67b6ab280979207f8951d1051798a0e3d77b770292cdf4a674a1efbce76bcf3514c965599d001457809f1e923ab4f28d5e34d423d
@@ -11,16 +11,23 @@ module OnlyofficeTcmHelper
11
11
  # @param [RSpec::Core::Example] example
12
12
  # @return [String] line value
13
13
  def self.find_failed_line(example)
14
+ dirty_line = find_dirty_line(example)
15
+ line_number = dirty_line[/:\d*:/].delete(':').to_i
16
+ OnlyofficeFileHelper::FileHelper.read_array_from_file(example.metadata[:absolute_file_path])[line_number - 1]
17
+ rescue StandardError => e
18
+ "Cannot find failed line because of exception: #{e}"
19
+ end
20
+
21
+ # Find dirty line in example
22
+ # @param [RSpec::Core::Example] example
23
+ # @return [String] dirty line
24
+ def self.find_dirty_line(example)
14
25
  example_path = example.metadata[:absolute_file_path].downcase
15
- dirty_line = example.exception.backtrace.find do |line|
26
+ example.exception.backtrace.find do |line|
16
27
  next unless (line_path = line[/(.+?):(\d+)(|:\d+)/, 1])
17
28
 
18
29
  File.expand_path(line_path).casecmp(example_path).zero?
19
30
  end
20
- line_number = dirty_line[/:\d*:/].delete(':').to_i
21
- OnlyofficeFileHelper::FileHelper.read_array_from_file(example.metadata[:absolute_file_path])[line_number - 1]
22
- rescue StandardError => e
23
- "Cannot find failed line because of exception: #{e}"
24
31
  end
25
32
  end
26
33
  end
@@ -4,8 +4,8 @@
4
4
  class PseudoExampleAborted < PseudoExample
5
5
  # @return [String] exception string
6
6
  def exception
7
- "undefined local variable or method `tasdasdrue' "\
8
- 'for #<RSpec::ExampleGroups::OnlyofficeTcmHelper::'\
7
+ "undefined local variable or method `tasdasdrue' " \
8
+ 'for #<RSpec::ExampleGroups::OnlyofficeTcmHelper::' \
9
9
  'StatusChecks:0x000000020b8400>'
10
10
  end
11
11
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module OnlyofficeTcmHelper
4
4
  # @return [String] version of gem
5
- VERSION = '0.3.2'
5
+ VERSION = '1.0.0'
6
6
  end
@@ -66,12 +66,7 @@ module OnlyofficeTcmHelper
66
66
  # @return [Symbol] is a symbolic name of test status
67
67
  def get_status_and_comment(example)
68
68
  @status = if result_is_failed?(example)
69
- comment = "\n#{example.exception.to_s
70
- .gsub('got:', "got:\n")
71
- .gsub('expected:', "expected:\n")
72
- .gsub('to return ', "to return:\n")}\n"\
73
- "In line:\n#{RspecHelper.find_failed_line(example)}"
74
- @comment = comment
69
+ @comment = form_failed_comment(example)
75
70
  :failed
76
71
  elsif example.pending?
77
72
  handle_pending(example)
@@ -81,15 +76,8 @@ module OnlyofficeTcmHelper
81
76
  elsif result_is_passed2?(example)
82
77
  @comment = "\nPassed 2"
83
78
  :passed_2
84
- elsif result_is_service_unavailable?(example)
85
- @comment = "\n#{example.exception}"
86
- :service_unavailable
87
- elsif result_is_lpv?(example)
88
- @comment = "\n#{example.exception}"
89
- :lpv
90
79
  else
91
- @comment = "\n#{example.exception}"
92
- :aborted
80
+ handle_other_status(example)
93
81
  end
94
82
  @last_case = @case_name
95
83
  end
@@ -117,5 +105,33 @@ module OnlyofficeTcmHelper
117
105
  def result_is_lpv?(example)
118
106
  example.exception.to_s.include?('Limited program version')
119
107
  end
108
+
109
+ private
110
+
111
+ # Form comment for failed test
112
+ # @param [RSpec::Core::Example] example to parse
113
+ # @return [String] comment
114
+ def form_failed_comment(example)
115
+ failed_line = RspecHelper.find_failed_line(example)
116
+ "\n#{example.exception.to_s
117
+ .gsub('got:', "got:\n")
118
+ .gsub('expected:', "expected:\n")
119
+ .gsub('to return ', "to return:\n")}\n" \
120
+ "In line:\n#{failed_line}"
121
+ end
122
+
123
+ # Handle unavailable, lpv and aborted status
124
+ # @param [RSpec::Core::Example] example to parse
125
+ # @return [Symbol] status
126
+ def handle_other_status(example)
127
+ @comment = "\n#{example.exception}"
128
+ if result_is_service_unavailable?(example)
129
+ :service_unavailable
130
+ elsif result_is_lpv?(example)
131
+ :lpv
132
+ else
133
+ :aborted
134
+ end
135
+ end
120
136
  end
121
137
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onlyoffice_tcm_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ONLYOFFICE
@@ -10,154 +10,22 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-01-15 00:00:00.000000000 Z
13
+ date: 2024-02-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: onlyoffice_file_helper
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - "~>"
27
- - !ruby/object:Gem::Version
28
- version: '0'
29
- - !ruby/object:Gem::Dependency
30
- name: overcommit
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - "~>"
34
- - !ruby/object:Gem::Version
35
- version: '0'
36
- type: :development
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - "~>"
41
- - !ruby/object:Gem::Version
42
- version: '0'
43
- - !ruby/object:Gem::Dependency
44
- name: rake
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '13'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '13'
57
- - !ruby/object:Gem::Dependency
58
- name: rspec
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - "~>"
19
+ - - "<"
62
20
  - !ruby/object:Gem::Version
63
21
  version: '3'
64
- type: :development
22
+ type: :runtime
65
23
  prerelease: false
66
24
  version_requirements: !ruby/object:Gem::Requirement
67
25
  requirements:
68
- - - "~>"
26
+ - - "<"
69
27
  - !ruby/object:Gem::Version
70
28
  version: '3'
71
- - !ruby/object:Gem::Dependency
72
- name: rubocop
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '1'
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - "~>"
83
- - !ruby/object:Gem::Version
84
- version: '1'
85
- - !ruby/object:Gem::Dependency
86
- name: rubocop-performance
87
- requirement: !ruby/object:Gem::Requirement
88
- requirements:
89
- - - "~>"
90
- - !ruby/object:Gem::Version
91
- version: '1'
92
- type: :development
93
- prerelease: false
94
- version_requirements: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - "~>"
97
- - !ruby/object:Gem::Version
98
- version: '1'
99
- - !ruby/object:Gem::Dependency
100
- name: rubocop-rake
101
- requirement: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - "~>"
104
- - !ruby/object:Gem::Version
105
- version: '0'
106
- type: :development
107
- prerelease: false
108
- version_requirements: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - "~>"
111
- - !ruby/object:Gem::Version
112
- version: '0'
113
- - !ruby/object:Gem::Dependency
114
- name: rubocop-rspec
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - "~>"
118
- - !ruby/object:Gem::Version
119
- version: '2'
120
- type: :development
121
- prerelease: false
122
- version_requirements: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - "~>"
125
- - !ruby/object:Gem::Version
126
- version: '2'
127
- - !ruby/object:Gem::Dependency
128
- name: simplecov
129
- requirement: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - "~>"
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - "~>"
139
- - !ruby/object:Gem::Version
140
- version: '0'
141
- - !ruby/object:Gem::Dependency
142
- name: yard
143
- requirement: !ruby/object:Gem::Requirement
144
- requirements:
145
- - - "~>"
146
- - !ruby/object:Gem::Version
147
- version: '0'
148
- - - ">="
149
- - !ruby/object:Gem::Version
150
- version: 0.9.20
151
- type: :development
152
- prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- requirements:
155
- - - "~>"
156
- - !ruby/object:Gem::Version
157
- version: '0'
158
- - - ">="
159
- - !ruby/object:Gem::Version
160
- version: 0.9.20
161
29
  description: It is helper for work with tcm systems, used in QA
162
30
  email:
163
31
  - shockwavenn@gmail.com
@@ -200,14 +68,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
68
  requirements:
201
69
  - - ">="
202
70
  - !ruby/object:Gem::Version
203
- version: '2.5'
71
+ version: '3.0'
204
72
  required_rubygems_version: !ruby/object:Gem::Requirement
205
73
  requirements:
206
74
  - - ">="
207
75
  - !ruby/object:Gem::Version
208
76
  version: '0'
209
77
  requirements: []
210
- rubygems_version: 3.3.4
78
+ rubygems_version: 3.5.5
211
79
  signing_key:
212
80
  specification_version: 4
213
81
  summary: It is helper for work with tcm systems