ruby_raider 3.4.0 → 3.6.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -2
  3. data/RELEASE.md +18 -0
  4. data/lib/generators/common_generator.rb +2 -0
  5. data/lib/generators/cucumber/templates/cucumber.tt +1 -1
  6. data/lib/generators/cucumber/templates/partials/appium_env.tt +10 -5
  7. data/lib/generators/cucumber/templates/partials/selenium_env.tt +9 -5
  8. data/lib/generators/cucumber/templates/partials/watir_env.tt +9 -5
  9. data/lib/generators/generator.rb +9 -0
  10. data/lib/generators/helper_generator.rb +2 -0
  11. data/lib/generators/infrastructure/azure_generator.rb +11 -0
  12. data/lib/generators/infrastructure/github_generator.rb +2 -2
  13. data/lib/generators/infrastructure/templates/azure_pipelines.tt +44 -0
  14. data/lib/generators/infrastructure/templates/github.tt +4 -7
  15. data/lib/generators/infrastructure/templates/github_appium.tt +0 -6
  16. data/lib/generators/invoke_generators.rb +19 -1
  17. data/lib/generators/menu_generator.rb +16 -6
  18. data/lib/generators/templates/common/gemfile.tt +2 -4
  19. data/lib/generators/templates/common/git_ignore.tt +3 -1
  20. data/lib/generators/templates/common/read_me.tt +27 -1
  21. data/lib/ruby_raider.rb +8 -1
  22. data/lib/version +1 -1
  23. data/sig/generators/generator.rbs +2 -0
  24. data/sig/generators/infrastructure/azure_generator.rbs +4 -0
  25. data/sig/generators/invoke_generators.rbs +5 -0
  26. data/sig/generators/menu_generator.rbs +2 -1
  27. data/sig/ruby_raider.rbs +1 -0
  28. data/spec/integration/content/azure_content_spec.rb +109 -0
  29. data/spec/integration/content/ci_content_spec.rb +24 -24
  30. data/spec/integration/content/common_content_spec.rb +4 -4
  31. data/spec/integration/content/cucumber_reporter_content_spec.rb +64 -0
  32. data/spec/integration/content/gemfile_content_spec.rb +7 -7
  33. data/spec/integration/content/helper_content_spec.rb +2 -6
  34. data/spec/integration/content/readme_content_spec.rb +13 -3
  35. data/spec/integration/content/test_content_spec.rb +4 -0
  36. data/spec/integration/end_to_end_spec.rb +171 -3
  37. data/spec/integration/generators/azure_generator_spec.rb +100 -0
  38. data/spec/integration/generators/helpers_generator_spec.rb +6 -3
  39. data/spec/menus/menu_generator_spec.rb +49 -0
  40. metadata +8 -2
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+ require 'yaml'
5
+ require_relative '../../../lib/generators/infrastructure/azure_generator'
6
+ require_relative '../spec_helper'
7
+
8
+ describe AzureGenerator do
9
+ mobile_notice = "Azure Pipelines template for mobile projects is not available yet; see the README.\n"
10
+ web = FRAMEWORKS.product(%w[selenium watir], [false, true])
11
+ mobile = FRAMEWORKS.product(%w[ios android cross_platform])
12
+
13
+ after(:all) do # rubocop:disable RSpec/BeforeAfterAll
14
+ FileUtils.rm_rf(Dir.glob('azure_*'))
15
+ FileUtils.rm_rf(Dir.glob('plain_*'))
16
+ FileUtils.rm_rf(Dir.glob('ghci_*'))
17
+ end
18
+
19
+ web.each do |framework, automation, axe|
20
+ context "with ci azure, #{framework}, #{automation}#{', axe' if axe}" do
21
+ let(:name) { "azure_#{framework}_#{automation}#{'_axe' if axe}" }
22
+
23
+ before do
24
+ next if File.exist?(name)
25
+
26
+ InvokeGenerators.generate_framework(automation:, framework:, name:, accessibility: axe, ci: 'azure')
27
+ end
28
+
29
+ it 'creates azure-pipelines.yml and no .github directory' do
30
+ expect(File).to exist("#{name}/azure-pipelines.yml")
31
+ expect(File).not_to exist("#{name}/.github")
32
+ end
33
+
34
+ it 'is parseable YAML' do
35
+ expect { YAML.safe_load_file("#{name}/azure-pipelines.yml") }.not_to raise_error
36
+ end
37
+ end
38
+ end
39
+
40
+ mobile.each do |framework, automation|
41
+ context "with ci azure, #{framework}, #{automation}" do
42
+ let(:name) { "azure_#{framework}_#{automation}" }
43
+
44
+ it 'generates no pipeline, no .github and prints the notice' do
45
+ expect do
46
+ InvokeGenerators.generate_framework(automation:, framework:, name:, ci: 'azure')
47
+ end.to output(/#{Regexp.escape(mobile_notice)}/).to_stdout
48
+ expect(File).not_to exist("#{name}/azure-pipelines.yml")
49
+ expect(File).not_to exist("#{name}/.github")
50
+ end
51
+ end
52
+ end
53
+
54
+ context 'with the default ci and ci github' do
55
+ it 'generates GitHub files and no azure-pipelines.yml' do
56
+ InvokeGenerators.generate_framework(automation: 'selenium', framework: 'rspec', name: 'plain_default')
57
+ InvokeGenerators.generate_framework(automation: 'selenium', framework: 'rspec', name: 'ghci_github', ci: 'github')
58
+ %w[plain_default ghci_github].each do |name|
59
+ expect(File).to exist("#{name}/.github/workflows/test_pipeline.yml")
60
+ expect(File).not_to exist("#{name}/azure-pipelines.yml")
61
+ end
62
+ end
63
+ end
64
+
65
+ context 'with an invalid ci' do
66
+ it 'raises an ArgumentError and generates nothing' do
67
+ expect do
68
+ InvokeGenerators.generate_framework(automation: 'selenium', framework: 'rspec', name: 'azure_bad', ci: 'gitlab')
69
+ end.to raise_error(ArgumentError, 'ci must be github or azure')
70
+ expect(File).not_to exist('azure_bad')
71
+ end
72
+ end
73
+
74
+ context 'with raider new and ci:gitlab' do
75
+ it 'prints the error, generates nothing and exits non-zero' do
76
+ root = File.expand_path('../../..', __dir__)
77
+ out = IO.popen(['ruby', "#{root}/bin/raider", 'new', 'azure_cli_bad', '-p', 'framework:rspec',
78
+ 'automation:selenium', 'ci:gitlab', { err: %i[child out] }], &:read)
79
+ expect($CHILD_STATUS.exitstatus).not_to eq(0)
80
+ expect(out).to include('Invalid parameters: ci must be github or azure')
81
+ expect(File).not_to exist('azure_cli_bad')
82
+ end
83
+ end
84
+
85
+ context 'with a project named azure' do
86
+ after { FileUtils.rm_rf(%w[azure azure_named_ci]) }
87
+
88
+ it 'generates the GitHub workflow with the default ci' do
89
+ InvokeGenerators.generate_framework(automation: 'selenium', framework: 'rspec', name: 'azure')
90
+ expect(File).to exist('azure/.github/workflows')
91
+ expect(File).not_to exist('azure/azure-pipelines.yml')
92
+ end
93
+
94
+ it 'generates the Azure pipeline with ci azure' do
95
+ InvokeGenerators.generate_framework(automation: 'selenium', framework: 'rspec', name: 'azure', ci: 'azure')
96
+ expect(File).to exist('azure/azure-pipelines.yml')
97
+ expect(File).not_to exist('azure/.github')
98
+ end
99
+ end
100
+ end
@@ -5,8 +5,12 @@ require_relative '../spec_helper'
5
5
 
6
6
  describe HelpersGenerator do
7
7
  shared_examples 'creates common helpers' do |name|
8
- it 'creates an allure helper file' do
9
- expect(File).to exist("#{name}/helpers/allure_helper.rb")
8
+ it 'creates an allure helper file only for rspec projects' do
9
+ if name.start_with?(FrameworkIndex::CUCUMBER)
10
+ expect(File).not_to exist("#{name}/helpers/allure_helper.rb")
11
+ else
12
+ expect(File).to exist("#{name}/helpers/allure_helper.rb")
13
+ end
10
14
  end
11
15
  end
12
16
 
@@ -101,5 +105,4 @@ describe HelpersGenerator do
101
105
  include_examples 'creates cucumber helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
102
106
  include_examples 'creates cross platform helpers', "#{FrameworkIndex::CUCUMBER}_#{AutomationIndex::CROSS_PLATFORM}"
103
107
  end
104
-
105
108
  end
@@ -157,4 +157,53 @@ RSpec.describe MenuGenerator do
157
157
  )
