Sha256: e7f5edd408d6799538a7194257366095b4270499e215f99646d22b712950676c
Contents?: true
Size: 594 Bytes
Versions: 13
Compression:
Stored size: 594 Bytes
Contents
require "test_helper" class OperationContractTest < MiniTest::Spec class Operation < Trailblazer::Operation contract do property :id property :title property :length end def process(params) @model = Struct.new(:id, :title, :length).new contract.id = 1 validate(params) do contract.length = 3 end end end # allow using #contract before #validate. it do op = Operation.(title: "Beethoven") op.contract.id.must_equal 1 op.contract.title.must_equal "Beethoven" op.contract.length.must_equal 3 end end
Version data entries
13 entries across 13 versions & 1 rubygems