test/operation_test.rb in trailblazer-1.0.4 vs test/operation_test.rb in trailblazer-1.1.0.rc1

- old
+ new

@@ -22,9 +22,24 @@ # allows you changing params in #setup_params!. it { OperationSetupParam.run({valid: true}).to_s.must_equal "[true, <OperationSetupParam @model={:valid=>true, :garrett=>\"Rocks!\"}>]" } end +class OperationParamsTest < MiniTest::Spec + class Operation < Trailblazer::Operation + def process(params) + @model = "#{params} and #{@params==params}" + end + + def params!(params) + { params: params } + end + end + + # allows you returning new params in #params!. + it { Operation.({valid: true}).model.to_s.must_equal "{:params=>{:valid=>true}} and true" } +end + # Operation#model. class OperationModelTest < MiniTest::Spec class Operation < Trailblazer::Operation def process(params) end \ No newline at end of file