158
158
  end
159
159
  end
160
+
161
+ describe 'CI provider question' do
162
+ let(:menu) { double('menu') } # rubocop:disable RSpec/VerifiedDoubles
163
+
164
+ before do
165
+ allow(menu).to receive(:choice)
166
+ allow(menu_generator).to receive(:generate_framework)
167
+ allow(menu_generator).to receive(:system)
168
+ allow(prompt).to receive(:say)
169
+ allow(prompt).to receive(:yes?).and_return(false)
170
+ end
171
+
172
+ it 'is asked after accessibility for web automations' do
173
+ allow(prompt).to receive(:select).with('Which CI provider?').and_yield(menu)
174
+
175
+ menu_generator.send(:select_ci, 'Rspec', 'selenium', accessibility: false)
176
+
177
+ expect(menu).to have_received(:choice).with('GitHub Actions', anything)
178
+ expect(menu).to have_received(:choice).with('Azure Pipelines', anything)
179
+ expect(menu).to have_received(:choice).with(:Quit, anything)
180
+ end
181
+
182
+ it 'follows the accessibility answer' do
183
+ allow(prompt).to receive(:select).with('Add accessibility testing (axe)?').and_yield(menu)
184
+ allow(menu).to receive(:choice).with(:No, anything) { |_, action| action.call }
185
+ allow(menu_generator).to receive(:select_ci)
186
+
187
+ menu_generator.send(:select_accessibility, 'Rspec', 'selenium')
188
+
189
+ expect(menu_generator).to have_received(:select_ci).with('Rspec', 'selenium', accessibility: false)
190
+ end
191
+
192
+ it 'is skipped for mobile' do
193
+ allow(prompt).to receive(:select)
194
+
195
+ menu_generator.send(:select_accessibility, 'Rspec', 'ios')
196
+
197
+ expect(prompt).not_to have_received(:select)
198
+ expect(menu_generator).to have_received(:generate_framework).with(hash_including(automation: 'ios'))
199
+ end
200
+
201
+ it 'passes ci azure through to generate_framework' do
202
+ menu_generator.send(:create_framework, 'Rspec', 'selenium', ci_provider: 'azure')
203
+
204
+ expect(menu_generator).to have_received(:generate_framework).with(
205
+ hash_including(automation: 'selenium', ci: 'azure')
206
+ )
207
+ end
208
+ end
160
209
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_raider
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-10-11 00:00:00.000000000 Z
10
+ date: 2026-10-12 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -208,7 +208,9 @@ files:
208
208
  - lib/generators/cucumber/templates/world.tt
