From f63d5aa6fb02f2a4c990537ec7003322d08b5872 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen <matijs@matijs.net> Date: Mon, 1 Apr 2024 09:41:54 +0200 Subject: [PATCH 1/3] Make minitest support scenario run at least one test Due to how test success is checked, the failure to run at least one test was never noticed. A change in behavior in minitest exposed the problem. See https://github.com/minitest/minitest/pull/986. --- .../supported_testing_frameworks.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/01_getting_started_with_aruba/supported_testing_frameworks.feature b/features/01_getting_started_with_aruba/supported_testing_frameworks.feature index d8074a18f..54582ec7e 100644 --- a/features/01_getting_started_with_aruba/supported_testing_frameworks.feature +++ b/features/01_getting_started_with_aruba/supported_testing_frameworks.feature @@ -72,15 +72,15 @@ Feature: Supported Testing Frameworks include Aruba::Api def setup - aruba_setup + setup_aruba end - def getting_started_with_aruba + def test_getting_started_with_aruba file = 'file.txt' content = 'Hello World' write_file file, content - read(file).must_equal [content] + assert_equal [content], read(file) end end """ From 56795fb439759e088fd54206a915659d435c6757 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen <matijs@matijs.net> Date: Mon, 1 Apr 2024 10:18:51 +0200 Subject: [PATCH 2/3] Fix minitest aruba setup This makes the minitest initializer create a dummy test so - the test code gets exercised on the first run - minitest will output the number of tests run in version 5.22 (see https://github.com/minitest/minitest/pull/986) It also fixes the setup code which was now finally tested and found failing. --- .../06_use_aruba_cli/initialize_project_with_aruba.feature | 2 +- lib/aruba/initializer.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/features/06_use_aruba_cli/initialize_project_with_aruba.feature b/features/06_use_aruba_cli/initialize_project_with_aruba.feature index 33f7d468b..e9bae0f68 100644 --- a/features/06_use_aruba_cli/initialize_project_with_aruba.feature +++ b/features/06_use_aruba_cli/initialize_project_with_aruba.feature @@ -68,7 +68,7 @@ Feature: Initialize project with aruba When I successfully run `ruby -Ilib:test test/use_aruba_with_minitest.rb` Then the output should contain: """ - 0 runs, 0 assertions, 0 failures, 0 errors, 0 skips + 1 runs, 0 assertions, 0 failures, 0 errors, 1 skips """ Scenario: Unknown Test Framework diff --git a/lib/aruba/initializer.rb b/lib/aruba/initializer.rb index 6af2a5230..7df536306 100644 --- a/lib/aruba/initializer.rb +++ b/lib/aruba/initializer.rb @@ -172,7 +172,11 @@ class FirstRun < Minitest::Test include Aruba::Api def setup - aruba_setup + setup_aruba + end + + def test_dummy + skip "Add some real tests here" end end EOS From 45b1a871d4714a79d9f45c8c42ad1fa1404dcc12 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen <matijs@matijs.net> Date: Mon, 1 Apr 2024 10:25:56 +0200 Subject: [PATCH 3/3] Group initializers together This removes some boilerplate closing and reopening of modules. --- lib/aruba/initializer.rb | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/lib/aruba/initializer.rb b/lib/aruba/initializer.rb index 7df536306..b175499eb 100644 --- a/lib/aruba/initializer.rb +++ b/lib/aruba/initializer.rb @@ -7,6 +7,7 @@ module Aruba # # Initialize project with aruba configuration files module Initializers + # # Common initializer # # @private @@ -35,14 +36,9 @@ def add_gem send creator, file, content end end - end -end -# Aruba -module Aruba - # Initializers - module Initializers - # Default Initializer + # + # Failing Initializer # # This handles invalid values for initializer. # @@ -59,14 +55,8 @@ def start(*) end end end - end -end -# Aruba -module Aruba - # Initializer - module Initializers - # Add aruba + rspec to project + # RSpec Initializer. Adds aruba + rspec to project # # @private class RSpecInitializer < Thor::Group @@ -100,14 +90,9 @@ def create_support_file EOS end end - end -end -# Aruba -module Aruba - # Initializer - module Initializers - # Add aruba + aruba to project + # + # Cucumber Initializer. Adds Aruba + Cucumber to project # # @private class CucumberInitializer < Thor::Group @@ -125,14 +110,9 @@ def create_support_file EOS end end - end -end -# Aruba -module Aruba - # Initializer - module Initializers - # Add aruba + minitest to project + # + # Minitest Initializer. Adds Aruba + Minitest to project # # @private class MiniTestInitializer < Thor::Group @@ -183,10 +163,7 @@ def test_dummy end end end -end -# Aruba -module Aruba # The whole initializer # # This one uses the specific initializers to generate the needed files.