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,34 +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: account_contacts
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# account_id :integer
|
14
|
-
# contact_id :integer
|
15
|
-
# deleted_at :datetime
|
16
|
-
# created_at :datetime
|
17
|
-
# updated_at :datetime
|
18
|
-
#
|
19
|
-
|
20
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
21
|
-
|
22
|
-
describe AccountContact do
|
23
|
-
before(:each) do
|
24
|
-
@valid_attributes = {
|
25
|
-
account: mock_model(Account),
|
26
|
-
contact: mock_model(Contact)
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should create a new instance given valid attributes" do
|
31
|
-
expect(@valid_attributes[:account]).to receive(:increment!)
|
32
|
-
AccountContact.create!(@valid_attributes)
|
33
|
-
end
|
34
|
-
end
|
@@ -1,34 +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: account_opportunities
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# account_id :integer
|
14
|
-
# opportunity_id :integer
|
15
|
-
# deleted_at :datetime
|
16
|
-
# created_at :datetime
|
17
|
-
# updated_at :datetime
|
18
|
-
#
|
19
|
-
|
20
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
21
|
-
|
22
|
-
describe AccountOpportunity do
|
23
|
-
before(:each) do
|
24
|
-
@valid_attributes = {
|
25
|
-
account: mock_model(Account),
|
26
|
-
opportunity: mock_model(Opportunity)
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should create a new instance given valid attributes" do
|
31
|
-
expect(@valid_attributes[:account]).to receive(:increment!)
|
32
|
-
AccountOpportunity.create!(@valid_attributes)
|
33
|
-
end
|
34
|
-
end
|
@@ -1,206 +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: accounts
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# user_id :integer
|
14
|
-
# assigned_to :integer
|
15
|
-
# name :string(64) default(""), not null
|
16
|
-
# access :string(8) default("Public")
|
17
|
-
# website :string(64)
|
18
|
-
# toll_free_phone :string(32)
|
19
|
-
# phone :string(32)
|
20
|
-
# fax :string(32)
|
21
|
-
# deleted_at :datetime
|
22
|
-
# created_at :datetime
|
23
|
-
# updated_at :datetime
|
24
|
-
# email :string(64)
|
25
|
-
# background_info :string(255)
|
26
|
-
# rating :integer default(0), not null
|
27
|
-
# category :string(32)
|
28
|
-
#
|
29
|
-
|
30
|
-
require 'spec_helper'
|
31
|
-
|
32
|
-
describe Account do
|
33
|
-
it "should create a new instance given valid attributes" do
|
34
|
-
Account.create!(name: "Test Account")
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "Creating or selecting" do
|
38
|
-
it "must create a new account" do
|
39
|
-
@account = Account.create_or_select_for(nil, name: "Account T")
|
40
|
-
|
41
|
-
expect(Account.count).to eq(1)
|
42
|
-
expect(Account.first).to eq(@account)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "must select an existing account based on id" do
|
46
|
-
@account = create(:account)
|
47
|
-
|
48
|
-
expect(Account.create_or_select_for(nil, id: @account.id)).to eq(@account)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "must select an existing account based on name" do
|
52
|
-
@account = create(:account)
|
53
|
-
|
54
|
-
expect(Account.create_or_select_for(nil, name: @account.name)).to eq(@account)
|
55
|
-
end
|
56
|
-
|
57
|
-
it "must create a new account based on existing model" do
|
58
|
-
@contact = create(:contact)
|
59
|
-
@account = Account.create_or_select_for(@contact, name: "Account T")
|
60
|
-
expect(@account.user).to eq(@contact.user)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "Attach" do
|
65
|
-
before do
|
66
|
-
@account = create(:account)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should return nil when attaching existing asset" do
|
70
|
-
@task = create(:task, asset: @account)
|
71
|
-
@contact = create(:contact)
|
72
|
-
@account.contacts << @contact
|
73
|
-
@opportunity = create(:opportunity)
|
74
|
-
@account.opportunities << @opportunity
|
75
|
-
|
76
|
-
expect(@account.attach!(@task)).to eq(nil)
|
77
|
-
expect(@account.attach!(@contact)).to eq(nil)
|
78
|
-
expect(@account.attach!(@opportunity)).to eq(nil)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should return non-empty list of attachments when attaching new asset" do
|
82
|
-
@task = create(:task)
|
83
|
-
@contact = create(:contact)
|
84
|
-
@opportunity = create(:opportunity)
|
85
|
-
|
86
|
-
expect(@account.attach!(@task)).to eq([@task])
|
87
|
-
expect(@account.attach!(@contact)).to eq([@contact])
|
88
|
-
expect(@account.attach!(@opportunity)).to eq([@opportunity])
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "Discard" do
|
93
|
-
before do
|
94
|
-
@account = create(:account)
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should discard a task" do
|
98
|
-
@task = create(:task, asset: @account)
|
99
|
-
expect(@account.tasks.count).to eq(1)
|
100
|
-
|
101
|
-
@account.discard!(@task)
|
102
|
-
expect(@account.reload.tasks).to eq([])
|
103
|
-
expect(@account.tasks.count).to eq(0)
|
104
|
-
end
|
105
|
-
|
106
|
-
it "should discard a contact" do
|
107
|
-
@contact = create(:contact)
|
108
|
-
@account.contacts << @contact
|
109
|
-
expect(@account.contacts.count).to eq(1)
|
110
|
-
|
111
|
-
@account.discard!(@contact)
|
112
|
-
expect(@account.contacts).to eq([])
|
113
|
-
expect(@account.contacts.count).to eq(0)
|
114
|
-
end
|
115
|
-
|
116
|
-
# Commented out this test. "super from singleton method that is defined to multiple classes is not supported;"
|
117
|
-
# ------------------------------------------------------
|
118
|
-
# it "should discard an opportunity" do
|
119
|
-
# @opportunity = create(:opportunity)
|
120
|
-
# @account.opportunities << @opportunity
|
121
|
-
# @account.opportunities.count.should == 1
|
122
|
-
|
123
|
-
# @account.discard!(@opportunity)
|
124
|
-
# @account.opportunities.should == []
|
125
|
-
# @account.opportunities.count.should == 0
|
126
|
-
# end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe "Exportable" do
|
130
|
-
describe "assigned account" do
|
131
|
-
let(:account1) { build(:account, assignee: create(:user)) }
|
132
|
-
let(:account2) { build(:account, user: create(:user, first_name: nil, last_name: nil), assignee: create(:user, first_name: nil, last_name: nil)) }
|
133
|
-
it_should_behave_like("exportable") do
|
134
|
-
let(:exported) { [account1, account2] }
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe "unassigned account" do
|
139
|
-
let(:account1) { build(:account, assignee: nil) }
|
140
|
-
let(:account2) { build(:account, user: create(:user, first_name: nil, last_name: nil), assignee: nil) }
|
141
|
-
it_should_behave_like("exportable") do
|
142
|
-
let(:exported) { [account1, account2] }
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
describe "Before save" do
|
148
|
-
it "create new: should replace empty category string with nil" do
|
149
|
-
account = build(:account, category: '')
|
150
|
-
account.save
|
151
|
-
expect(account.category).to eq(nil)
|
152
|
-
end
|
153
|
-
|
154
|
-
it "update existing: should replace empty category string with nil" do
|
155
|
-
account = create(:account, category: '')
|
156
|
-
account.save
|
157
|
-
expect(account.category).to eq(nil)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe "permissions" do
|
162
|
-
it_should_behave_like Ability, Account
|
163
|
-
end
|
164
|
-
|
165
|
-
describe "scopes" do
|
166
|
-
context "visible_on_dashboard" do
|
167
|
-
before do
|
168
|
-
@another_user = create(:user)
|
169
|
-
@user = create(:user)
|
170
|
-
@a1 = create(:account, user: @user)
|
171
|
-
@a2 = create(:account, user: @user, assignee: @another_user)
|
172
|
-
@a3 = create(:account, assignee: @user)
|
173
|
-
@a4 = create(:account, assignee: @another_user)
|
174
|
-
@a5 = create(:account, assignee: @user)
|
175
|
-
end
|
176
|
-
|
177
|
-
it "should show accounts which have been created by the user and are unassigned" do
|
178
|
-
expect(Account.visible_on_dashboard(@user)).to include(@a1)
|
179
|
-
end
|
180
|
-
|
181
|
-
it "should show accounts which are assigned to the user" do
|
182
|
-
expect(Account.visible_on_dashboard(@user)).to include(@a3, @a5)
|
183
|
-
end
|
184
|
-
|
185
|
-
it "should not show accounts which are not assigned to the user" do
|
186
|
-
expect(Account.visible_on_dashboard(@user)).not_to include(@a4)
|
187
|
-
end
|
188
|
-
|
189
|
-
it "should not show accounts which are created by the user but assigned" do
|
190
|
-
expect(Account.visible_on_dashboard(@user)).not_to include(@a2)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
context "by_name" do
|
195
|
-
it "should show accounts ordered by name" do
|
196
|
-
@a1 = create(:account, name: "Account A")
|
197
|
-
@a2 = create(:account, name: "Account Z")
|
198
|
-
@a3 = create(:account, name: "Account J")
|
199
|
-
@a4 = create(:account, name: "Account X")
|
200
|
-
@a5 = create(:account, name: "Account L")
|
201
|
-
|
202
|
-
expect(Account.by_name).to eq([@a1, @a3, @a5, @a4, @a2])
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
@@ -1,131 +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: campaigns
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# user_id :integer
|
14
|
-
# assigned_to :integer
|
15
|
-
# name :string(64) default(""), not null
|
16
|
-
# access :string(8) default("Public")
|
17
|
-
# status :string(64)
|
18
|
-
# budget :decimal(12, 2)
|
19
|
-
# target_leads :integer
|
20
|
-
# target_conversion :float
|
21
|
-
# target_revenue :decimal(12, 2)
|
22
|
-
# leads_count :integer
|
23
|
-
# opportunities_count :integer
|
24
|
-
# revenue :decimal(12, 2)
|
25
|
-
# starts_on :date
|
26
|
-
# ends_on :date
|
27
|
-
# objectives :text
|
28
|
-
# deleted_at :datetime
|
29
|
-
# created_at :datetime
|
30
|
-
# updated_at :datetime
|
31
|
-
# background_info :string(255)
|
32
|
-
#
|
33
|
-
|
34
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
35
|
-
|
36
|
-
describe Campaign do
|
37
|
-
it "should create a new instance given valid attributes" do
|
38
|
-
Campaign.create!(name: "Campaign")
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "Attach" do
|
42
|
-
before do
|
43
|
-
@campaign = create(:campaign)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should return nil when attaching existing asset" do
|
47
|
-
expect(@campaign.attach!(create(:task, asset: @campaign))).to eq(nil)
|
48
|
-
expect(@campaign.attach!(create(:lead, campaign: @campaign))).to eq(nil)
|
49
|
-
expect(@campaign.attach!(create(:opportunity, campaign: @campaign))).to eq(nil)
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should return non-empty list of attachments when attaching new asset" do
|
53
|
-
@task = create(:task)
|
54
|
-
@lead = create(:lead)
|
55
|
-
@opportunity = create(:opportunity)
|
56
|
-
|
57
|
-
expect(@campaign.attach!(@task)).to eq([@task])
|
58
|
-
expect(@campaign.attach!(@lead)).to eq([@lead])
|
59
|
-
expect(@campaign.attach!(@opportunity)).to eq([@opportunity])
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should increment leads count when attaching a new lead" do
|
63
|
-
@leads_count = @campaign.leads_count
|
64
|
-
|
65
|
-
@campaign.attach!(create(:lead))
|
66
|
-
expect(@campaign.reload.leads_count).to eq(@leads_count + 1)
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should increment opportunities count when attaching new opportunity" do
|
70
|
-
@opportunities_count = @campaign.opportunities_count
|
71
|
-
@opportunity = create(:opportunity)
|
72
|
-
@campaign.attach!(@opportunity)
|
73
|
-
expect(@campaign.reload.opportunities_count).to eq(@opportunities_count + 1)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "Detach" do
|
78
|
-
before do
|
79
|
-
@campaign = create(:campaign, leads_count: 42, opportunities_count: 42)
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should discard a task" do
|
83
|
-
@task = create(:task, asset: @campaign)
|
84
|
-
expect(@campaign.tasks.count).to eq(1)
|
85
|
-
|
86
|
-
@campaign.discard!(@task)
|
87
|
-
expect(@campaign.reload.tasks).to eq([])
|
88
|
-
expect(@campaign.tasks.count).to eq(0)
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should discard a lead" do
|
92
|
-
@lead = create(:lead, campaign: @campaign)
|
93
|
-
expect(@campaign.reload.leads_count).to eq(43)
|
94
|
-
|
95
|
-
@campaign.discard!(@lead)
|
96
|
-
expect(@campaign.leads).to eq([])
|
97
|
-
expect(@campaign.reload.leads_count).to eq(42)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should discard an opportunity" do
|
101
|
-
@opportunity = create(:opportunity, campaign: @campaign)
|
102
|
-
expect(@campaign.reload.opportunities_count).to eq(43)
|
103
|
-
|
104
|
-
@campaign.discard!(@opportunity)
|
105
|
-
expect(@campaign.opportunities).to eq([])
|
106
|
-
expect(@campaign.reload.opportunities_count).to eq(42)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "Exportable" do
|
111
|
-
describe "assigned campaign" do
|
112
|
-
let(:campaign1) { build(:campaign, user: create(:user, first_name: "John", last_name: "Smith"), assignee: create(:user)) }
|
113
|
-
let(:campaign2) { build(:campaign, user: create(:user, first_name: nil, last_name: nil), assignee: create(:user, first_name: nil, last_name: nil)) }
|
114
|
-
it_should_behave_like("exportable") do
|
115
|
-
let(:exported) { [campaign1, campaign2] }
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe "unassigned campaign" do
|
120
|
-
let(:campaign1) { build(:campaign, user: create(:user), assignee: nil) }
|
121
|
-
let(:campaign2) { build(:campaign, user: create(:user, first_name: nil, last_name: nil), assignee: nil) }
|
122
|
-
it_should_behave_like("exportable") do
|
123
|
-
let(:exported) { [campaign1, campaign2] }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "permissions" do
|
129
|
-
it_should_behave_like Ability, Campaign
|
130
|
-
end
|
131
|
-
end
|
@@ -1,34 +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: contact_opportunities
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# contact_id :integer
|
14
|
-
# opportunity_id :integer
|
15
|
-
# role :string(32)
|
16
|
-
# deleted_at :datetime
|
17
|
-
# created_at :datetime
|
18
|
-
# updated_at :datetime
|
19
|
-
#
|
20
|
-
|
21
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
22
|
-
|
23
|
-
describe ContactOpportunity do
|
24
|
-
before(:each) do
|
25
|
-
@valid_attributes = {
|
26
|
-
contact: mock_model(Contact),
|
27
|
-
opportunity: mock_model(Opportunity)
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should create a new instance given valid attributes" do
|
32
|
-
ContactOpportunity.create!(@valid_attributes)
|
33
|
-
end
|
34
|
-
end
|