diff --git a/test/docs/guard_test.rb b/test/docs/guard_test.rb index ba94f11..45a4933 100644 --- a/test/docs/guard_test.rb +++ b/test/docs/guard_test.rb @@ -16,7 +16,7 @@ def process(options, **) end #:proc end - it { Create.(pass: false)[:x].must_be_nil } + it { assert_nil Create.(pass: false)[:x] } it { assert_equal Create.(pass: true)[:x], true } @@ -59,7 +59,7 @@ def process(options, **) end #:callable-op end - it { Create.(pass: false)[:x].must_be_nil } + it { assert_nil Create.(pass: false)[:x] } it { assert_equal Create.(pass: true)[:x], true } end diff --git a/test/operation/pundit_test.rb b/test/operation/pundit_test.rb index ba87358..e98e988 100644 --- a/test/operation/pundit_test.rb +++ b/test/operation/pundit_test.rb @@ -31,20 +31,20 @@ def process(options, **) assert_equal result[:process], true #- result object, policy assert_equal result[:"result.policy.default"].success?, true - result[:"result.policy.default"][:message].must_be_nil + assert_nil result[:"result.policy.default"][:message] # result[:valid].must_be_nil assert_equal result[:"policy.default"].inspect, %{} end # breach. it do result = Create.(params: {}, current_user: nil) - result[:process].must_be_nil + assert_nil result[:process] #- result object, policy 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"], true } - it { Create.(params: {}, current_user: Module, :"policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))[:process].must_be_nil } + it { assert_nil Create.(params: {}, current_user: Module, :"policy.default.eval" => Trailblazer::Operation::Policy::Pundit::Condition.new(Auth, :user_object?))[:process] } #--- @@ -58,7 +58,7 @@ class Show < Create # invalid because user AND model. it do result = Show.(params: {}, current_user: Module) - result[:process].must_be_nil + assert_nil result[:process] assert_equal result[:model].inspect, %{#} # result["policy"].inspect, %{#} @@ -93,7 +93,7 @@ def process(options, **) 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 + assert_nil result[:"result.policy.default"][:message] # result[:valid].must_be_nil assert_equal result[:"policy.default"].inspect, %{>} end @@ -103,7 +103,7 @@ def process(options, **) result = Edit.(params: { id: 4 }, current_user: nil) assert_equal result[:model].inspect, %{#} - result[:process].must_be_nil + assert_nil result[:process] assert_equal result[:"result.policy.default"].success?, false assert_equal result[:"result.policy.default"][:message], "Breach"