rainforest-cli 1.6.5 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +8 -0
  4. data/README.md +42 -7
  5. data/bin/rainforest +1 -1
  6. data/lib/{rainforest/cli.rb → rainforest_cli.rb} +23 -15
  7. data/lib/{rainforest/cli → rainforest_cli}/constants.rb +0 -0
  8. data/lib/{rainforest/cli → rainforest_cli}/csv_importer.rb +0 -0
  9. data/lib/{rainforest/cli → rainforest_cli}/deleter.rb +0 -0
  10. data/lib/{rainforest/cli → rainforest_cli}/exporter.rb +0 -0
  11. data/lib/{rainforest/cli → rainforest_cli}/git_trigger.rb +0 -0
  12. data/lib/{rainforest/cli → rainforest_cli}/http_client.rb +5 -4
  13. data/lib/rainforest_cli/junit_outputter.rb +69 -0
  14. data/lib/{rainforest/cli → rainforest_cli}/options.rb +40 -1
  15. data/lib/{rainforest/cli → rainforest_cli}/remote_tests.rb +0 -0
  16. data/lib/rainforest_cli/reporter.rb +64 -0
  17. data/lib/{rainforest/cli → rainforest_cli}/resources.rb +0 -0
  18. data/lib/{rainforest/cli → rainforest_cli}/runner.rb +20 -6
  19. data/lib/{rainforest/cli → rainforest_cli}/test_files.rb +0 -0
  20. data/lib/{rainforest/cli → rainforest_cli}/test_parser.rb +4 -65
  21. data/lib/rainforest_cli/test_parser/embedded_test.rb +14 -0
  22. data/lib/rainforest_cli/test_parser/step.rb +24 -0
  23. data/lib/rainforest_cli/test_parser/test.rb +40 -0
  24. data/lib/{rainforest/cli → rainforest_cli}/uploader.rb +32 -27
  25. data/lib/rainforest_cli/uploader/multi_form_post_request.rb +50 -0
  26. data/lib/rainforest_cli/uploader/uploadable_parser.rb +143 -0
  27. data/lib/{rainforest/cli → rainforest_cli}/validator.rb +0 -0
  28. data/lib/{rainforest/cli → rainforest_cli}/version.rb +1 -1
  29. data/rainforest-cli.gemspec +3 -1
  30. data/spec/fixtures/failed_test_response.json +29 -0
  31. data/spec/fixtures/runs_response.json +275 -0
  32. data/spec/fixtures/tests_response.json +130 -0
  33. data/spec/{csv_importer_spec.rb → rainforest_cli/csv_importer_spec.rb} +7 -14
  34. data/spec/{deleter_spec.rb → rainforest_cli/deleter_spec.rb} +0 -0
  35. data/spec/{exporter_spec.rb → rainforest_cli/exporter_spec.rb} +0 -0
  36. data/spec/{git_trigger_spec.rb → rainforest_cli/git_trigger_spec.rb} +0 -0
  37. data/spec/{http_client_spec.rb → rainforest_cli/http_client_spec.rb} +23 -0
  38. data/spec/rainforest_cli/junit_outputter_spec.rb +32 -0
  39. data/spec/{options_spec.rb → rainforest_cli/options_spec.rb} +33 -0
  40. data/spec/{remote_tests_spec.rb → rainforest_cli/remote_tests_spec.rb} +0 -0
  41. data/spec/rainforest_cli/reporter_spec.rb +51 -0
  42. data/spec/{resources_spec.rb → rainforest_cli/resources_spec.rb} +0 -0
  43. data/spec/{runner_spec.rb → rainforest_cli/runner_spec.rb} +0 -0
  44. data/spec/{test_files_spec.rb → rainforest_cli/test_files_spec.rb} +1 -1
  45. data/spec/rainforest_cli/test_parser/step_spec.rb +53 -0
  46. data/spec/rainforest_cli/test_parser_spec.rb +15 -0
  47. data/spec/rainforest_cli/uploader/uploadable_parser_spec.rb +84 -0
  48. data/spec/{uploader_spec.rb → rainforest_cli/uploader_spec.rb} +2 -2
  49. data/spec/{validator_spec.rb → rainforest_cli/validator_spec.rb} +6 -7
  50. data/spec/{cli_spec.rb → rainforest_cli_spec.rb} +5 -5
  51. data/spec/spec_helper.rb +4 -1
  52. metadata +95 -47
  53. data/.rvmrc +0 -1
  54. data/spec/test_parser_spec.rb +0 -95
