diff --git a/test/docs/autogenerated/operation_each_test.rb b/test/docs/autogenerated/operation_each_test.rb index 7d841e3..33b5adc 100644 --- a/test/docs/autogenerated/operation_each_test.rb +++ b/test/docs/autogenerated/operation_each_test.rb @@ -190,6 +190,7 @@ def notify_composers(ctx, index:, composer:, **) it "{item_key: :composer}" do E::Mailer.send_options = [] + assert_invoke E::Song::Operation::Cover, params: {id: 1}, expected_ctx_variables: { model: B::Song.find_by(id: 1), @@ -287,6 +288,7 @@ def composers_for_each(ctx, model:, **) it "Each(Activity::Railway)" do D::Mailer.send_options = [] + assert_invoke D::Song::Operation::Cover, params: {id: 1}, seq: "[:rearrange]", expected_ctx_variables: { diff --git a/test/docs/autogenerated/operation_model_test.rb b/test/docs/autogenerated/operation_model_test.rb index 5076af1..08c7a9c 100644 --- a/test/docs/autogenerated/operation_model_test.rb +++ b/test/docs/autogenerated/operation_model_test.rb @@ -113,6 +113,7 @@ class Update < Trailblazer::Operation it do #:key-title-fail result = Song::Operation::Update.(params: {title: nil}, seq: []) + assert_equal result[:model].inspect, %{nil} #:key-title-fail end end @@ -204,6 +205,7 @@ class Create < Trailblazer::Operation it do result = Song::Operation::Create.(params: {}, :"model.class" => Hit, seq: []) + assert_equal result[:model].inspect, %{#} end end @@ -224,15 +226,16 @@ class Create < Trailblazer::Operation #:in end result = Song::Operation::Create.(params: {}, my_id: 1, :"model.class" => Hit) + assert_equal result[:model].inspect, %{#} =begin #:in-call result = Create.(my_id: 1) #:in-call end =end - end end end +end class Model404TerminusTest < Minitest::Spec Song = Class.new(DocsModelTest::Song) diff --git a/test/docs/each_test.rb b/test/docs/each_test.rb index c0ba1a7..4665ba0 100644 --- a/test/docs/each_test.rb +++ b/test/docs/each_test.rb @@ -191,6 +191,7 @@ def notify_composers(ctx, index:, composer:, **) it "{item_key: :composer}" do E::Mailer.send_options = [] + assert_invoke E::Song::Activity::Cover, params: {id: 1}, expected_ctx_variables: { model: B::Song.find_by(id: 1), @@ -288,6 +289,7 @@ def composers_for_each(ctx, model:, **) it "Each(Activity::Railway)" do D::Mailer.send_options = [] + assert_invoke D::Song::Activity::Cover, params: {id: 1}, seq: "[:rearrange]", expected_ctx_variables: { @@ -789,6 +791,7 @@ def self.block # signal, (_ctx, _) = Trailblazer::Activity::TaskWrap.invoke(activity, [ctx]) signal, (_ctx, _) = Trailblazer::Developer.wtf?(activity, [ctx], exec_context: my_exec_context) + assert_equal _ctx[:collected_from_each], ["1-0", "2-1", "3-2"] end @@ -826,6 +829,7 @@ def compute_item_with_current_user(ctx, item:, index:, current_user:, **) }, {}] ) + assert_invoke activity, dataset: ["one", "two", "three"], current_user: Object, expected_ctx_variables: {collected_from_each: ["one-0-Object", "two-1-Object", "three-2-Object"]} end @@ -901,6 +905,7 @@ def check(ctx, item:, **) #@ fail at 3 but still collect 3rd iteration! Trailblazer::Developer.wtf?(activity, [{dataset: [1,2,3]}, {}]) + assert_invoke activity, dataset: [1,2,3], expected_ctx_variables: {collected_from_each: ["1", "2", "3"]}, seq: "[]", diff --git a/test/docs/guard_test.rb b/test/docs/guard_test.rb index 643a751..ba94f11 100644 --- a/test/docs/guard_test.rb +++ b/test/docs/guard_test.rb @@ -17,11 +17,12 @@ def process(options, **) #:proc end it { Create.(pass: false)[:x].must_be_nil } - it { Create.(pass: true)[:x].must_equal true } + + it { assert_equal Create.(pass: true)[:x], true } #- result object, guard - it { Create.(pass: true)[:"result.policy.default"].success?.must_equal true } - it { Create.(pass: false)[:"result.policy.default"].success?.must_equal false } + it { assert_equal Create.(pass: true)[:"result.policy.default"].success?, true } + it { assert_equal Create.(pass: false)[:"result.policy.default"].success?, false } #--- #- Guard inheritance @@ -29,7 +30,7 @@ class New < Create step Policy::Guard( ->(options, current_user:, **) { current_user } ), override: true end - it { Trailblazer::Developer.railway(New).must_equal %{[>policy.default.eval,>process]} } + it { assert_equal Trailblazer::Developer.railway(New), %{[>policy.default.eval,>process]} } end #--- @@ -59,7 +60,8 @@ def process(options, **) #:callable-op end it { Create.(pass: false)[:x].must_be_nil } - it { Create.(pass: true)[:x].must_equal true } + + it { assert_equal Create.(pass: true)[:x], true } end #--- @@ -83,8 +85,8 @@ def process(options, **) end #:method end - it { Create.(pass: false).inspect(:x).must_equal %{} } - it { Create.(pass: true).inspect(:x).must_equal %{} } + it { assert_equal Create.(pass: false).inspect(:x), %{} } + it { assert_equal Create.(pass: true).inspect(:x), %{} } end #--- @@ -97,8 +99,8 @@ class Create < Trailblazer::Operation end #:name end - it { Create.(:current_user => nil )[:"result.policy.user"].success?.must_equal false } - it { Create.(:current_user => Module)[:"result.policy.user"].success?.must_equal true } + it { assert_equal Create.(:current_user => nil )[:"result.policy.user"].success?, false } + it { assert_equal Create.(:current_user => Module)[:"result.policy.user"].success?, true } it { #:name-result @@ -117,7 +119,7 @@ class Create < Trailblazer::Operation end #:di-op end - it { Create.(:current_user => Module).inspect("").must_equal %{} } + it { assert_equal Create.(:current_user => Module).inspect(""), %{} } it { result = #:di-call @@ -126,7 +128,7 @@ class Create < Trailblazer::Operation :"policy.default.eval" => Trailblazer::Operation::Policy::Guard.build(->(options, **) { false }) ) #:di-call end - result.inspect("").must_equal %{} } + assert_equal result.inspect(""), %{} } end #--- @@ -137,7 +139,7 @@ class Create < Trailblazer::Operation end it { assert_raises(ArgumentError) { Create.() } } - it { Create.(:current_user => Module).success?.must_equal true } + it { assert_equal Create.(:current_user => Module).success?, true } end #--- @@ -151,7 +153,7 @@ class Create < Trailblazer::Operation end #:before end - it { Trailblazer::Developer.railway(Create).must_equal %{[>policy.default.eval,>model!]} } + it { assert_equal Trailblazer::Developer.railway(Create), %{[>policy.default.eval,>model!]} } it do #:before-pipe Trailblazer::Developer.railway(Create, style: :rows) #=> diff --git a/test/docs/macro_test.rb b/test/docs/macro_test.rb index 8660bd9..212e842 100644 --- a/test/docs/macro_test.rb +++ b/test/docs/macro_test.rb @@ -28,7 +28,7 @@ class Create < Trailblazer::Operation end =end - it { Trailblazer::Developer.railway(Create).must_equal %{[>my_policy.manager]} } + it { assert_equal Trailblazer::Developer.railway(Create), %{[>my_policy.manager]} } end diff --git a/test/docs/model_test.rb b/test/docs/model_test.rb index 625590c..219fbdc 100644 --- a/test/docs/model_test.rb +++ b/test/docs/model_test.rb @@ -112,6 +112,7 @@ class Update < Trailblazer::Activity::Railway it do #:key-title-fail signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Update, params: {title: nil}, seq: []) + assert_equal ctx[:model].inspect, %{nil} #:key-title-fail end end @@ -203,6 +204,7 @@ class Create < Trailblazer::Activity::Railway it do signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, :"model.class" => Hit, seq: []) + assert_equal ctx[:model].inspect, %{#} end end @@ -223,6 +225,7 @@ class Create < Trailblazer::Operation #:in end signal, (ctx, _) = Trailblazer::Activity.(Song::Activity::Create, params: {}, my_id: 1, :"model.class" => Hit) + assert_equal ctx[:model].inspect, %{#} =begin #:in-call diff --git a/test/docs/nested_static_test.rb b/test/docs/nested_static_test.rb index 8d771a3..9eacb3a 100644 --- a/test/docs/nested_static_test.rb +++ b/test/docs/nested_static_test.rb @@ -663,9 +663,11 @@ class NestedStrategyComplianceTest < Minitest::Spec Trailblazer::Developer.wtf?(Song::Activity::Create, [{params: {type: "vorbis"}, seq: []}]) output, _ = trace Song::Activity::Create, params: {type: "vorbis"}, seq: [] + assert_equal output, trace.split("\n")[2..-2].join("\n").sub("Song::Activity::Create", "TOP") output, _ = trace Song::Activity::Create, params: {type: "mp3"}, seq: [] + assert_equal output, %{TOP |-- Start.default |-- model diff --git a/test/docs/pundit_test.rb b/test/docs/pundit_test.rb index b12fbe7..61a8773 100644 --- a/test/docs/pundit_test.rb +++ b/test/docs/pundit_test.rb @@ -29,18 +29,18 @@ class Create < Trailblazer::Operation end #:pundit end - it { Trailblazer::Developer.railway(Create).must_equal %{[>model.build,>policy.default.eval]} } - it { Create.(params: {}, current_user: Module).inspect(:model).must_equal %{] >} } - it { Create.(params: {} ).inspect(:model).must_equal %{] >} } + it { assert_equal Trailblazer::Developer.railway(Create), %{[>model.build,>policy.default.eval]} } + it { assert_equal Create.(params: {}, current_user: Module).inspect(:model), %{] >} } + it { assert_equal Create.(params: {}).inspect(:model), %{] >} } it do #:pundit-result - result = Create.(params: {}, current_user: Module) - result[:"result.policy.default"].success? #=> true - result[:"result.policy.default"][:policy] #=> # + result = Create.(params: {}, current_user: Module) + result[:"result.policy.default"].success? #=> true + result[:"result.policy.default"][:policy] #=> # #:pundit-result end - result[:"result.policy.default"].success?.must_equal true - result[:"result.policy.default"][:policy].is_a?(MyPolicy).must_equal true + assert_equal result[:"result.policy.default"].success?, true + assert_equal result[:"result.policy.default"][:policy].is_a?(MyPolicy), true end #--- @@ -49,9 +49,9 @@ class New < Create step Policy::Pundit( MyPolicy, :new? ), override: true end - it { Trailblazer::Developer.railway(New).must_equal %{[>model.build,>policy.default.eval]} } - it { New.(params: {}, current_user: Class ).inspect(:model).must_equal %{] >} } - it { New.(params: {}, current_user: nil ).inspect(:model).must_equal %{] >} } + it { assert_equal Trailblazer::Developer.railway(New), %{[>model.build,>policy.default.eval]} } + it { assert_equal New.(params: {}, current_user: Class ).inspect(:model), %{] >} } + it { assert_equal New.(params: {}, current_user: nil ).inspect(:model), %{] >} } #--- #- override with :name @@ -64,10 +64,10 @@ class Update < Edit step Policy::Pundit( MyPolicy, :new?, name: "first" ), override: true end - it { Trailblazer::Developer.railway(Edit).must_equal %{[>policy.first.eval,>policy.second.eval]} } - it { Edit.(params: {}, current_user: Class).inspect(:model).must_equal %{} } - it { Trailblazer::Developer.railway(Update).must_equal %{[>policy.first.eval,>policy.second.eval]} } - it { Update.(params: {}, current_user: Class).inspect(:model).must_equal %{} } + it { assert_equal Trailblazer::Developer.railway(Edit), %{[>policy.first.eval,>policy.second.eval]} } + it { assert_equal Edit.(params: {}, current_user: Class).inspect(:model), %{} } + it { assert_equal Trailblazer::Developer.railway(Update), %{[>policy.first.eval,>policy.second.eval]} } + it { assert_equal Update.(params: {}, current_user: Class).inspect(:model), %{} } #--- # dependency injection @@ -85,7 +85,7 @@ def create? :"policy.default.eval" => Trailblazer::Operation::Policy::Pundit.build(AnotherPolicy, :create?) ) #:di-call end - result.inspect("").must_equal %{} } + assert_equal result.inspect(""), %{} } end #- @@ -106,7 +106,7 @@ class Create < Trailblazer::Operation result = Create.(params: {}, current_user: Module) result[:"result.policy.after_model"].success? #=> true #:name-call end - result[:"result.policy.after_model"].success?.must_equal true } + assert_equal result[:"result.policy.after_model"].success?, true } end #--- @@ -123,7 +123,7 @@ class Create < Trailblazer::Operation # #:class-level end # it { Create.(); Create["result.policy"].must_be_nil } -# it { Create.(params: {}, current_user: Module)["x"].must_equal true } +# it { Create.(params: {}, current_user: Module)["x"], true } # it { Create.(params: {} )["x"].must_be_nil } # end diff --git a/test/docs/rescue_test.rb b/test/docs/rescue_test.rb index 69d832c..69ca6c6 100644 --- a/test/docs/rescue_test.rb +++ b/test/docs/rescue_test.rb @@ -23,18 +23,18 @@ class NestedInsanity < Trailblazer::Operation fail ->(options, **) { options["outer-err"] = true }, id: "nested/failure" end - it { Trailblazer::Developer.railway(NestedInsanity).must_match /\[>Rescue\/.{1,3},>nested/ } # FIXME: better introspect tests for all id-generating macros. - it { NestedInsanity.().inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{} } - it { NestedInsanity.( "raise-y" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{} } - it { NestedInsanity.( "raise-a" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{} } + it { assert_match /\[>Rescue\/.{1,3},>nested/, Trailblazer::Developer.railway(NestedInsanity) } # FIXME: better introspect tests for all id-generating macros. + it { assert_equal NestedInsanity.().inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} } + it { assert_equal NestedInsanity.( "raise-y" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} } + it { assert_equal NestedInsanity.( "raise-a" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} } #- # inheritance class UbernestedInsanity < NestedInsanity end - it { UbernestedInsanity.().inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{} } - it { UbernestedInsanity.( "raise-a" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{} } + it { assert_equal UbernestedInsanity.().inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} } + it { assert_equal UbernestedInsanity.( "raise-a" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err"), %{} } end class RescueTest < Minitest::Spec @@ -130,8 +130,8 @@ class Memo::Create < Trailblazer::Operation include Rehash end - it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{} } - it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq, :exception_class).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class), %{} } + it { assert_equal Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq, :exception_class), %{} } end =begin @@ -160,8 +160,8 @@ def my_handler(exception, (ctx), *) end #:rescue-method end - it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{} } - it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq, :exception_class).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class), %{} } + it { assert_equal Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq, :exception_class), %{} } end =begin @@ -185,8 +185,8 @@ class Memo::Create < Trailblazer::Operation include T.def_steps(:find_model, :update, :notify, :log_error, :rehash) end - it { Memo::Create.( { seq: [], } ).inspect(:seq).must_equal %{} } - it { Memo::Create.( { seq: [], update: false } ).inspect(:seq).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [], } ).inspect(:seq), %{} } + it { assert_equal Memo::Create.( { seq: [], update: false } ).inspect(:seq), %{} } end class RescueIDTest < Minitest::Spec @@ -239,6 +239,7 @@ def validate(ctx, validate: false, seq:, **) ctx = {validate: false} output, _ = trace activity, ctx + assert_equal output, %(TOP |-- Start.default |-- Rescue/1 diff --git a/test/docs/wrap_test.rb b/test/docs/wrap_test.rb index 5dd01e7..c73f867 100644 --- a/test/docs/wrap_test.rb +++ b/test/docs/wrap_test.rb @@ -204,8 +204,8 @@ def self.call((ctx), *, &block) #~methods end end - it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{} } - it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [] } ).inspect(:seq), %{} } + it { assert_equal Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq), %{} } end =begin @@ -241,8 +241,8 @@ class Memo::Create < Trailblazer::Operation end #:fail-fast end - it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{} } - it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [] } ).inspect(:seq), %{} } + it { assert_equal Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq), %{} } end =begin @@ -284,14 +284,16 @@ class Memo::Create < Trailblazer::Operation it do result = Memo::Create.( { seq: [] } ) - result.inspect(:seq).must_equal %{} - result.event.inspect.must_equal %{#} + + assert_equal result.inspect(:seq), %{} + assert_equal result.event.inspect, %{#} end it do result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } ) - result.inspect(:seq).must_equal %{} - result.event.inspect.must_equal %{#} + + assert_equal result.inspect(:seq), %{} + assert_equal result.event.inspect, %{#} end end @@ -325,8 +327,8 @@ def self.call((ctx), *, &block) #~methods end end - it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{} } - it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [] } ).inspect(:seq), %{} } + it { assert_equal Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq), %{} } end =begin @@ -362,8 +364,9 @@ def self.call((ctx), *, &block) it "translates true returned form a wrap to a signal with a `success` semantic" do result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } ) - result.inspect(:seq).must_equal %{} - result.event.inspect.must_equal %{#} + + assert_equal result.inspect(:seq), %{} + assert_equal result.event.inspect, %{#} end end @@ -400,8 +403,9 @@ def self.call((ctx), *, &block) it "translates false returned form a wrap to a signal with a `failure` semantic" do result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } ) - result.inspect(:seq).must_equal %{} - result.event.inspect.must_equal %{#} + + assert_equal result.inspect(:seq), %{} + assert_equal result.event.inspect, %{#} end end @@ -438,8 +442,9 @@ def self.call((ctx), *, &block) it "translates nil returned form a wrap to a signal with a `failure` semantic" do result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } ) - result.inspect(:seq).must_equal %{} - result.event.inspect.must_equal %{#} + + assert_equal result.inspect(:seq), %{} + assert_equal result.event.inspect, %{#} end end @@ -483,8 +488,8 @@ class Memo::Create < Trailblazer::Operation end #:transaction end - it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{} } - it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [] } ).inspect(:seq), %{} } + it { assert_equal Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq), %{} } end =begin @@ -523,8 +528,8 @@ class Memo::Create < Trailblazer::Operation end #:transaction end - it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{} } - it { Memo::Create.( { seq: [], update: false } ).inspect(:seq).must_equal %{} } + it { assert_equal Memo::Create.( { seq: [] } ).inspect(:seq), %{} } + it { assert_equal Memo::Create.( { seq: [], update: false } ).inspect(:seq), %{} } end diff --git a/test/operation/integration_test.rb b/test/operation/integration_test.rb index 72eaacd..8fac905 100644 --- a/test/operation/integration_test.rb +++ b/test/operation/integration_test.rb @@ -49,7 +49,7 @@ class SongSpecialCreate < Trailblazer::Operation puts result.wtf? # this should return song - result[:model].name.must_match "My Song" - result[:model].artist_name.must_match "My Artist" + assert_equal result[:model].name, "My Song" + assert_equal result[:model].artist_name, "My Artist" end end diff --git a/test/operation/pundit_test.rb b/test/operation/pundit_test.rb index aa5081c..ba87358 100644 --- a/test/operation/pundit_test.rb +++ b/test/operation/pundit_test.rb @@ -27,22 +27,23 @@ def process(options, **) # successful. it do result = Create.(params: {}, current_user: Module) - result[:process].must_equal true + + assert_equal result[:process], true #- result object, policy - result[:"result.policy.default"].success?.must_equal true + assert_equal result[:"result.policy.default"].success?, true result[:"result.policy.default"][:message].must_be_nil # result[:valid].must_be_nil - result[:"policy.default"].inspect.must_equal %{} + assert_equal result[:"policy.default"].inspect, %{} end # breach. it do result = Create.(params: {}, current_user: nil) result[:process].must_be_nil #- result object, policy - result[:"result.policy.default"].success?.must_equal false - result[:"result.policy.default"][:message].must_equal "Breach" + assert_equal result[:"result.policy.default"].success?, false + assert_equal result[:"result.policy.default"][:message], "Breach" end - # inject different policy.Condition it { Create.(params: {}, current_user: Object, "policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))["process"].must_equal true } + # inject different policy.Condition it { Create.(params: {}, current_user: Object, "policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))["process"], true } it { Create.(params: {}, current_user: Module, :"policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))[:process].must_be_nil } @@ -52,23 +53,25 @@ class Show < Create step Model( Song, :new ), before: :"policy.default.eval" end - it { Trailblazer::Developer.railway(Show).must_equal %{[>model.build,>policy.default.eval,>process]} } + it { assert_equal Trailblazer::Developer.railway(Show), %{[>model.build,>policy.default.eval,>process]} } # invalid because user AND model. it do result = Show.(params: {}, current_user: Module) result[:process].must_be_nil - result[:model].inspect.must_equal %{#} - # result["policy"].inspect.must_equal %{#} + + assert_equal result[:model].inspect, %{#} + # result["policy"].inspect, %{#} end # valid because new policy. it do # puts Show["pipetree"].inspect result = Show.(params: {}, current_user: Module, :"policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_and_model?)) - result[:process].must_equal true - result[:model].inspect.must_equal %{#} - result[:"policy.default"].inspect.must_equal %{>} + + assert_equal result[:process], true + assert_equal result[:model].inspect, %{#} + assert_equal result[:"policy.default"].inspect, %{>} end ##-- @@ -86,20 +89,23 @@ def process(options, **) # successful. it do result = Edit.(params: { id: 1 }, current_user: Module) - result[:process].must_equal true - result[:model].inspect.must_equal %{#} - result[:"result.policy.default"].success?.must_equal true + + assert_equal result[:process], true + assert_equal result[:model].inspect, %{#} + assert_equal result[:"result.policy.default"].success?, true result[:"result.policy.default"][:message].must_be_nil # result[:valid].must_be_nil - result[:"policy.default"].inspect.must_equal %{>} + assert_equal result[:"policy.default"].inspect, %{>} end # breach. it do result = Edit.(params: { id: 4 }, current_user: nil) - result[:model].inspect.must_equal %{#} + + assert_equal result[:model].inspect, %{#} result[:process].must_be_nil - result[:"result.policy.default"].success?.must_equal false - result[:"result.policy.default"][:message].must_equal "Breach" + + assert_equal result[:"result.policy.default"].success?, false + assert_equal result[:"result.policy.default"][:message], "Breach" end end