test/operation_test.rb in trailblazer-operation-0.7.1 vs test/operation_test.rb in trailblazer-operation-0.7.2
- old
+ new
@@ -93,9 +93,20 @@
it "allows to inherit" do
Upsert.("params" => {decide: true}).inspect("a", "b", "c", "d", "e").must_equal %{<Result:true [false, true, nil, 1, nil] >}
Unset. ("params" => {decide: true}).inspect("a", "b", "c", "d", "e").must_equal %{<Result:true [false, true, nil, 1, 2] >}
end
+# Mixing keywords and string keys in {Operation.call}.
+# Test that {.(params: {}, "current_user" => user)} is processed properly
+ class Collect < Trailblazer::Operation
+ # step ->(ctx, **) { ctx[:keys] }
+ end
+
+ it "contains all keys from {call}" do
+ result = Collect.(params: {}, "current_user" => Module)
+ _(result.inspect).must_equal %{<Result:true #<Trailblazer::Context::Container wrapped_options={:params=>{}, \"current_user\"=>Module} mutable_options={}> >}
+ end
+
#---
#- ctx container
it do
options = { "params" => {decide: true} }