test/operation_test.rb in trailblazer-0.2.1 vs test/operation_test.rb in trailblazer-0.2.2
- old
+ new
@@ -338,5 +338,23 @@
song.genre.must_equal "Punkrock"
song.band.must_equal nil
end
end
+
+
+class OperationErrorsTest < MiniTest::Spec
+ class Operation < Trailblazer::Operation
+ contract do
+ property :title, validates: {presence: true}
+ end
+
+ def process(params)
+ validate(params, OpenStruct.new) {}
+ end
+ end
+
+ it do
+ res, op = Operation.run({})
+ op.errors.to_s.must_equal "{:title=>[\"can't be blank\"]}"
+ end
+end