@@ -102,7 +102,7 @@ describe RainforestCli do
102
102
 
103
103
  it 'starts the run with the specified tags' do
104
104
  expect_any_instance_of(http_client).to receive(:post)
105
- .with('/runs', { tags: ['run-me'] }, { retries_on_failures: true }).and_return({})
105
+ .with('/runs', { tags: ['run-me'] }, { retries_on_failures: true }).and_return({ 'id' => 123 })
106
106
 
107
107
  start_with_params(params, 0)
108
108
  end
@@ -142,7 +142,7 @@ describe RainforestCli do
142
142
  '/runs',
143
143
  { tests: [], site_id: 3, environment_id: 333 },
144
144
  { retries_on_failures: true }
145
- ).and_return({})
145
+ ).and_return({ 'id' => 123 })
146
146
  described_class.start(params)
147
147
  end
148
148
  end
@@ -158,7 +158,7 @@ describe RainforestCli do
158
158
  '/runs',
159
159
  { tests: [], environment_id: 123 },
160
160
  { retries_on_failures: true }
161
- ).and_return({})
161
+ ).and_return({ 'id' => 123 })
162
162
  described_class.start(params)
163
163
  end
164
164
  end
@@ -171,7 +171,7 @@ describe RainforestCli do
171
171
  '/runs',
172
172
  { smart_folder_id: 123 },
173
173
  { retries_on_failures: true }
174
- ).and_return({})
174
+ ).and_return({ 'id' => 123 })
175
175
  described_class.start(params)
176
176
  end
177
177
  end
@@ -184,7 +184,7 @@ describe RainforestCli do
184
184
  '/runs',
185
185
  { tests: [] },
186
186
  { retries_on_failures: true }
187
- ).and_return({})
187
+ ).and_return({ 'id' => 123 })
188
188
  allow(ENV).to receive(:[]).with('RAINFOREST_API_TOKEN').and_return('x')
189
189
  described_class.start(params)
190
190
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require 'rspec/its'
3
- require 'rainforest/cli'
3
+ require 'rainforest_cli'
4
4
 
5
5
  RainforestCli.logger = Logger.new(StringIO.new)
6
6
 
@@ -15,6 +15,9 @@ RSpec.configure do |config|
15
15
  config.order = 'random'
16
16
 
17
17
  config.before do
18
+ # suppress output in terminal
19
+ allow_any_instance_of(Object).to receive(:puts)
20
+
18
21
  progressbar_mock = double('ProgressBar')
19
22
  allow(ProgressBar).to receive(:create).and_return(progressbar_mock)
20
23
  allow(progressbar_mock).to receive(:increment)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainforest-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.5
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-14 00:00:00.000000000 Z
12
+ date: 2016-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.13.7
28
+ - !ruby/object:Gem::Dependency
29
+ name: mimemagic
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '='
33
+ - !ruby/object:Gem::Version
34
+ version: 0.3.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 0.3.0
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: parallel
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -105,6 +119,20 @@ dependencies:
105
119
  - - ">="
106
120
  - !ruby/object:Gem::Version
107
121
  version: 0.0.4
122
+ - !ruby/object:Gem::Dependency
123
+ name: builder
124
+ requirement: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: '3.2'
129
+ type: :runtime
130
+ prerelease: false
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '3.2'
108
136
  - !ruby/object:Gem::Dependency
109
137
  name: bundler
110
138
  requirement: !ruby/object:Gem::Requirement
@@ -153,7 +181,6 @@ files:
153
181
  - ".rspec"
154
182
  - ".rubocop.yml"
155
183
  - ".ruby-version"
156
- - ".rvmrc"
157
184
  - ".travis.yml"
158
185
  - CHANGELOG.md
159
186
  - Gemfile
@@ -161,32 +188,53 @@ files:
161
188
  - README.md
162
189
  - Rakefile
163
190
  - bin/rainforest
