From 873998ec5a71ebe60a24cde0cd5ad33afe252d83 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 15 Jun 2017 08:38:38 +0200 Subject: [PATCH] Improved tests. --- test/integration/clearbit_test.rb | 3 ++- test/unit/email_postmaster_test.rb | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/test/integration/clearbit_test.rb b/test/integration/clearbit_test.rb index 001e35936..82ef6bad5 100644 --- a/test/integration/clearbit_test.rb +++ b/test/integration/clearbit_test.rb @@ -276,7 +276,8 @@ class ClearbitTest < ActiveSupport::TestCase assert_equal('3030 16th St, San Francisco, CA 94103, USA', customer6_lookup.address) #assert_equal('San Francisco, CA, USA', customer6_lookup.address) - organization6_lookup = Organization.find_by(name: 'Clearbit') + organization6_lookup = Organization.find_by(name: 'APIHub, Inc') + assert(organization6_lookup, 'unable to find org of user') assert(ExternalSync.find_by(source: 'clearbit', object: 'Organization', o_id: organization6_lookup.id)) assert_equal(false, organization6_lookup.shared) assert_equal('Clearbit provides powerful products and data APIs to help your business grow. Contact enrichment, lead generation, financial compliance, and more...', organization6_lookup.note) diff --git a/test/unit/email_postmaster_test.rb b/test/unit/email_postmaster_test.rb index e17fa6b44..82e0134c5 100644 --- a/test/unit/email_postmaster_test.rb +++ b/test/unit/email_postmaster_test.rb @@ -16,7 +16,7 @@ class EmailPostmasterTest < ActiveSupport::TestCase updated_by_id: 1, ) PostmasterFilter.destroy_all - PostmasterFilter.create( + PostmasterFilter.create!( name: 'not used', match: { from: { @@ -34,7 +34,8 @@ class EmailPostmasterTest < ActiveSupport::TestCase created_by_id: 1, updated_by_id: 1, ) - PostmasterFilter.create( + + PostmasterFilter.create!( name: 'used', match: { from: { @@ -55,7 +56,8 @@ class EmailPostmasterTest < ActiveSupport::TestCase created_by_id: 1, updated_by_id: 1, ) - PostmasterFilter.create( + + PostmasterFilter.create!( name: 'used x-any-recipient', match: { 'x-any-recipient' => { @@ -77,6 +79,7 @@ class EmailPostmasterTest < ActiveSupport::TestCase updated_by_id: 1, ) + data = 'From: me@example.com To: customer@example.com Subject: some subject @@ -111,9 +114,8 @@ Some Text' assert_equal('email', article.type.name) assert_equal(true, article.internal) - - PostmasterFilter.create( - name: 'used x-any-recipient', + PostmasterFilter.create!( + name: 'used x-any-recipient 2', match: { 'x-any-recipient' => { operator: 'contains not', @@ -157,7 +159,7 @@ Some Text' PostmasterFilter.destroy_all - PostmasterFilter.create( + PostmasterFilter.create!( name: 'used - empty selector', match: { from: { @@ -203,7 +205,7 @@ Some Text' PostmasterFilter.destroy_all # follow up with create post master filter test - PostmasterFilter.create( + PostmasterFilter.create!( name: 'used - empty selector', match: { from: { @@ -270,7 +272,7 @@ Some Text" PostmasterFilter.destroy_all - PostmasterFilter.create( + PostmasterFilter.create!( name: 'used', match: { from: { @@ -310,7 +312,7 @@ Some Text' assert_equal('me@example.com', ticket.customer.email) PostmasterFilter.destroy_all - PostmasterFilter.create( + PostmasterFilter.create!( name: 'used', match: { from: { @@ -350,7 +352,7 @@ Some Text' assert_equal('me@example.com', ticket.customer.email) PostmasterFilter.destroy_all - PostmasterFilter.create( + PostmasterFilter.create!( name: 'used', match: { from: {