Skip to content

Commit

Permalink
chore: cleanup test hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros committed May 29, 2024
1 parent f2dedc7 commit 7a6e5d6
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion test/activity_test.rb
Original file line number Diff line number Diff line change
@@ -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"), %{#<Trailblazer::Activity:0x>}
end
Expand Down
2 changes: 1 addition & 1 deletion test/adds_test.rb
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion test/circuit_test.rb
Original file line number Diff line number Diff line change
@@ -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]] }
Expand Down
2 changes: 1 addition & 1 deletion test/deprecation_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class DeprecationTest < Minitest::Spec
class DeprecationTest < Minitest::TrailblazerSpec
it do
caller_location = caller_locations[0]

Expand Down
2 changes: 1 addition & 1 deletion test/docs/activity_test.rb
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/docs/internals_test.rb
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
2 changes: 1 addition & 1 deletion test/intermediate_test.rb
Original file line number Diff line number Diff line change
@@ -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), **)
Expand Down
2 changes: 1 addition & 1 deletion test/introspect_test.rb
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion test/structures_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "test_helper"

class StructuresTest < Minitest::Spec
class StructuresTest < Minitest::TrailblazerSpec
describe "End(semantic)" do
let(:evt) { Activity::End(:meaning) }

Expand Down
2 changes: 1 addition & 1 deletion test/task_adapter_test.rb
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
25 changes: 12 additions & 13 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions test/testing_test.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require "test_helper"

class TestingTest < Minitest::Spec
class TestingTest < Minitest::TrailblazerSpec
extend T.def_steps(:model)

klass = Class.new do
def self.persist
end
end

class Test < Minitest::Spec
class Test < Minitest::TrailblazerSpec
def call
run
@failures
Expand Down
2 changes: 1 addition & 1 deletion test/wrap/task_wrap_test.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions trailblazer-activity.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7a6e5d6

Please sign in to comment.