164
- - lib/rainforest/cli.rb
165
- - lib/rainforest/cli/constants.rb
166
- - lib/rainforest/cli/csv_importer.rb
167
- - lib/rainforest/cli/deleter.rb
168
- - lib/rainforest/cli/exporter.rb
169
- - lib/rainforest/cli/git_trigger.rb
170
- - lib/rainforest/cli/http_client.rb
171
- - lib/rainforest/cli/options.rb
172
- - lib/rainforest/cli/remote_tests.rb
173
- - lib/rainforest/cli/resources.rb
174
- - lib/rainforest/cli/runner.rb
175
- - lib/rainforest/cli/test_files.rb
176
- - lib/rainforest/cli/test_parser.rb
177
- - lib/rainforest/cli/uploader.rb
178
- - lib/rainforest/cli/validator.rb
179
- - lib/rainforest/cli/version.rb
191
+ - lib/rainforest_cli.rb
192
+ - lib/rainforest_cli/constants.rb
193
+ - lib/rainforest_cli/csv_importer.rb
194
+ - lib/rainforest_cli/deleter.rb
195
+ - lib/rainforest_cli/exporter.rb
196
+ - lib/rainforest_cli/git_trigger.rb
197
+ - lib/rainforest_cli/http_client.rb
198
+ - lib/rainforest_cli/junit_outputter.rb
199
+ - lib/rainforest_cli/options.rb
200
+ - lib/rainforest_cli/remote_tests.rb
201
+ - lib/rainforest_cli/reporter.rb
202
+ - lib/rainforest_cli/resources.rb
203
+ - lib/rainforest_cli/runner.rb
204
+ - lib/rainforest_cli/test_files.rb
205
+ - lib/rainforest_cli/test_parser.rb
206
+ - lib/rainforest_cli/test_parser/embedded_test.rb
207
+ - lib/rainforest_cli/test_parser/step.rb
208
+ - lib/rainforest_cli/test_parser/test.rb
209
+ - lib/rainforest_cli/uploader.rb
210
+ - lib/rainforest_cli/uploader/multi_form_post_request.rb
211
+ - lib/rainforest_cli/uploader/uploadable_parser.rb
212
+ - lib/rainforest_cli/validator.rb
213
+ - lib/rainforest_cli/version.rb
180
214
  - rainforest-cli.gemspec
181
- - spec/cli_spec.rb
182
- - spec/csv_importer_spec.rb
183
- - spec/deleter_spec.rb
184
- - spec/exporter_spec.rb
215
+ - spec/fixtures/failed_test_response.json
216
+ - spec/fixtures/runs_response.json
217
+ - spec/fixtures/tests_response.json
185
218
  - spec/fixtures/variables.txt
186
- - spec/git_trigger_spec.rb
187
- - spec/http_client_spec.rb
188
- - spec/options_spec.rb
189
219
  - spec/rainforest-example/example_test.rfml
220
+ - spec/rainforest_cli/csv_importer_spec.rb
221
+ - spec/rainforest_cli/deleter_spec.rb
222
+ - spec/rainforest_cli/exporter_spec.rb
223
+ - spec/rainforest_cli/git_trigger_spec.rb
224
+ - spec/rainforest_cli/http_client_spec.rb
225
+ - spec/rainforest_cli/junit_outputter_spec.rb
226
+ - spec/rainforest_cli/options_spec.rb
227
+ - spec/rainforest_cli/remote_tests_spec.rb
228
+ - spec/rainforest_cli/reporter_spec.rb
229
+ - spec/rainforest_cli/resources_spec.rb
230
+ - spec/rainforest_cli/runner_spec.rb
231
+ - spec/rainforest_cli/test_files_spec.rb
232
+ - spec/rainforest_cli/test_parser/step_spec.rb
233
+ - spec/rainforest_cli/test_parser_spec.rb
234
+ - spec/rainforest_cli/uploader/uploadable_parser_spec.rb
235
+ - spec/rainforest_cli/uploader_spec.rb
236
+ - spec/rainforest_cli/validator_spec.rb
237
+ - spec/rainforest_cli_spec.rb
190
238
  - spec/redirection-examples/no_redirect.rfml
191
239
  - spec/redirection-examples/no_redirect_embedded.rfml
