test/operation_test.rb in trailblazer-0.1.0 vs test/operation_test.rb in trailblazer-0.1.2
- old
+ new
@@ -236,26 +236,25 @@
end
it { OperationReceivingLottaArguments.run(Object, {}).must_equal([true, [Object, {}]]) }
- # TODO: experimental.
- # ::present to avoid running #validate.
+ # ::present only runs #setup! which runs #model!.
class ContractOnlyOperation < Trailblazer::Operation
self.contract_class = class Contract
def initialize(model)
@_model = model
end
attr_reader :_model
self
end
- def process(params)
- @object = Object # arbitrary init code.
+ def model!(params)
+ Object
+ end
- validate(params, Object) do
- raise "this should not be run."
- end
+ def process(params)
+ raise "This is not run!"
end
end
it { ContractOnlyOperation.present({}).contract._model.must_equal Object }
\ No newline at end of file