Skip to content

Commit

Permalink
more docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Nov 8, 2023
1 parent 06b8eba commit 8f4d3f0
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions test/docs/mechanics_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,57 @@ def validate(ctx, params:, **)
end
end

class ReadfromCtx_DocsMechanicsTest < Minitest::Spec
Memo = Module.new
it "what" do
#:ctx-read
module Memo::Operation
class Create < Trailblazer::Operation
step :validate
#~meths
step :save

def save(*); true; end
#~meths end
def validate(ctx, **)
p ctx[:params] #=> {:memo=>nil}
end
end
end
#:ctx-read end

#:ctx-read-call
result = Memo::Operation::Create.call(params: {memo: nil})
#:ctx-read-call end
assert_equal result.success?, true
end
end

class ReadfromCtxKwargs_DocsMechanicsTest < Minitest::Spec
Memo = Module.new
it "what" do
module Memo::Operation
class Create < Trailblazer::Operation
step :validate
#~meths
step :save

def save(*); true; end
#~meths end
#:ctx-read-kwargs
def validate(ctx, params:, **)
p params #=> {:memo=>nil}
end
#:ctx-read-kwargs end
end
end

result = Memo::Operation::Create.call(params: {memo: nil})
assert_equal result.success?, true
end
end


class Classmethod_DocsMechanicsTest < Minitest::Spec
Memo = Module.new
it "what" do
Expand Down

0 comments on commit 8f4d3f0

Please sign in to comment.