192
240
  - spec/redirection-examples/redirect.rfml
@@ -194,13 +242,7 @@ files:
194
242
  - spec/redirection-examples/wrong_redirect.rfml
195
243
  - spec/redirection-examples/wrong_redirect_embedded.rfml
196
244
  - spec/redirection-examples/wrong_redirect_spacing.rfml
197
- - spec/remote_tests_spec.rb
198
- - spec/resources_spec.rb
199
- - spec/runner_spec.rb
200
245
  - spec/spec_helper.rb
201
- - spec/test_files_spec.rb
202
- - spec/test_parser_spec.rb
203
- - spec/uploader_spec.rb
204
246
  - spec/validation-examples/circular_embeds/test1.rfml
205
247
  - spec/validation-examples/circular_embeds/test2.rfml
206
248
  - spec/validation-examples/correct_embeds/embedded_test.rfml
@@ -213,7 +255,6 @@ files:
213
255
  - spec/validation-examples/parse_errors/no_question.rfml
214
256
  - spec/validation-examples/parse_errors/no_question_mark.rfml
215
257
  - spec/validation-examples/parse_errors/no_rfml_id.rfml
216
- - spec/validator_spec.rb
217
258
  homepage: https://www.rainforestqa.com/
218
259
  licenses:
219
260
  - MIT
@@ -239,15 +280,29 @@ signing_key:
239
280
  specification_version: 4
240
281
  summary: Command line utility for Rainforest QA
241
282
  test_files:
242
- - spec/cli_spec.rb
243
- - spec/csv_importer_spec.rb
244
- - spec/deleter_spec.rb
245
- - spec/exporter_spec.rb
283
+ - spec/fixtures/failed_test_response.json
284
+ - spec/fixtures/runs_response.json
285
+ - spec/fixtures/tests_response.json
246
286
  - spec/fixtures/variables.txt
247
- - spec/git_trigger_spec.rb
248
- - spec/http_client_spec.rb
249
- - spec/options_spec.rb
250
287
  - spec/rainforest-example/example_test.rfml
288
+ - spec/rainforest_cli/csv_importer_spec.rb
289
+ - spec/rainforest_cli/deleter_spec.rb
290
+ - spec/rainforest_cli/exporter_spec.rb
291
+ - spec/rainforest_cli/git_trigger_spec.rb
292
+ - spec/rainforest_cli/http_client_spec.rb
293
+ - spec/rainforest_cli/junit_outputter_spec.rb
294
+ - spec/rainforest_cli/options_spec.rb
295
+ - spec/rainforest_cli/remote_tests_spec.rb
296
+ - spec/rainforest_cli/reporter_spec.rb
297
+ - spec/rainforest_cli/resources_spec.rb
298
+ - spec/rainforest_cli/runner_spec.rb
299
+ - spec/rainforest_cli/test_files_spec.rb
300
+ - spec/rainforest_cli/test_parser/step_spec.rb
301
+ - spec/rainforest_cli/test_parser_spec.rb
302
+ - spec/rainforest_cli/uploader/uploadable_parser_spec.rb
303
+ - spec/rainforest_cli/uploader_spec.rb
304
+ - spec/rainforest_cli/validator_spec.rb
305
+ - spec/rainforest_cli_spec.rb
251
306
  - spec/redirection-examples/no_redirect.rfml
252
307
  - spec/redirection-examples/no_redirect_embedded.rfml
253
308
  - spec/redirection-examples/redirect.rfml
@@ -255,13 +310,7 @@ test_files:
255
310
  - spec/redirection-examples/wrong_redirect.rfml
256
311
  - spec/redirection-examples/wrong_redirect_embedded.rfml
257
312
  - spec/redirection-examples/wrong_redirect_spacing.rfml
258
- - spec/remote_tests_spec.rb
259
- - spec/resources_spec.rb
260
- - spec/runner_spec.rb
261
313
  - spec/spec_helper.rb
262
- - spec/test_files_spec.rb
263
- - spec/test_parser_spec.rb
264
- - spec/uploader_spec.rb
265
314
  - spec/validation-examples/circular_embeds/test1.rfml
266
315
  - spec/validation-examples/circular_embeds/test2.rfml
