From b09b081ad60ce40ef27c15d7ca7c3519a21a858c Mon Sep 17 00:00:00 2001 From: Georg Leciejewski Date: Thu, 30 Jan 2014 09:20:08 +0100 Subject: [PATCH] show account error details on message validation --- lib/sepa_king/message.rb | 2 +- spec/message_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sepa_king/message.rb b/lib/sepa_king/message.rb index 5cb5464..e067aa2 100644 --- a/lib/sepa_king/message.rb +++ b/lib/sepa_king/message.rb @@ -13,7 +13,7 @@ class Message validates_presence_of :transactions validate do |record| - record.errors.add(:account, 'is invalid') unless record.account.valid? + record.errors.add(:account, record.account.errors.full_messages) unless record.account.valid? end class_attribute :account_class, :transaction_class, :xml_main_tag, :known_schemas diff --git a/spec/message_spec.rb b/spec/message_spec.rb index 521c6af..f748b77 100644 --- a/spec/message_spec.rb +++ b/spec/message_spec.rb @@ -33,7 +33,7 @@ class DummyMessage < SEPA::Message it 'should fail with invalid account' do subject.should_not be_valid - subject.should have(1).error_on(:account) + subject.should have(2).error_on(:account) end it 'should fail without transactions' do