test/docs/guard_test.rb in trailblazer-macro-2.1.15 vs test/docs/guard_test.rb in trailblazer-macro-2.1.16

- old
+ new

@@ -14,24 +14,25 @@ end #:pipeonly end end #:proc end - it { Create.(pass: false)[:x].must_be_nil } - it { Create.(pass: true)[:x].must_equal true } + it { assert_nil Create.(pass: false)[:x] } + 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 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 #--- # with Callable class DocsGuardTest < Minitest::Spec @@ -56,12 +57,13 @@ #~methods end #:pipe-only end end #:callable-op end - it { Create.(pass: false)[:x].must_be_nil } - it { Create.(pass: true)[:x].must_equal true } + it { assert_nil Create.(pass: false)[:x] } + + it { assert_equal Create.(pass: true)[:x], true } end #--- # with method class DocsGuardMethodTest < Minitest::Spec @@ -81,12 +83,12 @@ #~methods end #~pipe-onlyy end end #:method end - it { Create.(pass: false).inspect(:x).must_equal %{<Result:false [nil] >} } - it { Create.(pass: true).inspect(:x).must_equal %{<Result:true [true] >} } + it { assert_equal Create.(pass: false).inspect(:x), %{<Result:false [nil] >} } + it { assert_equal Create.(pass: true).inspect(:x), %{<Result:true [true] >} } end #--- # with name: class DocsGuardNamedTest < Minitest::Spec @@ -95,12 +97,12 @@ step Policy::Guard( ->(options, current_user:, **) { current_user }, name: :user ) # ... 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 result = Create.(:current_user => true) result[:"result.policy.user"].success? #=> true @@ -115,31 +117,31 @@ class Create < Trailblazer::Operation step Policy::Guard( ->(options, current_user:, **) { current_user == Module } ) end #:di-op end - it { Create.(:current_user => Module).inspect("").must_equal %{<Result:true [nil] >} } + it { assert_equal Create.(:current_user => Module).inspect(""), %{<Result:true [nil] >} } it { result = #:di-call Create.( :current_user => Module, :"policy.default.eval" => Trailblazer::Operation::Policy::Guard.build(->(options, **) { false }) ) #:di-call end - result.inspect("").must_equal %{<Result:false [nil] >} } + assert_equal result.inspect(""), %{<Result:false [nil] >} } end #--- # missing current_user throws exception class DocsGuardMissingKeywordTest < Minitest::Spec class Create < Trailblazer::Operation step Policy::Guard( ->(options, current_user:, **) { current_user == Module } ) 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 #--- # before: class DocsGuardPositionTest < Minitest::Spec @@ -149,10 +151,10 @@ step Policy::Guard( :authorize! ), before: :model! 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) #=> # 0 ========================>operation.new # 1 ==================>policy.default.eval