209
209
  - lib/generators/generator.rb
210
210
  - lib/generators/helper_generator.rb
211
+ - lib/generators/infrastructure/azure_generator.rb
211
212
  - lib/generators/infrastructure/github_generator.rb
213
+ - lib/generators/infrastructure/templates/azure_pipelines.tt
212
214
  - lib/generators/infrastructure/templates/github.tt
213
215
  - lib/generators/infrastructure/templates/github_appium.tt
214
216
  - lib/generators/invoke_generators.rb
@@ -276,6 +278,7 @@ files:
276
278
  - sig/generators/cucumber/cucumber_generator.rbs
277
279
  - sig/generators/generator.rbs
278
280
  - sig/generators/helper_generator.rbs
281
+ - sig/generators/infrastructure/azure_generator.rbs
279
282
  - sig/generators/infrastructure/github_generator.rbs
280
283
  - sig/generators/invoke_generators.rbs
281
284
  - sig/generators/menu_generator.rbs
@@ -302,10 +305,12 @@ files:
302
305
  - spec/integration/commands/browser_update_after_creation_spec.rb
303
306
  - spec/integration/commands/scaffolding_commands_spec.rb
304
307
  - spec/integration/commands/utility_commands_spec.rb
308
+ - spec/integration/content/azure_content_spec.rb
305
309
  - spec/integration/content/ci_content_spec.rb
306
310
  - spec/integration/content/common_content_spec.rb
307
311
  - spec/integration/content/config_content_spec.rb
308
312
  - spec/integration/content/content_helper.rb
313
+ - spec/integration/content/cucumber_reporter_content_spec.rb
309
314
  - spec/integration/content/gemfile_content_spec.rb
310
315
  - spec/integration/content/helper_content_spec.rb
311
316
  - spec/integration/content/page_content_spec.rb
@@ -316,6 +321,7 @@ files:
316
321
  - spec/integration/end_to_end_spec.rb
317
322
  - spec/integration/generators/automation_generator_spec.rb
318
323
  - spec/integration/generators/axe_addon_spec.rb
324
+ - spec/integration/generators/azure_generator_spec.rb
319
325
  - spec/integration/generators/common_generator_spec.rb
320
326
  - spec/integration/generators/config_features_spec.rb
321
327
  - spec/integration/generators/cucumber_generator_spec.rb