Sha256: e17692309d8921fc5eea8a98d7acb785296175cef36b5213d49d924bc7a65ed4
Contents?: true
Size: 1013 Bytes
Versions: 5
Compression:
Stored size: 1013 Bytes
Contents
require "test_helper" # DISCUSS: do we need this test? class CallTest < Minitest::Spec describe "::call" do class Create < Trailblazer::Operation def inspect "#{@skills.inspect}" end end it { Create.().must_be_instance_of Trailblazer::Operation::Result } it { Create.({}).inspect.must_equal %{<Result:true <Skill {} {\"params\"=>{}} {\"pipetree\"=>[>>operation.new]}> >} } it { Create.(name: "Jacob").inspect.must_equal %{<Result:true <Skill {} {\"params\"=>{:name=>\"Jacob\"}} {\"pipetree\"=>[>>operation.new]}> >} } it { Create.({ name: "Jacob" }, { policy: Object }).inspect.must_equal %{<Result:true <Skill {} {:policy=>Object, \"params\"=>{:name=>\"Jacob\"}} {\"pipetree\"=>[>>operation.new]}> >} } #--- # success? class Update < Trailblazer::Operation self.& ->(options) { options["params"] }, after: "operation.new" end it { Update.(true).success?.must_equal true } it { Update.(false).success?.must_equal false } end end
Version data entries
5 entries across 5 versions & 1 rubygems