diff --git a/lib/trailblazer/test.rb b/lib/trailblazer/test.rb index 828096f..296ee15 100644 --- a/lib/trailblazer/test.rb +++ b/lib/trailblazer/test.rb @@ -3,6 +3,10 @@ module Trailblazer module Test # Your code goes here... + + def self.module!(*args, **options, &block) + Assertion.module!(*args, **options, &block) + end end end diff --git a/test/activity_test.rb b/test/activity_test.rb index 6036960..4ee3f19 100644 --- a/test/activity_test.rb +++ b/test/activity_test.rb @@ -3,7 +3,7 @@ # Test all assertions with a FastTrack class, not an Operation. # TODO: This is currently not documented. class AssertionActivityTest < Minitest::Spec - Trailblazer::Test::Assertion.module!(self, activity: true) + Trailblazer::Test.module!(self, activity: true) Memo = Trailblazer::Test::Testing::Memo VALID_INPUT = Memo::VALID_INPUT # {params: {memo: {title: "TODO", content: "Stock up beer"}}} WTF_SUCCESS = %(AssertionActivityTest::Create @@ -73,7 +73,7 @@ class Create < Trailblazer::Activity::FastTrack # Test with the Assertion::Suite "DSL" module. class SuiteWithActivityTest < Minitest::Spec - Trailblazer::Test::Assertion.module!(self, activity: true, suite: true) + Trailblazer::Test.module!(self, activity: true, suite: true) Create = AssertionActivityTest::Create let(:operation) { Create } @@ -107,7 +107,7 @@ class EndpointWithActivityTest < Minitest::Spec Create = AssertionActivityTest::Create Memo = Trailblazer::Test::Testing::Memo - Trailblazer::Test::Assertion.module!(self, activity: true) + Trailblazer::Test.module!(self, activity: true) def self.__(activity, options, **kws, &block) # TODO: move this to endpoint. signal, (ctx, flow_options) = Trailblazer::Endpoint::Runtime.( diff --git a/test/assertion_test.rb b/test/assertion_test.rb index e8d09fd..73b0a70 100644 --- a/test/assertion_test.rb +++ b/test/assertion_test.rb @@ -2,13 +2,13 @@ class AssertionsTest < Minitest::Spec # UNCOMMENT for quick debugging. - # Trailblazer::Test::Assertion.module!(self) + # Trailblazer::Test.module!(self) it "#assert_pass" do # assert_pass? Create, {params: {title: "Somewhere Far Beyond"}}, title: "Somewhere Far Beyond" test = Class.new(Test) do - Trailblazer::Test::Assertion.module!(self) + Trailblazer::Test.module!(self) Memo = Trailblazer::Test::Testing::Memo Create = Memo::Operation::Create @@ -172,7 +172,7 @@ def model(ctx, params:, **) test = Class.new(Test) do - Trailblazer::Test::Assertion.module!(self) + Trailblazer::Test.module!(self) Memo = Trailblazer::Test::Testing::Memo Create = Memo::Operation::Create VALID_INPUT = Memo::VALID_INPUT # {params: {memo: {title: "TODO", content: "Stock up beer"}}} diff --git a/test/docs/assertion_test.rb b/test/docs/assertion_test.rb index 70b30bd..417c395 100644 --- a/test/docs/assertion_test.rb +++ b/test/docs/assertion_test.rb @@ -2,7 +2,7 @@ # Document {Assertion#asserr_pass} and friends. class DocsAssertionTest < Minitest::Spec - Trailblazer::Test::Assertion.module!(self) + Trailblazer::Test.module!(self) Memo = Trailblazer::Test::Testing::Memo @@ -74,7 +74,7 @@ class DocsAssertionTest < Minitest::Spec end class ModelAtTest < Minitest::Spec - Trailblazer::Test::Assertion.module!(self) + Trailblazer::Test.module!(self) module Memo module Operation diff --git a/test/docs/mock_step_test.rb b/test/docs/mock_step_test.rb index f1aa2ac..c7591c7 100644 --- a/test/docs/mock_step_test.rb +++ b/test/docs/mock_step_test.rb @@ -1,7 +1,7 @@ require "test_helper" class MockStepTest < Minitest::Spec - Trailblazer::Test::Assertion.module!(self) + Trailblazer::Test.module!(self) Memo = Module.new diff --git a/test/docs/suite_test.rb b/test/docs/suite_test.rb index 9f0e549..167e190 100644 --- a/test/docs/suite_test.rb +++ b/test/docs/suite_test.rb @@ -4,14 +4,14 @@ # ... class OperationSpec < Minitest::Spec - Trailblazer::Test::Assertion.module!(self, suite: true) + Trailblazer::Test.module!(self, suite: true) end #:operation-spec end # {Memo}, {Memo::Operation::Create} etc is from lib/trailblazer/test/testing.rb. class DocsSuiteAssertionsTest < Minitest::Spec Memo = Trailblazer::Test::Testing::Memo - Trailblazer::Test::Assertion.module!(self, suite: true) + Trailblazer::Test.module!(self, suite: true) Memo::Operation::Update = Class.new(Memo::Operation::Create) @@ -19,7 +19,7 @@ class DocsSuiteAssertionsTest < Minitest::Spec #:install class MemoOperationTest < Minitest::Spec # test/memo/operation_test.rb #~zoom - Trailblazer::Test::Assertion.module!(self, suite: true) + Trailblazer::Test.module!(self, suite: true) #:install end # The default ctx passed into the tested operation. @@ -275,7 +275,7 @@ class Create < Trailblazer::Operation # Test that the Suite module also works with a Minitest::Test class. #:test-suite class MemoCreateTest < Minitest::Test - Trailblazer::Test::Assertion.module!(self, suite: true, spec: false) + Trailblazer::Test.module!(self, suite: true, spec: false) #~skip Memo = Trailblazer::Test::Testing::Memo #~skip end diff --git a/test/suite_test.rb b/test/suite_test.rb index 2745938..2b94b98 100644 --- a/test/suite_test.rb +++ b/test/suite_test.rb @@ -3,7 +3,7 @@ # Brutal unit tests for Suite. class SuiteTest < Minitest::Spec # UNCOMMENT for quick debugging. - # Trailblazer::Test::Assertion.module!(self, suite: true) + # Trailblazer::Test.module!(self, suite: true) # let(:operation) { Trailblazer::Test::Testing::Memo::Operation::Create } # let(:default_ctx) { {params: {memo: {title: "Note to self", content: "Remember me!"}}} } # let(:expected_attributes) { {content: "Remember me!", persisted?: true} } @@ -21,7 +21,7 @@ class SuiteTest < Minitest::Spec # 2. Test result's arity by running assert_pass with a failing OP. # 3. test different manual input vs different expected_attributes to see if all attributes are tested. - Trailblazer::Test::Assertion.module!(self, suite: true) + Trailblazer::Test.module!(self, suite: true) let(:operation) { Memo::Operation::Create } let(:default_ctx) { {params: {memo: {title: "Note to self", content: "Remember me!"}}} } @@ -420,7 +420,7 @@ def model(ctx, params:, **) # Test that the Suite module also works with a Minitest::Test class. # DISCUSS: should we use the above test tactics and test this inside a test with {#assert_test_case_passes} etc? class SuiteInNonSpecTest < Minitest::Test - Trailblazer::Test::Assertion.module!(self, suite: true, spec: false) + Trailblazer::Test.module!(self, suite: true, spec: false) Memo = Trailblazer::Test::Testing::Memo @@ -436,7 +436,7 @@ def test_our_assertions end # class AssertionActivityTest < Minitest::Spec -# Trailblazer::Test::Assertion.module!(self, activity: true) +# Trailblazer::Test.module!(self, activity: true) # Record = Trailblazer::Test::Testing::Memo @@ -468,7 +468,7 @@ def test_our_assertions # # Test with the Assertion::Suite "DSL" module. # class SuiteWithActivityTest < Minitest::Spec -# Trailblazer::Test::Assertion.module!(self, activity: true, suite: true) +# Trailblazer::Test.module!(self, activity: true, suite: true) # # Record = AssertionsTest::Record # # Create = AssertionActivityTest::Create