267
316
  - spec/validation-examples/correct_embeds/embedded_test.rfml
@@ -274,5 +323,4 @@ test_files:
274
323
  - spec/validation-examples/parse_errors/no_question.rfml
275
324
  - spec/validation-examples/parse_errors/no_question_mark.rfml
276
325
  - spec/validation-examples/parse_errors/no_rfml_id.rfml
277
- - spec/validator_spec.rb
278
326
  has_rdoc:
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use 2.3.0@rainforest-cli --create
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
- describe RainforestCli::TestParser do
3
- describe RainforestCli::TestParser::Step do
4
- describe '#to_element' do
5
- subject { described_class.new('action', 'response', 'redirect').to_element }
6
- its([:redirection]) { is_expected.to eq('redirect') }
7
-
8
- context 'with no redirect' do
9
- subject { described_class.new('action', 'response', nil).to_element }
10
- its([:redirection]) { is_expected.to eq('true') }
11
- end
12
- end
13
- end
14
-
15
- describe RainforestCli::TestParser::EmbeddedTest do
16
- describe '#to_element' do
17
- let(:primary_key_id) { 123 }
18
- subject { described_class.new.to_element(primary_key_id) }
19
-
20
- context 'with no redirect' do
21
- its([:redirection]) { is_expected.to eq('true') }
22
- end
23
- end
24
- end
25
-
26
- describe RainforestCli::TestParser::Parser do
27
- subject { described_class.new(file_name) }
28
-
29
- describe '#initialize' do
30
- let(:file_name) { './spec/rainforest-example/example_test.rfml' }
31
-
32
- it 'expands the file name path' do
33
- test = subject.instance_variable_get(:@test)
34
- expect(test.file_name).to eq(File.expand_path(file_name))
35
- end
36
- end
37
-
38
- describe '#process' do
39
- context 'redirection' do
40
- context 'step' do
41
- context 'no redirection specified' do
42
- let(:file_name) { File.dirname(__FILE__) + '/rainforest-example/example_test.rfml' }
43
- it { has_redirection_value(subject.process, 'true') }
44
- end
45
-
46
- context 'redirection specified as true' do
47
- let(:file_name) { File.dirname(__FILE__) + '/redirection-examples/redirect.rfml' }
48
- it { has_redirection_value(subject.process, 'true') }
49
- end
50
-
51
- context 'redirection specified as not true or false' do
52
- let(:file_name) { File.dirname(__FILE__) + '/redirection-examples/wrong_redirect.rfml' }
53
- let(:redirect_line_no) { 7 }
54
- it { has_parsing_error(subject.process, redirect_line_no) }
55
- end
56
- end
57
-
58
- context 'embedded test' do
59
- context 'redirection specified as false' do
60
- let(:file_name) { File.dirname(__FILE__) + '/redirection-examples/no_redirect_embedded.rfml' }
61
- it { has_redirection_value(subject.process, 'false') }
62
- end
63
-
64
- context 'redirection specified as true' do
65
- let(:file_name) { File.dirname(__FILE__) + '/redirection-examples/redirect_embedded.rfml' }
66
- it { has_redirection_value(subject.process, 'true') }
67
- end
68
-
69
- context 'redirection specified as not true or false' do
70
- let(:file_name) { File.dirname(__FILE__) + '/redirection-examples/wrong_redirect_embedded.rfml' }
71
- let(:redirect_line_no) { 8 }
72
- it { has_parsing_error(subject.process, redirect_line_no) }
73
- end
74
- end
75
-
76
- context 'poor syntax' do
77
- context 'extra empty lines' do
78
- let(:file_name) { File.dirname(__FILE__) + '/redirection-examples/wrong_redirect_spacing.rfml' }
79
- let(:empty_line_no) { 8 }
80
- it { has_parsing_error(subject.process, empty_line_no) }
81
- end
82
- end
83
-
84
- def has_redirection_value(test, value)
85
- step = test.steps.last
86
- expect(step.redirection).to eq(value)
87
- end
88
-
89
- def has_parsing_error(test, line_no)
90
- expect(test.errors[line_no]).to_not be_nil
91
- end
92
- end
93
- end
94
- end
95
- end