fat_free_crm 0.20.1 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +170 -0
- data/README.md +3 -6
- data/app/assets/config/fat_free_crm.js +3 -0
- data/app/assets/config/manifest.js +1 -0
- data/app/controllers/admin/field_groups_controller.rb +0 -2
- data/app/controllers/admin/tags_controller.rb +1 -1
- data/app/controllers/admin/users_controller.rb +1 -1
- data/app/controllers/application_controller.rb +11 -0
- data/app/controllers/comments_controller.rb +2 -0
- data/app/controllers/emails_controller.rb +2 -0
- data/app/controllers/entities/accounts_controller.rb +3 -1
- data/app/controllers/entities/campaigns_controller.rb +3 -1
- data/app/controllers/entities/contacts_controller.rb +3 -1
- data/app/controllers/entities/leads_controller.rb +4 -2
- data/app/controllers/entities/opportunities_controller.rb +3 -1
- data/app/controllers/entities_controller.rb +2 -0
- data/app/controllers/home_controller.rb +2 -0
- data/app/controllers/lists_controller.rb +2 -0
- data/app/controllers/tasks_controller.rb +3 -1
- data/app/controllers/users_controller.rb +2 -0
- data/app/helpers/accounts_helper.rb +2 -0
- data/app/helpers/application_helper.rb +22 -3
- data/app/helpers/tasks_helper.rb +1 -2
- data/app/models/entities/account.rb +1 -1
- data/app/models/entities/campaign.rb +1 -1
- data/app/models/entities/contact.rb +1 -1
- data/app/models/entities/lead.rb +1 -1
- data/app/models/entities/opportunity.rb +1 -1
- data/app/models/fields/custom_field.rb +2 -2
- data/app/models/observers/entity_observer.rb +1 -1
- data/app/models/polymorphic/avatar.rb +1 -30
- data/app/models/polymorphic/comment.rb +1 -1
- data/app/models/polymorphic/task.rb +1 -0
- data/app/models/setting.rb +4 -5
- data/app/models/users/user.rb +1 -1
- data/app/views/home/index.xls.builder +1 -0
- data/app/views/shared/_address.html.haml +1 -1
- data/bin/bundle +108 -2
- data/bin/rails +3 -3
- data/bin/rake +2 -2
- data/bin/setup +12 -15
- data/config/application.rb +22 -4
- data/config/boot.rb +3 -5
- data/config/cable.yml +10 -0
- data/config/database.yml +26 -0
- data/config/environment.rb +4 -3
- data/config/environments/development.rb +47 -11
- data/config/environments/production.rb +17 -15
- data/config/environments/test.rb +19 -9
- data/config/initializers/action_mailer.rb +1 -0
- data/config/initializers/content_security_policy.rb +21 -26
- data/config/initializers/custom_field_ransack_translations.rb +1 -0
- data/config/initializers/filter_parameter_logging.rb +6 -2
- data/config/initializers/inflections.rb +4 -4
- data/config/initializers/permissions_policy.rb +12 -0
- data/config/puma.rb +2 -2
- data/config/storage.yml +34 -0
- data/db/demo/field_groups.yml +2 -1
- data/db/migrate/20100928030617_drop_openid_tables.rb +2 -1
- data/db/migrate/20230526211831_create_active_storage_tables.active_storage.rb +51 -0
- data/db/migrate/20230526212613_convert_to_active_storage.rb +107 -0
- data/db/schema.rb +108 -76
- data/db/seeds/fields.rb +7 -21
- data/lib/development_tasks/license.rake +10 -10
- data/lib/fat_free_crm/callback.rb +2 -3
- data/lib/fat_free_crm/errors.rb +2 -10
- data/lib/fat_free_crm/exceptions.rb +1 -0
- data/lib/fat_free_crm/fields.rb +4 -5
- data/lib/fat_free_crm/gem_dependencies.rb +0 -1
- data/lib/fat_free_crm/i18n.rb +1 -1
- data/lib/fat_free_crm/mail_processor/dropbox.rb +1 -1
- data/lib/fat_free_crm/version.rb +3 -3
- data/public/avatars/User/2/large_rails.png +0 -0
- data/public/avatars/User/2/medium_rails.png +0 -0
- data/public/avatars/User/2/small_rails.png +0 -0
- data/public/avatars/User/2/thumb_rails.png +0 -0
- data/public/avatars/User/3/large_rails.png +0 -0
- data/public/avatars/User/3/medium_rails.png +0 -0
- data/public/avatars/User/3/original_rails.png +0 -0
- data/public/avatars/User/3/small_rails.png +0 -0
- data/public/avatars/User/3/thumb_rails.png +0 -0
- data/public/avatars/User/4/large_rails.png +0 -0
- data/public/avatars/User/4/medium_rails.png +0 -0
- data/public/avatars/User/4/original_rails.png +0 -0
- data/public/avatars/User/4/small_rails.png +0 -0
- data/public/avatars/User/4/thumb_rails.png +0 -0
- data/public/avatars/User/6/large_rails.png +0 -0
- data/public/avatars/User/6/medium_rails.png +0 -0
- data/public/avatars/User/6/original_rails.png +0 -0
- data/public/avatars/User/6/small_rails.png +0 -0
- data/public/avatars/User/6/thumb_rails.png +0 -0
- data/public/avatars/User/7/large_rails.png +0 -0
- data/public/avatars/User/7/medium_rails.png +0 -0
- data/public/avatars/User/7/original_rails.png +0 -0
- data/public/avatars/User/7/small_rails.png +0 -0
- data/public/avatars/User/7/thumb_rails.png +0 -0
- metadata +73 -288
- data/.docker/nginx/sites-enabled/ffcrm.conf +0 -8
- data/.github/workflows/brakeman-analysis.yml +0 -46
- data/.github/workflows/rubocop-analysis.yml +0 -40
- data/.github/workflows/ruby.yml +0 -52
- data/.gitignore +0 -39
- data/.rubocop.yml +0 -73
- data/.rubocop_todo.yml +0 -286
- data/.teatro.yml +0 -3
- data/.travis.yml +0 -60
- data/CONTRIBUTORS.md +0 -135
- data/Capfile +0 -27
- data/Dockerfile +0 -51
- data/Gemfile +0 -106
- data/Gemfile.lock +0 -529
- data/Guardfile +0 -26
- data/Procfile +0 -1
- data/SECURITY.md +0 -11
- data/Vagrantfile +0 -92
- data/config/initializers/new_framework_defaults_6_0.rb +0 -46
- data/custom_plan.rb +0 -11
- data/docker-compose.yml +0 -27
- data/fat_free_crm.gemspec +0 -62
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/.gitkeep~master +0 -0
- data/script/rails +0 -8
- data/spec/controllers/admin/groups_controller_spec.rb +0 -11
- data/spec/controllers/admin/users_controller_spec.rb +0 -251
- data/spec/controllers/applications_controller_spec.rb +0 -43
- data/spec/controllers/comments_controller_spec.rb +0 -195
- data/spec/controllers/emails_controller_spec.rb +0 -37
- data/spec/controllers/entities/accounts_controller_spec.rb +0 -607
- data/spec/controllers/entities/campaigns_controller_spec.rb +0 -645
- data/spec/controllers/entities/contacts_controller_spec.rb +0 -705
- data/spec/controllers/entities/leads_controller_spec.rb +0 -1009
- data/spec/controllers/entities/opportunities_controller_spec.rb +0 -904
- data/spec/controllers/entities_controller_spec.rb +0 -47
- data/spec/controllers/home_controller_spec.rb +0 -235
- data/spec/controllers/lists_controller_spec.rb +0 -11
- data/spec/controllers/tasks_controller_spec.rb +0 -517
- data/spec/controllers/users_controller_spec.rb +0 -375
- data/spec/factories/account_factories.rb +0 -40
- data/spec/factories/campaign_factories.rb +0 -30
- data/spec/factories/contact_factories.rb +0 -45
- data/spec/factories/field_factories.rb +0 -40
- data/spec/factories/lead_factories.rb +0 -36
- data/spec/factories/list_factories.rb +0 -13
- data/spec/factories/opportunity_factories.rb +0 -39
- data/spec/factories/sequences.rb +0 -32
- data/spec/factories/setting_factories.rb +0 -15
- data/spec/factories/shared_factories.rb +0 -70
- data/spec/factories/subscription_factories.rb +0 -13
- data/spec/factories/tag_factories.rb +0 -12
- data/spec/factories/task_factories.rb +0 -29
- data/spec/factories/user_factories.rb +0 -66
- data/spec/features/acceptance_helper.rb +0 -11
- data/spec/features/accounts_spec.rb +0 -126
- data/spec/features/admin/groups_spec.rb +0 -31
- data/spec/features/admin/users_spec.rb +0 -40
- data/spec/features/campaigns_spec.rb +0 -104
- data/spec/features/contacts_spec.rb +0 -134
- data/spec/features/dashboard_spec.rb +0 -67
- data/spec/features/devise/sign_in_spec.rb +0 -58
- data/spec/features/devise/sign_up_spec.rb +0 -36
- data/spec/features/leads_spec.rb +0 -138
- data/spec/features/opportunities_overview_spec.rb +0 -88
- data/spec/features/opportunities_spec.rb +0 -132
- data/spec/features/support/autocomlete_helper.rb +0 -17
- data/spec/features/support/browser.rb +0 -28
- data/spec/features/support/headless.rb +0 -19
- data/spec/features/support/paths.rb +0 -48
- data/spec/features/support/selector_helpers.rb +0 -36
- data/spec/features/tasks_spec.rb +0 -94
- data/spec/helpers/accounts_helper_spec.rb +0 -73
- data/spec/helpers/admin/field_groups_helper_spec.rb +0 -20
- data/spec/helpers/admin/plugins_helper_spec.rb +0 -11
- data/spec/helpers/admin/settings_helper_spec.rb +0 -11
- data/spec/helpers/admin/users_helper_spec.rb +0 -11
- data/spec/helpers/application_helper_spec.rb +0 -86
- data/spec/helpers/authentications_helper_spec.rb +0 -16
- data/spec/helpers/campaigns_helper_spec.rb +0 -16
- data/spec/helpers/comments_helper_spec.rb +0 -16
- data/spec/helpers/contacts_helper_spec.rb +0 -16
- data/spec/helpers/emails_helper_spec.rb +0 -11
- data/spec/helpers/fields_helper_spec.rb +0 -12
- data/spec/helpers/groups_helper_spec.rb +0 -21
- data/spec/helpers/home_helper_spec.rb +0 -16
- data/spec/helpers/leads_helper_spec.rb +0 -16
- data/spec/helpers/lists_helper_spec.rb +0 -21
- data/spec/helpers/opportunities_helper_spec.rb +0 -16
- data/spec/helpers/passwords_helper_spec.rb +0 -16
- data/spec/helpers/tasks_helper_spec.rb +0 -20
- data/spec/helpers/users_helper_spec.rb +0 -39
- data/spec/lib/comment_extensions_spec.rb +0 -42
- data/spec/lib/core_ext/string_spec.rb +0 -23
- data/spec/lib/errors_spec.rb +0 -32
- data/spec/lib/fields_spec.rb +0 -101
- data/spec/lib/mail_processor/base_spec.rb +0 -169
- data/spec/lib/mail_processor/comment_replies_spec.rb +0 -70
- data/spec/lib/mail_processor/dropbox_spec.rb +0 -306
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +0 -173
- data/spec/lib/permissions_spec.rb +0 -155
- data/spec/lib/secret_token_generator_spec.rb +0 -69
- data/spec/lib/view_factory_spec.rb +0 -69
- data/spec/mailers/devise_mailer_spec.rb +0 -35
- data/spec/mailers/subscription_mailer_spec.rb +0 -48
- data/spec/mailers/user_mailer_spec.rb +0 -115
- data/spec/models/entities/account_contact_spec.rb +0 -34
- data/spec/models/entities/account_opportunity_spec.rb +0 -34
- data/spec/models/entities/account_spec.rb +0 -206
- data/spec/models/entities/campaign_spec.rb +0 -131
- data/spec/models/entities/contact_opportunity_spec.rb +0 -34
- data/spec/models/entities/contact_spec.rb +0 -314
- data/spec/models/entities/lead_spec.rb +0 -102
- data/spec/models/entities/opportunity_spec.rb +0 -299
- data/spec/models/fields/custom_field_date_pair_spec.rb +0 -92
- data/spec/models/fields/custom_field_pair_spec.rb +0 -76
- data/spec/models/fields/custom_field_spec.rb +0 -129
- data/spec/models/fields/field_group_spec.rb +0 -29
- data/spec/models/fields/field_spec.rb +0 -69
- data/spec/models/list_spec.rb +0 -19
- data/spec/models/observers/entity_observer_spec.rb +0 -74
- data/spec/models/polymorphic/address_spec.rb +0 -34
- data/spec/models/polymorphic/avatar_spec.rb +0 -46
- data/spec/models/polymorphic/comment_spec.rb +0 -45
- data/spec/models/polymorphic/email_spec.rb +0 -53
- data/spec/models/polymorphic/task_spec.rb +0 -395
- data/spec/models/polymorphic/version_spec.rb +0 -241
- data/spec/models/setting_spec.rb +0 -77
- data/spec/models/users/abilities/user_ability_spec.rb +0 -70
- data/spec/models/users/group_spec.rb +0 -11
- data/spec/models/users/permission_spec.rb +0 -58
- data/spec/models/users/preference_spec.rb +0 -71
- data/spec/models/users/user_spec.rb +0 -238
- data/spec/routing/accounts_routing_spec.rb +0 -60
- data/spec/routing/admin/users_routing_spec.rb +0 -40
- data/spec/routing/campaigns_routing_spec.rb +0 -64
- data/spec/routing/comments_routing_spec.rb +0 -32
- data/spec/routing/contacts_routing_spec.rb +0 -60
- data/spec/routing/emails_routing_spec.rb +0 -40
- data/spec/routing/leads_routing_spec.rb +0 -88
- data/spec/routing/opportunities_routing_spec.rb +0 -64
- data/spec/routing/tasks_routing_spec.rb +0 -68
- data/spec/routing/users_routing_spec.rb +0 -106
- data/spec/shared/controllers.rb +0 -99
- data/spec/shared/models.rb +0 -141
- data/spec/spec_helper.rb +0 -117
- data/spec/support/assert_select.rb +0 -167
- data/spec/support/devise_helpers.rb +0 -28
- data/spec/support/feature_helpers.rb +0 -32
- data/spec/support/macros.rb +0 -49
- data/spec/support/mail_processor_mocks.rb +0 -37
- data/spec/support/uploaded_file.rb +0 -10
- data/spec/views/accounts/_edit.haml_spec.rb +0 -43
- data/spec/views/accounts/_new.haml_spec.rb +0 -42
- data/spec/views/accounts/create.js.haml_spec.rb +0 -52
- data/spec/views/accounts/destroy.js.haml_spec.rb +0 -34
- data/spec/views/accounts/edit.js.haml_spec.rb +0 -66
- data/spec/views/accounts/index.haml_spec.rb +0 -43
- data/spec/views/accounts/index.js.haml_spec.rb +0 -34
- data/spec/views/accounts/new.js.haml_spec.rb +0 -44
- data/spec/views/accounts/show.haml_spec.rb +0 -38
- data/spec/views/accounts/update.js.haml_spec.rb +0 -93
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +0 -30
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +0 -31
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +0 -24
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +0 -25
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +0 -29
- data/spec/views/admin/users/_create.haml_spec.rb +0 -23
- data/spec/views/admin/users/create.js.haml_spec.rb +0 -41
- data/spec/views/admin/users/destroy.js.haml_spec.rb +0 -47
- data/spec/views/admin/users/edit.js.haml_spec.rb +0 -44
- data/spec/views/admin/users/index.haml_spec.rb +0 -22
- data/spec/views/admin/users/index.js.haml_spec.rb +0 -26
- data/spec/views/admin/users/new.js.haml_spec.rb +0 -34
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +0 -22
- data/spec/views/admin/users/show.haml_spec.rb +0 -18
- data/spec/views/admin/users/suspend.js.haml_spec.rb +0 -22
- data/spec/views/admin/users/update.js.haml_spec.rb +0 -37
- data/spec/views/application/auto_complete.haml_spec.rb +0 -48
- data/spec/views/campaigns/_edit.haml_spec.rb +0 -44
- data/spec/views/campaigns/_new.haml_spec.rb +0 -41
- data/spec/views/campaigns/create.js.haml_spec.rb +0 -49
- data/spec/views/campaigns/destroy.js.haml_spec.rb +0 -31
- data/spec/views/campaigns/edit.js.haml_spec.rb +0 -66
- data/spec/views/campaigns/index.haml_spec.rb +0 -37
- data/spec/views/campaigns/index.js.haml_spec.rb +0 -34
- data/spec/views/campaigns/new.js.haml_spec.rb +0 -50
- data/spec/views/campaigns/show.haml_spec.rb +0 -38
- data/spec/views/campaigns/update.js.haml_spec.rb +0 -78
- data/spec/views/comments/edit.js.haml_spec.rb +0 -30
- data/spec/views/contacts/_edit.haml_spec.rb +0 -73
- data/spec/views/contacts/_new.haml_spec.rb +0 -52
- data/spec/views/contacts/create.js.haml_spec.rb +0 -65
- data/spec/views/contacts/destroy.js.haml_spec.rb +0 -45
- data/spec/views/contacts/edit.js.haml_spec.rb +0 -74
- data/spec/views/contacts/index.haml_spec.rb +0 -37
- data/spec/views/contacts/index.js.html_spec.rb +0 -34
- data/spec/views/contacts/new.js.haml_spec.rb +0 -47
- data/spec/views/contacts/show.haml_spec.rb +0 -35
- data/spec/views/contacts/update.js.haml_spec.rb +0 -128
- data/spec/views/home/index.haml_spec.rb +0 -36
- data/spec/views/home/index.js.haml_spec.rb +0 -33
- data/spec/views/home/options.js.haml_spec.rb +0 -53
- data/spec/views/leads/_convert.haml_spec.rb +0 -30
- data/spec/views/leads/_edit.haml_spec.rb +0 -47
- data/spec/views/leads/_new.haml_spec.rb +0 -45
- data/spec/views/leads/_sidebar_show.haml_spec.rb +0 -31
- data/spec/views/leads/convert.js.haml_spec.rb +0 -79
- data/spec/views/leads/create.js.haml_spec.rb +0 -67
- data/spec/views/leads/destroy.js.haml_spec.rb +0 -47
- data/spec/views/leads/edit.js.haml_spec.rb +0 -76
- data/spec/views/leads/index.haml_spec.rb +0 -37
- data/spec/views/leads/index.js.haml_spec.rb +0 -34
- data/spec/views/leads/new.js.haml_spec.rb +0 -47
- data/spec/views/leads/promote.js.haml_spec.rb +0 -135
- data/spec/views/leads/reject.js.haml_spec.rb +0 -45
- data/spec/views/leads/show.haml_spec.rb +0 -32
- data/spec/views/leads/update.js.haml_spec.rb +0 -118
- data/spec/views/opportunities/_edit.haml_spec.rb +0 -70
- data/spec/views/opportunities/_new.haml_spec.rb +0 -51
- data/spec/views/opportunities/create.js.haml_spec.rb +0 -86
- data/spec/views/opportunities/destroy.js.haml_spec.rb +0 -64
- data/spec/views/opportunities/edit.js.haml_spec.rb +0 -75
- data/spec/views/opportunities/index.haml_spec.rb +0 -38
- data/spec/views/opportunities/index.js.haml_spec.rb +0 -35
- data/spec/views/opportunities/new.js.haml_spec.rb +0 -54
- data/spec/views/opportunities/show.haml_spec.rb +0 -35
- data/spec/views/opportunities/update.js.haml_spec.rb +0 -143
- data/spec/views/tasks/_edit.haml_spec.rb +0 -50
- data/spec/views/tasks/complete.js.haml_spec.rb +0 -67
- data/spec/views/tasks/create.js.haml_spec.rb +0 -119
- data/spec/views/tasks/destroy.js.haml_spec.rb +0 -57
- data/spec/views/tasks/edit.js.haml_spec.rb +0 -76
- data/spec/views/tasks/index.haml_spec.rb +0 -46
- data/spec/views/tasks/new.js.haml_spec.rb +0 -49
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +0 -45
- data/spec/views/tasks/update.js.haml_spec.rb +0 -140
- data/spec/views/users/avatar.js.haml_spec.rb +0 -35
- data/spec/views/users/change_password.js.haml_spec.rb +0 -51
- data/spec/views/users/edit.js.haml_spec.rb +0 -35
- data/spec/views/users/password.js.haml_spec.rb +0 -36
- data/spec/views/users/update.js.haml_spec.rb +0 -46
- data/spec/views/users/upload_avatar.js.haml_spec.rb +0 -45
- data/vendor/gems/globby-0.1.2/LICENSE.txt +0 -20
- data/vendor/gems/globby-0.1.2/README.md +0 -65
- data/vendor/gems/globby-0.1.2/Rakefile +0 -9
- data/vendor/gems/globby-0.1.2/lib/globby/glob.rb +0 -90
- data/vendor/gems/globby-0.1.2/lib/globby/globject.rb +0 -18
- data/vendor/gems/globby-0.1.2/lib/globby/result.rb +0 -20
- data/vendor/gems/globby-0.1.2/lib/globby.rb +0 -47
- data/vendor/gems/globby-0.1.2/spec/gitignore_spec.rb +0 -109
- data/vendor/gems/globby-0.1.2/spec/globby_spec.rb +0 -93
- data/zeus.json +0 -22
- /data/{spec/fixtures/rails.png → public/avatars/User/2/original_rails.png} +0 -0
@@ -1,314 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
# == Schema Information
|
9
|
-
#
|
10
|
-
# Table name: contacts
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# user_id :integer
|
14
|
-
# lead_id :integer
|
15
|
-
# assigned_to :integer
|
16
|
-
# reports_to :integer
|
17
|
-
# first_name :string(64) default(""), not null
|
18
|
-
# last_name :string(64) default(""), not null
|
19
|
-
# access :string(8) default("Public")
|
20
|
-
# title :string(64)
|
21
|
-
# department :string(64)
|
22
|
-
# source :string(32)
|
23
|
-
# email :string(64)
|
24
|
-
# alt_email :string(64)
|
25
|
-
# phone :string(32)
|
26
|
-
# mobile :string(32)
|
27
|
-
# fax :string(32)
|
28
|
-
# blog :string(128)
|
29
|
-
# linkedin :string(128)
|
30
|
-
# facebook :string(128)
|
31
|
-
# twitter :string(128)
|
32
|
-
# born_on :date
|
33
|
-
# do_not_call :boolean default(FALSE), not null
|
34
|
-
# deleted_at :datetime
|
35
|
-
# created_at :datetime
|
36
|
-
# updated_at :datetime
|
37
|
-
# background_info :string(255)
|
38
|
-
# skype :string(128)
|
39
|
-
#
|
40
|
-
|
41
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
42
|
-
|
43
|
-
describe Contact do
|
44
|
-
let(:user) { create(:user) }
|
45
|
-
|
46
|
-
it "should create a new instance given valid attributes" do
|
47
|
-
Contact.create!(first_name: "Billy", last_name: "Bones", user: user)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "must create a new instance for a given model" do
|
51
|
-
lead = create(:lead)
|
52
|
-
account = create(:account)
|
53
|
-
opportunity = create(:opportunity)
|
54
|
-
@contact = Contact.create_for(lead, account, opportunity, account: {})
|
55
|
-
expect(@contact.valid?).to eq true
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "Update existing contact" do
|
59
|
-
before(:each) do
|
60
|
-
@contact = create(:contact, account: create(:account))
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should create new account if requested so" do
|
64
|
-
expect do
|
65
|
-
@contact.update_with_account_and_permissions(
|
66
|
-
account: { name: "New account" },
|
67
|
-
contact: { first_name: "Billy" }
|
68
|
-
)
|
69
|
-
end.to change(Account, :count).by(1)
|
70
|
-
expect(Account.last.name).to eq("New account")
|
71
|
-
expect(@contact.first_name).to eq("Billy")
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should change account if another account was selected" do
|
75
|
-
@another_account = create(:account)
|
76
|
-
expect do
|
77
|
-
@contact.update_with_account_and_permissions(
|
78
|
-
account: { id: @another_account.id },
|
79
|
-
contact: { first_name: "Billy" }
|
80
|
-
)
|
81
|
-
end.not_to change(Account, :count)
|
82
|
-
expect(@contact.account).to eq(@another_account)
|
83
|
-
expect(@contact.first_name).to eq("Billy")
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should drop existing Account if [create new account] is blank" do
|
87
|
-
expect do
|
88
|
-
@contact.update_with_account_and_permissions(
|
89
|
-
account: { name: "" },
|
90
|
-
contact: { first_name: "Billy" }
|
91
|
-
)
|
92
|
-
end.not_to change(Account, :count)
|
93
|
-
expect(@contact.account).to eq(nil)
|
94
|
-
expect(@contact.first_name).to eq("Billy")
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should drop existing Account if [-- None --] is selected from list of accounts" do
|
98
|
-
expect do
|
99
|
-
@contact.update_with_account_and_permissions(
|
100
|
-
account: { id: "" },
|
101
|
-
contact: { first_name: "Billy" }
|
102
|
-
)
|
103
|
-
end.not_to change(Account, :count)
|
104
|
-
expect(@contact.account).to eq(nil)
|
105
|
-
expect(@contact.first_name).to eq("Billy")
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should change account if entered name of another account was found" do
|
109
|
-
@another_account = create(:account, name: "Another name")
|
110
|
-
expect do
|
111
|
-
@contact.update_with_account_and_permissions(
|
112
|
-
account: { name: "Another name" },
|
113
|
-
contact: { first_name: "Billy" }
|
114
|
-
)
|
115
|
-
end.not_to change(Account, :count)
|
116
|
-
expect(@contact.account).to eq(@another_account)
|
117
|
-
expect(@contact.first_name).to eq("Billy")
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe "Attach" do
|
122
|
-
before do
|
123
|
-
@contact = create(:contact)
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should return nil when attaching existing asset" do
|
127
|
-
@task = create(:task, asset: @contact)
|
128
|
-
@opportunity = create(:opportunity)
|
129
|
-
@contact.opportunities << @opportunity
|
130
|
-
|
131
|
-
expect(@contact.attach!(@task)).to eq(nil)
|
132
|
-
expect(@contact.attach!(@opportunity)).to eq(nil)
|
133
|
-
end
|
134
|
-
|
135
|
-
it "should return non-empty list of attachments when attaching new asset" do
|
136
|
-
@task = create(:task)
|
137
|
-
@opportunity = create(:opportunity)
|
138
|
-
|
139
|
-
expect(@contact.attach!(@task)).to eq([@task])
|
140
|
-
expect(@contact.attach!(@opportunity)).to eq([@opportunity])
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe "Discard" do
|
145
|
-
before do
|
146
|
-
@contact = create(:contact)
|
147
|
-
end
|
148
|
-
|
149
|
-
it "should discard a task" do
|
150
|
-
@task = create(:task, asset: @contact)
|
151
|
-
expect(@contact.tasks.count).to eq(1)
|
152
|
-
|
153
|
-
@contact.discard!(@task)
|
154
|
-
expect(@contact.reload.tasks).to eq([])
|
155
|
-
expect(@contact.tasks.count).to eq(0)
|
156
|
-
end
|
157
|
-
|
158
|
-
it "should discard an opportunity" do
|
159
|
-
@opportunity = create(:opportunity)
|
160
|
-
@contact.opportunities << @opportunity
|
161
|
-
expect(@contact.opportunities.count).to eq(1)
|
162
|
-
|
163
|
-
@contact.discard!(@opportunity)
|
164
|
-
expect(@contact.opportunities).to eq([])
|
165
|
-
expect(@contact.opportunities.count).to eq(0)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
describe "Exportable" do
|
170
|
-
describe "assigned contact" do
|
171
|
-
let(:contact1) { build(:contact, assignee: create(:user)) }
|
172
|
-
let(:contact2) { build(:contact, user: create(:user, first_name: nil, last_name: nil), assignee: create(:user, first_name: nil, last_name: nil)) }
|
173
|
-
it_should_behave_like("exportable") do
|
174
|
-
let(:exported) { [contact1, contact2] }
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
describe "unassigned contact" do
|
179
|
-
let(:contact1) { build(:contact, assignee: nil) }
|
180
|
-
let(:contact2) { build(:contact, user: create(:user, first_name: nil, last_name: nil), assignee: nil) }
|
181
|
-
it_should_behave_like("exportable") do
|
182
|
-
let(:exported) { [contact1, contact2] }
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
describe "permissions" do
|
188
|
-
it_should_behave_like Ability, Contact
|
189
|
-
end
|
190
|
-
|
191
|
-
describe "text_search" do
|
192
|
-
before do
|
193
|
-
@contact = create(:contact, first_name: "Bob", last_name: "Dillion", email: 'bob_dillion@example.com', phone: '+1 123 456 789')
|
194
|
-
end
|
195
|
-
|
196
|
-
it "should search first_name" do
|
197
|
-
expect(Contact.text_search('Bob')).to eq([@contact])
|
198
|
-
end
|
199
|
-
|
200
|
-
it "should search last_name" do
|
201
|
-
expect(Contact.text_search('Dillion')).to eq([@contact])
|
202
|
-
end
|
203
|
-
|
204
|
-
it "should search whole name" do
|
205
|
-
expect(Contact.text_search('Bob Dillion')).to eq([@contact])
|
206
|
-
end
|
207
|
-
|
208
|
-
it "should search whole name reversed" do
|
209
|
-
expect(Contact.text_search('Dillion Bob')).to eq([@contact])
|
210
|
-
end
|
211
|
-
|
212
|
-
it "should search email" do
|
213
|
-
expect(Contact.text_search('example')).to eq([@contact])
|
214
|
-
end
|
215
|
-
|
216
|
-
it "should search phone" do
|
217
|
-
expect(Contact.text_search('123')).to eq([@contact])
|
218
|
-
end
|
219
|
-
|
220
|
-
it "should not break with a single quote" do
|
221
|
-
contact2 = create(:contact, first_name: "Shamus", last_name: "O'Connell", email: 'bob_dillion@example.com', phone: '+1 123 456 789')
|
222
|
-
expect(Contact.text_search("O'Connell")).to eq([contact2])
|
223
|
-
end
|
224
|
-
|
225
|
-
it "should not break on special characters" do
|
226
|
-
expect(Contact.text_search('@$%#^@!')).to eq([])
|
227
|
-
end
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
describe "field validations" do
|
232
|
-
let(:new_record) do
|
233
|
-
Contact.new(
|
234
|
-
first_name: "ChristopherChristopherChristopherChristopherChristopherChristopherChristopher",
|
235
|
-
last_name: "BonesBonesBonesBonesBonesBonesBonesBonesBonesBonesBonesBonesBonesBonesBonesBones",
|
236
|
-
title: 'This is a really long title for the contact and it should thow an error.',
|
237
|
-
department: 'This is a really long name for the department and it should thow an error.',
|
238
|
-
email: 'bob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillion@example.com',
|
239
|
-
alt_email: 'bob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillionbob_dillion@example.com',
|
240
|
-
phone: '+1 123 456 7891 123 456 7891 123 456 7891 123 456 7891 123 456 789',
|
241
|
-
mobile: '+1 123 456 7891 123 456 7891 123 456 7891 123 456 7891 123 456 789',
|
242
|
-
fax: '+1 123 456 7891 123 456 7891 123 456 789 123 456 7891 123 456 789',
|
243
|
-
blog: 'This is a test of how many characters before it throws an error message.This is a test of how many characters before it throws an error message.This is a test of how many characters before it throws an error message.',
|
244
|
-
linkedin: 'This is my linkedin name and it is way to long. This is my linkedin name and it is way to long. This is my linkedin name and it is way to long.',
|
245
|
-
twitter: 'This is my twitter name and it is way to long. This is my twitter name and it is way to long. This is my twitter name and it is way to long.',
|
246
|
-
skype: 'This is my skype name and it is way to long. This is my skype name and it is way to long. This is my skype name and it is way to long.'
|
247
|
-
)
|
248
|
-
end
|
249
|
-
|
250
|
-
it "validate first_name max_length 64" do
|
251
|
-
expect(new_record).to_not be_valid
|
252
|
-
expect(new_record.errors.messages[:first_name]).to include("is too long (maximum is 64 characters)")
|
253
|
-
end
|
254
|
-
|
255
|
-
it "validate last_name max_length 64" do
|
256
|
-
expect(new_record).to_not be_valid
|
257
|
-
expect(new_record.errors.messages[:last_name]).to include("is too long (maximum is 64 characters)")
|
258
|
-
end
|
259
|
-
|
260
|
-
it "validate title max_length 64" do
|
261
|
-
expect(new_record).to_not be_valid
|
262
|
-
expect(new_record.errors.messages[:title]).to include("is too long (maximum is 64 characters)")
|
263
|
-
end
|
264
|
-
|
265
|
-
it "validate department max_length 254" do
|
266
|
-
expect(new_record).to_not be_valid
|
267
|
-
expect(new_record.errors.messages[:department]).to include("is too long (maximum is 64 characters)")
|
268
|
-
end
|
269
|
-
|
270
|
-
it "validate email max_length 254" do
|
271
|
-
expect(new_record).to_not be_valid
|
272
|
-
expect(new_record.errors.messages[:email]).to include("is too long (maximum is 254 characters)")
|
273
|
-
end
|
274
|
-
|
275
|
-
it "validate alt_email max_length 254" do
|
276
|
-
expect(new_record).to_not be_valid
|
277
|
-
expect(new_record.errors.messages[:alt_email]).to include("is too long (maximum is 254 characters)")
|
278
|
-
end
|
279
|
-
|
280
|
-
it "validate phone max_length 32" do
|
281
|
-
expect(new_record).to_not be_valid
|
282
|
-
expect(new_record.errors.messages[:phone]).to include("is too long (maximum is 32 characters)")
|
283
|
-
end
|
284
|
-
|
285
|
-
it "validate mobile max_length 32" do
|
286
|
-
expect(new_record).to_not be_valid
|
287
|
-
expect(new_record.errors.messages[:mobile]).to include("is too long (maximum is 32 characters)")
|
288
|
-
end
|
289
|
-
|
290
|
-
it "validate fax max_length 32" do
|
291
|
-
expect(new_record).to_not be_valid
|
292
|
-
expect(new_record.errors.messages[:fax]).to include("is too long (maximum is 32 characters)")
|
293
|
-
end
|
294
|
-
|
295
|
-
it "validate blog max_length 128" do
|
296
|
-
expect(new_record).to_not be_valid
|
297
|
-
expect(new_record.errors.messages[:blog]).to include("is too long (maximum is 128 characters)")
|
298
|
-
end
|
299
|
-
|
300
|
-
it "validate linkedin max_length 128" do
|
301
|
-
expect(new_record).to_not be_valid
|
302
|
-
expect(new_record.errors.messages[:linkedin]).to include("is too long (maximum is 128 characters)")
|
303
|
-
end
|
304
|
-
|
305
|
-
it "validate twitter max_length 128" do
|
306
|
-
expect(new_record).to_not be_valid
|
307
|
-
expect(new_record.errors.messages[:twitter]).to include("is too long (maximum is 128 characters)")
|
308
|
-
end
|
309
|
-
|
310
|
-
it "validate skype max_length 128" do
|
311
|
-
expect(new_record).to_not be_valid
|
312
|
-
expect(new_record.errors.messages[:skype]).to include("is too long (maximum is 128 characters)")
|
313
|
-
end
|
314
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
# == Schema Information
|
9
|
-
#
|
10
|
-
# Table name: leads
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# user_id :integer
|
14
|
-
# campaign_id :integer
|
15
|
-
# assigned_to :integer
|
16
|
-
# first_name :string(64) default(""), not null
|
17
|
-
# last_name :string(64) default(""), not null
|
18
|
-
# access :string(8) default("Public")
|
19
|
-
# title :string(64)
|
20
|
-
# company :string(64)
|
21
|
-
# source :string(32)
|
22
|
-
# status :string(32)
|
23
|
-
# referred_by :string(64)
|
24
|
-
# email :string(64)
|
25
|
-
# alt_email :string(64)
|
26
|
-
# phone :string(32)
|
27
|
-
# mobile :string(32)
|
28
|
-
# blog :string(128)
|
29
|
-
# linkedin :string(128)
|
30
|
-
# facebook :string(128)
|
31
|
-
# twitter :string(128)
|
32
|
-
# rating :integer default(0), not null
|
33
|
-
# do_not_call :boolean default(FALSE), not null
|
34
|
-
# deleted_at :datetime
|
35
|
-
# created_at :datetime
|
36
|
-
# updated_at :datetime
|
37
|
-
# background_info :string(255)
|
38
|
-
# skype :string(128)
|
39
|
-
#
|
40
|
-
|
41
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
42
|
-
|
43
|
-
describe Lead do
|
44
|
-
it "should create a new instance given valid attributes" do
|
45
|
-
Lead.create!(first_name: "Billy", last_name: "Bones")
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "Attach" do
|
49
|
-
before do
|
50
|
-
@lead = create(:lead)
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should return nil when attaching existing task" do
|
54
|
-
@task = create(:task, asset: @lead)
|
55
|
-
|
56
|
-
expect(@lead.attach!(@task)).to eq(nil)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should return non-empty list of tasks when attaching new task" do
|
60
|
-
@task = create(:task)
|
61
|
-
|
62
|
-
expect(@lead.attach!(@task)).to eq([@task])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "Discard" do
|
67
|
-
before do
|
68
|
-
@lead = create(:lead)
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should discard a task" do
|
72
|
-
@task = create(:task, asset: @lead)
|
73
|
-
expect(@lead.tasks.count).to eq(1)
|
74
|
-
|
75
|
-
@lead.discard!(@task)
|
76
|
-
expect(@lead.reload.tasks).to eq([])
|
77
|
-
expect(@lead.tasks.count).to eq(0)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe "Exportable" do
|
82
|
-
describe "assigned lead" do
|
83
|
-
let(:lead1) { build(:lead, assignee: create(:user)) }
|
84
|
-
let(:lead2) { build(:lead, user: create(:user, first_name: nil, last_name: nil), assignee: create(:user, first_name: nil, last_name: nil)) }
|
85
|
-
it_should_behave_like("exportable") do
|
86
|
-
let(:exported) { [lead1, lead2] }
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "unassigned lead" do
|
91
|
-
let(:lead1) { build(:lead, assignee: nil) }
|
92
|
-
let(:lead2) { build(:lead, user: create(:user, first_name: nil, last_name: nil), assignee: nil) }
|
93
|
-
it_should_behave_like("exportable") do
|
94
|
-
let(:exported) { [lead1, lead2] }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
describe "permissions" do
|
100
|
-
it_should_behave_like Ability, Lead
|
101
|
-
end
|
102
|
-
end
|