diff --git a/lib/netsuite/actions/add.rb b/lib/netsuite/actions/add.rb index 8acc99e8..e6ef05aa 100644 --- a/lib/netsuite/actions/add.rb +++ b/lib/netsuite/actions/add.rb @@ -70,8 +70,9 @@ def errors error_obj = response_hash[:status][:status_detail] error_obj = [error_obj] if error_obj.class == Hash error_obj.map do |error| + next if error.keys == [:after_submit_failed] NetSuite::Error.new(error) - end + end.compact end module Support diff --git a/spec/netsuite/actions/add_spec.rb b/spec/netsuite/actions/add_spec.rb index 2be80d27..aba9031e 100644 --- a/spec/netsuite/actions/add_spec.rb +++ b/spec/netsuite/actions/add_spec.rb @@ -53,10 +53,11 @@ NetSuite::Actions::Add.call([invoice]) end - it 'returns a valid Response object' do + it 'returns a valid Response object with no errors' do response = NetSuite::Actions::Add.call([invoice]) expect(response).to be_kind_of(NetSuite::Response) expect(response).to be_success + expect(response.errors).to be_empty end end @@ -136,10 +137,11 @@ NetSuite::Actions::Add.call([file]) end - it 'returns a valid Response object' do + it 'returns a valid Response object with no errors' do response = NetSuite::Actions::Add.call([file]) expect(response).to be_kind_of(NetSuite::Response) expect(response).to be_success + expect(response.errors).to be_empty end it 'properly extracts internal ID from response' do diff --git a/spec/support/fixtures/add/add_invoice.xml b/spec/support/fixtures/add/add_invoice.xml index 06e74c1f..9befd0da 100644 --- a/spec/support/fixtures/add/add_invoice.xml +++ b/spec/support/fixtures/add/add_invoice.xml @@ -1,15 +1,19 @@ - + WEBSERVICES_3392464_1220201115821392011296470399_67055c545d0 - - - - + + + + + false + + +