Improved tests.

This commit is contained in:
Martin Edenhofer 2017-06-15 08:38:38 +02:00
parent 1a43d9bd5c
commit 873998ec5a
2 changed files with 15 additions and 12 deletions

View file

@ -276,7 +276,8 @@ class ClearbitTest < ActiveSupport::TestCase
assert_equal('3030 16th St, San Francisco, CA 94103, USA', customer6_lookup.address) assert_equal('3030 16th St, San Francisco, CA 94103, USA', customer6_lookup.address)
#assert_equal('San Francisco, CA, 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(ExternalSync.find_by(source: 'clearbit', object: 'Organization', o_id: organization6_lookup.id))
assert_equal(false, organization6_lookup.shared) 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) 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)

View file

@ -16,7 +16,7 @@ class EmailPostmasterTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
) )
PostmasterFilter.destroy_all PostmasterFilter.destroy_all
PostmasterFilter.create( PostmasterFilter.create!(
name: 'not used', name: 'not used',
match: { match: {
from: { from: {
@ -34,7 +34,8 @@ class EmailPostmasterTest < ActiveSupport::TestCase
created_by_id: 1, created_by_id: 1,
updated_by_id: 1, updated_by_id: 1,
) )
PostmasterFilter.create(
PostmasterFilter.create!(
name: 'used', name: 'used',
match: { match: {
from: { from: {
@ -55,7 +56,8 @@ class EmailPostmasterTest < ActiveSupport::TestCase
created_by_id: 1, created_by_id: 1,
updated_by_id: 1, updated_by_id: 1,
) )
PostmasterFilter.create(
PostmasterFilter.create!(
name: 'used x-any-recipient', name: 'used x-any-recipient',
match: { match: {
'x-any-recipient' => { 'x-any-recipient' => {
@ -77,6 +79,7 @@ class EmailPostmasterTest < ActiveSupport::TestCase
updated_by_id: 1, updated_by_id: 1,
) )
data = 'From: me@example.com data = 'From: me@example.com
To: customer@example.com To: customer@example.com
Subject: some subject Subject: some subject
@ -111,9 +114,8 @@ Some Text'
assert_equal('email', article.type.name) assert_equal('email', article.type.name)
assert_equal(true, article.internal) assert_equal(true, article.internal)
PostmasterFilter.create!(
PostmasterFilter.create( name: 'used x-any-recipient 2',
name: 'used x-any-recipient',
match: { match: {
'x-any-recipient' => { 'x-any-recipient' => {
operator: 'contains not', operator: 'contains not',
@ -157,7 +159,7 @@ Some Text'
PostmasterFilter.destroy_all PostmasterFilter.destroy_all
PostmasterFilter.create( PostmasterFilter.create!(
name: 'used - empty selector', name: 'used - empty selector',
match: { match: {
from: { from: {
@ -203,7 +205,7 @@ Some Text'
PostmasterFilter.destroy_all PostmasterFilter.destroy_all
# follow up with create post master filter test # follow up with create post master filter test
PostmasterFilter.create( PostmasterFilter.create!(
name: 'used - empty selector', name: 'used - empty selector',
match: { match: {
from: { from: {
@ -270,7 +272,7 @@ Some Text"
PostmasterFilter.destroy_all PostmasterFilter.destroy_all
PostmasterFilter.create( PostmasterFilter.create!(
name: 'used', name: 'used',
match: { match: {
from: { from: {
@ -310,7 +312,7 @@ Some Text'
assert_equal('me@example.com', ticket.customer.email) assert_equal('me@example.com', ticket.customer.email)
PostmasterFilter.destroy_all PostmasterFilter.destroy_all
PostmasterFilter.create( PostmasterFilter.create!(
name: 'used', name: 'used',
match: { match: {
from: { from: {
@ -350,7 +352,7 @@ Some Text'
assert_equal('me@example.com', ticket.customer.email) assert_equal('me@example.com', ticket.customer.email)
PostmasterFilter.destroy_all PostmasterFilter.destroy_all
PostmasterFilter.create( PostmasterFilter.create!(
name: 'used', name: 'used',
match: { match: {
from: { from: {