Sha256: 3393dceb217d22806b0e2eb7c81d685eb865aed7c72bf370b8de21307fb98ed5
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
describe Cieloz::Helpers do class Source include ActiveModel::Validations def number ; nil end end let(:order) { Source.new } let(:pedido) { Cieloz.pedido order, numero: :number, valor: :value } it "recognizes error for attribute" do pedido.wont_be :valid? errors = order.errors.messages[:number] errors.wont_be_empty errors.must_equal pedido.errors[:numero] end let(:txn) { Source.new } let(:transacao) { Cieloz.transacao txn, dados_pedido: pedido } it "recognizes errors for dependent mappers" do transacao.wont_be :valid? errors = order.errors.messages[:number] errors.wont_be_empty errors.must_equal pedido.errors[:numero] end it "appends non-dependent errors to root aggregate base" do transacao.wont_be :valid? transacao.errors.delete :dados_pedido # ignores dependent errors expected_errors = transacao.errors.messages.map { |attr,errors| # errors have theit attributes identified when put on base errors.map { |e| "#{attr}: #{e}" } }.flatten txn.errors.messages[:base].must_equal expected_errors end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cieloz-0.0.17 | test/unit/mapper_test.rb |
cieloz-0.0.16 | test/unit/mapper_test.rb |
cieloz-0.0.15 | test/unit/mapper_test.rb |
cieloz-0.0.14 | test/unit/mapper_test.rb |