From 7a6e5d62c36974c407736c58b1ac34b609a8c46a Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Wed, 29 May 2024 11:53:08 +0100 Subject: [PATCH] chore: cleanup test hacks --- test/activity_test.rb | 2 +- test/adds_test.rb | 2 +- test/circuit_test.rb | 2 +- test/deprecation_test.rb | 2 +- test/docs/activity_test.rb | 2 +- test/docs/internals_test.rb | 2 +- test/intermediate_test.rb | 2 +- test/introspect_test.rb | 2 +- test/structures_test.rb | 2 +- test/task_adapter_test.rb | 2 +- test/test_helper.rb | 25 ++++++++++++------------- test/testing_test.rb | 4 ++-- test/wrap/task_wrap_test.rb | 2 +- trailblazer-activity.gemspec | 1 + 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/test/activity_test.rb b/test/activity_test.rb index 84fbc6a..2cdbd45 100644 --- a/test/activity_test.rb +++ b/test/activity_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class ActivityTest < Minitest::Spec +class ActivityTest < Minitest::TrailblazerSpec it "provides {#inspect}" do assert_equal Trailblazer::Activity.new({}).inspect.gsub(/0x\w+/, "0x"), %{#} end diff --git a/test/adds_test.rb b/test/adds_test.rb index 93fb1b5..1bc2451 100644 --- a/test/adds_test.rb +++ b/test/adds_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class AddsTest < Minitest::Spec +class AddsTest < Minitest::TrailblazerSpec # DISCUSS: not tested here is Append to empty Pipeline because we always initialize it. let(:pipeline) { Trailblazer::Activity::TaskWrap::Pipeline } let(:adds) { Trailblazer::Activity::Adds } diff --git a/test/circuit_test.rb b/test/circuit_test.rb index d89d25d..9401763 100644 --- a/test/circuit_test.rb +++ b/test/circuit_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class CircuitTest < Minitest::Spec +class CircuitTest < Minitest::TrailblazerSpec Start = ->((options, *args), *_circuit_options) { options[:start] = 1; ["to a", [options, *args]] } A = ->((options, *args), *_circuit_options) { options[:a] = 2; ["from a", [options, *args]] } B = ->((options, *args), *_circuit_options) { options[:b] = 3; ["from b", [options, *args]] } diff --git a/test/deprecation_test.rb b/test/deprecation_test.rb index b9911af..d95f2ff 100644 --- a/test/deprecation_test.rb +++ b/test/deprecation_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class DeprecationTest < Minitest::Spec +class DeprecationTest < Minitest::TrailblazerSpec it do caller_location = caller_locations[0] diff --git a/test/docs/activity_test.rb b/test/docs/activity_test.rb index 93f9f7b..e54e66d 100644 --- a/test/docs/activity_test.rb +++ b/test/docs/activity_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class DocsIntermediateTest < Minitest::Spec +class DocsIntermediateTest < Minitest::TrailblazerSpec it do #:int Intermediate = Trailblazer::Activity::Schema::Intermediate # shortcut alias. diff --git a/test/docs/internals_test.rb b/test/docs/internals_test.rb index 1e5d806..672515b 100644 --- a/test/docs/internals_test.rb +++ b/test/docs/internals_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class DocInternalsTest < Minitest::Spec +class DocInternalsTest < Minitest::TrailblazerSpec #:method def outdated_method Trailblazer::Activity::Deprecate.warn caller_locations[0], "The `#outdated_method` is deprecated." diff --git a/test/intermediate_test.rb b/test/intermediate_test.rb index 09dc327..b39bf95 100644 --- a/test/intermediate_test.rb +++ b/test/intermediate_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class IntermediateTest < Minitest::Spec +class IntermediateTest < Minitest::TrailblazerSpec # Example task that doesn't return standard binary signals but # {"b/success"} etc. def self.b_task((ctx, flow_options), **) diff --git a/test/introspect_test.rb b/test/introspect_test.rb index 19bfc52..1467e80 100644 --- a/test/introspect_test.rb +++ b/test/introspect_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class IntrospectionTest < Minitest::Spec +class IntrospectionTest < Minitest::TrailblazerSpec describe "Introspect.find_path" do it "#find_path" do b_activity = nested_activity() # [B, [B, C], E] diff --git a/test/structures_test.rb b/test/structures_test.rb index c4d5cde..8577f6d 100644 --- a/test/structures_test.rb +++ b/test/structures_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class StructuresTest < Minitest::Spec +class StructuresTest < Minitest::TrailblazerSpec describe "End(semantic)" do let(:evt) { Activity::End(:meaning) } diff --git a/test/task_adapter_test.rb b/test/task_adapter_test.rb index ec236d3..f2ce359 100644 --- a/test/task_adapter_test.rb +++ b/test/task_adapter_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class TaskAdapterTest < Minitest::Spec +class TaskAdapterTest < Minitest::TrailblazerSpec class Operation def process_type(ctx, model:, **) return if model.nil? diff --git a/test/test_helper.rb b/test/test_helper.rb index 31cc72e..a1c5f3a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,22 +1,21 @@ require "pp" require "trailblazer-activity" require "minitest/autorun" +require "minitest-trailblazer" +require "minitest/trailblazer_spec" -Minitest::Spec.class_eval do - def assert_equal(asserted, expected, *args) - super(expected, asserted, *args) - end +module Minitest + class TrailblazerSpec + include Trailblazer::AssertionsOverride + require "trailblazer/activity/testing" + include ::Trailblazer::Activity::Testing::Assertions + require_relative "fixtures" + include Fixtures - require "trailblazer/activity/testing" - include Trailblazer::Activity::Testing::Assertions + Spec::Activity = ::Trailblazer::Activity + Spec::Implementing = Fixtures::Implementing + end end T = Trailblazer::Activity::Testing -require "fixtures" -Minitest::Spec::Activity = Trailblazer::Activity -Minitest::Spec::Implementing = Fixtures::Implementing - -Minitest::Spec.class_eval do - include Fixtures -end diff --git a/test/testing_test.rb b/test/testing_test.rb index c41a621..b2e3554 100644 --- a/test/testing_test.rb +++ b/test/testing_test.rb @@ -1,6 +1,6 @@ require "test_helper" -class TestingTest < Minitest::Spec +class TestingTest < Minitest::TrailblazerSpec extend T.def_steps(:model) klass = Class.new do @@ -8,7 +8,7 @@ def self.persist end end - class Test < Minitest::Spec + class Test < Minitest::TrailblazerSpec def call run @failures diff --git a/test/wrap/task_wrap_test.rb b/test/wrap/task_wrap_test.rb index b67b89f..44840ed 100644 --- a/test/wrap/task_wrap_test.rb +++ b/test/wrap/task_wrap_test.rb @@ -1,7 +1,7 @@ require "test_helper" # Test taskWrap concepts along with {Instance}s. -class TaskWrapTest < Minitest::Spec +class TaskWrapTest < Minitest::TrailblazerSpec def add_1(wrap_ctx, original_args) ctx, = original_args[0] ctx[:seq] << 1 diff --git a/trailblazer-activity.gemspec b/trailblazer-activity.gemspec index 6fb8d7e..64ba55a 100644 --- a/trailblazer-activity.gemspec +++ b/trailblazer-activity.gemspec @@ -24,6 +24,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "minitest", "~> 5.0" spec.add_development_dependency "minitest-line" spec.add_development_dependency "rake" + spec.add_development_dependency "minitest-trailblazer" spec.required_ruby_version = '>= 2.1.0' end