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,70 +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
|
-
FactoryBot.define do
|
9
|
-
factory :version do
|
10
|
-
whodunnit { "" }
|
11
|
-
item { raise "Please specify :item for the version" }
|
12
|
-
event { "create" }
|
13
|
-
created_at { FactoryBot.generate(:time) }
|
14
|
-
end
|
15
|
-
|
16
|
-
factory :comment do
|
17
|
-
user
|
18
|
-
commentable { raise "Please specify :commentable for the comment" }
|
19
|
-
title { FactoryBot.generate(:title) }
|
20
|
-
|
21
|
-
private { false }
|
22
|
-
|
23
|
-
comment { FFaker::Lorem.paragraph }
|
24
|
-
state { "Expanded" }
|
25
|
-
updated_at { FactoryBot.generate(:time) }
|
26
|
-
created_at { FactoryBot.generate(:time) }
|
27
|
-
end
|
28
|
-
|
29
|
-
factory :email do
|
30
|
-
imap_message_id { format("%08x", rand(0xFFFFFFFF)) }
|
31
|
-
user
|
32
|
-
mediator { raise "Please specify :mediator for the email" }
|
33
|
-
sent_from { FFaker::Internet.email }
|
34
|
-
sent_to { FFaker::Internet.email }
|
35
|
-
cc { FFaker::Internet.email }
|
36
|
-
bcc { nil }
|
37
|
-
subject { FFaker::Lorem.sentence }
|
38
|
-
body { FFaker::Lorem.paragraph[0, 255] }
|
39
|
-
header { nil }
|
40
|
-
sent_at { FactoryBot.generate(:time) }
|
41
|
-
received_at { FactoryBot.generate(:time) }
|
42
|
-
deleted_at { nil }
|
43
|
-
state { "Expanded" }
|
44
|
-
updated_at { FactoryBot.generate(:time) }
|
45
|
-
created_at { FactoryBot.generate(:time) }
|
46
|
-
end
|
47
|
-
|
48
|
-
factory :address do
|
49
|
-
addressable { raise "Please specify :addressable for the address" }
|
50
|
-
street1 { FFaker::Address.street_address }
|
51
|
-
street2 { FFaker::Address.street_address }
|
52
|
-
city { FFaker::Address.city }
|
53
|
-
state { FFaker::AddressUS.state_abbr }
|
54
|
-
zipcode { FFaker::AddressUS.zip_code }
|
55
|
-
country { FFaker::AddressUK.country }
|
56
|
-
full_address { FactoryBot.generate(:address) }
|
57
|
-
address_type { %w[Business Billing Shipping].sample }
|
58
|
-
updated_at { FactoryBot.generate(:time) }
|
59
|
-
created_at { FactoryBot.generate(:time) }
|
60
|
-
deleted_at { nil }
|
61
|
-
end
|
62
|
-
|
63
|
-
factory :avatar do
|
64
|
-
user
|
65
|
-
entity { raise "Please specify :entity for the avatar" }
|
66
|
-
image { File.new(Rails.root.join('spec', 'fixtures', 'rails.png')) }
|
67
|
-
updated_at { FactoryBot.generate(:time) }
|
68
|
-
created_at { FactoryBot.generate(:time) }
|
69
|
-
end
|
70
|
-
end
|
@@ -1,13 +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
|
-
# Read about factories at https://github.com/thoughtbot/factory_girl
|
9
|
-
|
10
|
-
FactoryBot.define do
|
11
|
-
factory :subscription do
|
12
|
-
end
|
13
|
-
end
|
@@ -1,12 +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
|
-
FactoryBot.define do
|
9
|
-
factory :tag do
|
10
|
-
name { FFaker::Internet.user_name }
|
11
|
-
end
|
12
|
-
end
|
@@ -1,29 +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
|
-
FactoryBot.define do
|
9
|
-
factory :task do
|
10
|
-
user
|
11
|
-
asset { nil }
|
12
|
-
assigned_to { nil }
|
13
|
-
completed_by { nil }
|
14
|
-
name { FFaker::Lorem.sentence[0, 64] }
|
15
|
-
priority { nil }
|
16
|
-
category { %w[call email follow_up lunch meeting money presentation trip].sample }
|
17
|
-
bucket { "due_asap" }
|
18
|
-
due_at { FactoryBot.generate(:time) }
|
19
|
-
background_info { FFaker::Lorem.paragraph[0, 255] }
|
20
|
-
completed_at { nil }
|
21
|
-
deleted_at { nil }
|
22
|
-
updated_at { FactoryBot.generate(:time) }
|
23
|
-
created_at { FactoryBot.generate(:time) }
|
24
|
-
end
|
25
|
-
|
26
|
-
factory :completed_task, parent: :task do
|
27
|
-
completed_at { Date.yesterday }
|
28
|
-
end
|
29
|
-
end
|
@@ -1,66 +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
|
-
FactoryBot.define do
|
9
|
-
factory :user do
|
10
|
-
username { FFaker::InternetSE.user_name_variant_short }
|
11
|
-
email { FFaker::Internet.email }
|
12
|
-
first_name { FFaker::Name.first_name }
|
13
|
-
last_name { FFaker::Name.last_name }
|
14
|
-
title { FactoryBot.generate(:title) }
|
15
|
-
company { FFaker::Company.name }
|
16
|
-
alt_email { FFaker::Internet.email }
|
17
|
-
phone { FFaker::PhoneNumber.phone_number }
|
18
|
-
mobile { FFaker::PhoneNumber.phone_number }
|
19
|
-
aim { nil }
|
20
|
-
yahoo { nil }
|
21
|
-
google { nil }
|
22
|
-
skype { nil }
|
23
|
-
admin { false }
|
24
|
-
encrypted_password { SecureRandom.hex(64) }
|
25
|
-
password_salt { SecureRandom.hex(64) }
|
26
|
-
last_sign_in_at { FactoryBot.generate(:time) }
|
27
|
-
current_sign_in_at { FactoryBot.generate(:time) }
|
28
|
-
last_sign_in_ip { "127.0.0.1" }
|
29
|
-
current_sign_in_ip { "127.0.0.1" }
|
30
|
-
sign_in_count { rand(1..100) }
|
31
|
-
deleted_at { nil }
|
32
|
-
updated_at { FactoryBot.generate(:time) }
|
33
|
-
created_at { FactoryBot.generate(:time) }
|
34
|
-
suspended_at { nil }
|
35
|
-
password { "password" }
|
36
|
-
password_confirmation { "password" }
|
37
|
-
|
38
|
-
# For unit tests, we dont need to enforce uniqueness
|
39
|
-
to_create { |instance| instance.save(validate: false) }
|
40
|
-
end
|
41
|
-
|
42
|
-
factory :admin do
|
43
|
-
admin { true }
|
44
|
-
end
|
45
|
-
|
46
|
-
factory :permission do
|
47
|
-
user
|
48
|
-
asset { raise "Please specify :asset for the permission" }
|
49
|
-
updated_at { FactoryBot.generate(:time) }
|
50
|
-
created_at { FactoryBot.generate(:time) }
|
51
|
-
end
|
52
|
-
|
53
|
-
factory :preference do
|
54
|
-
user
|
55
|
-
name { raise "Please specify :name for the preference" }
|
56
|
-
value { raise "Please specify :value for the preference" }
|
57
|
-
updated_at { FactoryBot.generate(:time) }
|
58
|
-
created_at { FactoryBot.generate(:time) }
|
59
|
-
end
|
60
|
-
|
61
|
-
factory :group do
|
62
|
-
name { FFaker::Company.name }
|
63
|
-
updated_at { FactoryBot.generate(:time) }
|
64
|
-
created_at { FactoryBot.generate(:time) }
|
65
|
-
end
|
66
|
-
end
|
@@ -1,11 +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
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
# Put your acceptance spec helpers inside /spec/features/support
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }
|
@@ -1,126 +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
|
-
require 'features/acceptance_helper'
|
9
|
-
|
10
|
-
feature 'Accounts', '
|
11
|
-
In order to increase customer satisfaction
|
12
|
-
As a user
|
13
|
-
I want to manage accounts
|
14
|
-
' do
|
15
|
-
before(:each) do
|
16
|
-
do_login_if_not_already(first_name: 'Bill', last_name: 'Murray')
|
17
|
-
end
|
18
|
-
|
19
|
-
scenario 'should view a list of accounts' do
|
20
|
-
2.times { |i| create(:account, name: "Account #{i}") }
|
21
|
-
visit accounts_page
|
22
|
-
expect(page).to have_content('Account 0')
|
23
|
-
expect(page).to have_content('Account 1')
|
24
|
-
expect(page).to have_content('Create Account')
|
25
|
-
end
|
26
|
-
|
27
|
-
scenario 'should create a new account', js: true do
|
28
|
-
with_versioning do
|
29
|
-
visit accounts_page
|
30
|
-
expect(page).to have_content('Create Account')
|
31
|
-
click_link 'Create Account'
|
32
|
-
expect(page).to have_selector('#account_name', visible: true)
|
33
|
-
fill_in 'account_name', with: 'My new account'
|
34
|
-
select2 'Affiliate', from: 'Category:'
|
35
|
-
select2 'Myself', from: 'Assigned to:'
|
36
|
-
click_link 'Contact Information'
|
37
|
-
fill_in 'account_phone', with: '+1 2345 6789'
|
38
|
-
fill_in 'account_website', with: 'http://www.example.com'
|
39
|
-
click_link 'Comment'
|
40
|
-
fill_in 'comment_body', with: 'This account is very important'
|
41
|
-
click_button 'Create Account'
|
42
|
-
|
43
|
-
expect(find('div#accounts')).to have_content('My new account')
|
44
|
-
find('div#accounts').click_link('My new account') # avoid recent items link
|
45
|
-
expect(page).to have_content('+1 2345 6789')
|
46
|
-
expect(page).to have_content('http://www.example.com')
|
47
|
-
expect(page).to have_content('This account is very important')
|
48
|
-
expect(page).to have_content('Affiliate')
|
49
|
-
|
50
|
-
click_link "Dashboard"
|
51
|
-
expect(page).to have_content("Bill Murray created account My new account")
|
52
|
-
expect(page).to have_content("Bill Murray created comment on My new account")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
scenario "remembers the comment field when the creation was unsuccessful", js: true do
|
57
|
-
visit accounts_page
|
58
|
-
expect(page).to have_content('Create Account')
|
59
|
-
click_link 'Create Account'
|
60
|
-
|
61
|
-
click_link 'Contact Information'
|
62
|
-
fill_in 'account_phone', with: '+1 2345 6789'
|
63
|
-
|
64
|
-
click_link 'Comment'
|
65
|
-
fill_in 'comment_body', with: 'This account is very important'
|
66
|
-
click_button "Create Account"
|
67
|
-
|
68
|
-
expect(page).to have_field("account_phone", with: '+1 2345 6789')
|
69
|
-
expect(page).to have_field("comment_body", with: 'This account is very important')
|
70
|
-
end
|
71
|
-
|
72
|
-
scenario 'should view and edit an account', js: true, versioning: true do
|
73
|
-
create(:account, name: "A new account")
|
74
|
-
with_versioning do
|
75
|
-
visit accounts_page
|
76
|
-
find('div#accounts').click_link('A new account')
|
77
|
-
expect(page).to have_content('A new account')
|
78
|
-
click_link 'Edit'
|
79
|
-
fill_in 'account_name', with: 'A new account *editted*'
|
80
|
-
click_button 'Save Account'
|
81
|
-
expect(page).to have_content('A new account *editted*')
|
82
|
-
|
83
|
-
click_link "Dashboard"
|
84
|
-
expect(page).to have_content("Bill Murray updated account A new account *editted*")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
scenario 'should delete an account', js: true do
|
89
|
-
create(:account, name: "My new account")
|
90
|
-
visit accounts_page
|
91
|
-
find('div#accounts').click_link('My new account')
|
92
|
-
click_link 'Delete?'
|
93
|
-
expect(page).to have_content('Are you sure you want to delete this account?')
|
94
|
-
click_link 'Yes'
|
95
|
-
expect(page).to have_content('My new account has been deleted')
|
96
|
-
end
|
97
|
-
|
98
|
-
scenario 'should search for an account', js: true do
|
99
|
-
2.times { |i| create(:account, name: "Account #{i}") }
|
100
|
-
visit accounts_page
|
101
|
-
expect(find('#accounts')).to have_content("Account 0")
|
102
|
-
expect(find('#accounts')).to have_content("Account 1")
|
103
|
-
fill_in 'query', with: "Account 0"
|
104
|
-
expect(find('#accounts')).to have_content("Account 0")
|
105
|
-
expect(find('#accounts')).not_to have_content("Account 1")
|
106
|
-
fill_in 'query', with: "Account"
|
107
|
-
expect(find('#accounts')).to have_content("Account 0")
|
108
|
-
expect(find('#accounts')).to have_content("Account 1")
|
109
|
-
fill_in 'query', with: "Contact"
|
110
|
-
expect(find('#accounts')).not_to have_content("Account 0")
|
111
|
-
expect(find('#accounts')).not_to have_content("Account 1")
|
112
|
-
end
|
113
|
-
|
114
|
-
scenario 'should attach task to account', js: true, versioning: true do
|
115
|
-
create(:task, name: 'Task', user: @user)
|
116
|
-
create(:account, name: 'Account')
|
117
|
-
with_versioning do
|
118
|
-
visit accounts_page
|
119
|
-
expect(find('#accounts')).to have_content("Account")
|
120
|
-
click_link 'Account'
|
121
|
-
click_link 'Select Task'
|
122
|
-
fill_autocomplete('auto_complete_query', with: 'Ta')
|
123
|
-
expect(find('#tasks')).to have_content('Task re: Account')
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,31 +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
|
-
require File.expand_path('../acceptance_helper.rb', __dir__)
|
9
|
-
|
10
|
-
feature 'Groups tab', '
|
11
|
-
In order to increase customer satisfaction
|
12
|
-
As an administrator
|
13
|
-
I want to manage groups
|
14
|
-
' do
|
15
|
-
before(:each) do
|
16
|
-
do_login(first_name: 'Captain', last_name: 'Kirk', admin: true)
|
17
|
-
end
|
18
|
-
|
19
|
-
scenario 'should create a new group', js: true do
|
20
|
-
create(:user, first_name: "Mr", last_name: "Spock")
|
21
|
-
visit admin_groups_path
|
22
|
-
expect(page).to have_content("Couldn't find any Groups.")
|
23
|
-
click_link 'create a new group'
|
24
|
-
expect(page).to have_selector('#group_name', visible: true)
|
25
|
-
fill_in 'group_name', with: 'The Enterprise Bridge'
|
26
|
-
select2 'Mr Spock', from: 'Users'
|
27
|
-
click_button 'Create Group'
|
28
|
-
expect(page).to have_content('The Enterprise Bridge')
|
29
|
-
expect(page).to have_content('members: Mr Spock')
|
30
|
-
end
|
31
|
-
end
|
@@ -1,40 +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
|
-
require File.expand_path('../acceptance_helper.rb', __dir__)
|
9
|
-
|
10
|
-
feature 'Users tab', '
|
11
|
-
In order to increase customer satisfaction
|
12
|
-
As an administrator
|
13
|
-
I want to manage users
|
14
|
-
' do
|
15
|
-
before(:each) do
|
16
|
-
do_login(first_name: 'Captain', last_name: 'Kirk', admin: true)
|
17
|
-
end
|
18
|
-
|
19
|
-
scenario 'should create a new user', js: true do
|
20
|
-
create(:group, name: "Superheroes")
|
21
|
-
visit admin_users_path
|
22
|
-
click_link 'Create User'
|
23
|
-
expect(page).to have_selector('#user_username', visible: true)
|
24
|
-
fill_in 'user_username', with: 'captainthunder'
|
25
|
-
fill_in 'user_email', with: 'lightning@example.com'
|
26
|
-
fill_in 'user_first_name', with: 'Captain'
|
27
|
-
fill_in 'user_last_name', with: 'Thunder'
|
28
|
-
fill_in 'user_password', with: 'password'
|
29
|
-
fill_in 'user_password_confirmation', with: 'password'
|
30
|
-
fill_in 'user_title', with: 'Chief'
|
31
|
-
fill_in 'user_company', with: 'Weather Inc.'
|
32
|
-
select2 'Superheroes', from: 'Groups:'
|
33
|
-
|
34
|
-
click_button 'Create User'
|
35
|
-
expect(find('#users')).to have_content('Captain Thunder')
|
36
|
-
expect(find('#users')).to have_content('Weather Inc.')
|
37
|
-
expect(find('#users')).to have_content('Superheroes')
|
38
|
-
expect(find('#users')).to have_content('lightning@example.com')
|
39
|
-
end
|
40
|
-
end
|
@@ -1,104 +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
|
-
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
|
-
|
10
|
-
feature 'Campaigns', '
|
11
|
-
In order to increase customer satisfaction
|
12
|
-
As a user
|
13
|
-
I want to manage campaigns
|
14
|
-
' do
|
15
|
-
before :each do
|
16
|
-
do_login_if_not_already(first_name: 'Bill', last_name: 'Murray')
|
17
|
-
end
|
18
|
-
|
19
|
-
scenario 'should view a list of campaigns' do
|
20
|
-
3.times { |i| create(:campaign, name: "Campaign #{i}") }
|
21
|
-
visit campaigns_page
|
22
|
-
expect(page).to have_content('Campaign 0')
|
23
|
-
expect(page).to have_content('Campaign 1')
|
24
|
-
expect(page).to have_content('Campaign 2')
|
25
|
-
expect(page).to have_content('Create Campaign')
|
26
|
-
end
|
27
|
-
|
28
|
-
scenario 'should create a campaign', js: true do
|
29
|
-
with_versioning do
|
30
|
-
visit campaigns_page
|
31
|
-
click_link 'Create Campaign'
|
32
|
-
expect(page).to have_selector('#campaign_name', visible: true)
|
33
|
-
fill_in 'campaign_name', with: 'Cool Campaign'
|
34
|
-
select2 'On Hold', from: 'Status:'
|
35
|
-
click_link 'Comment'
|
36
|
-
fill_in 'comment_body', with: 'This campaign is very important'
|
37
|
-
click_button 'Create Campaign'
|
38
|
-
|
39
|
-
expect(page).to have_content('Cool Campaign')
|
40
|
-
expect(page).to have_content('On Hold')
|
41
|
-
|
42
|
-
find('div#campaigns').click_link 'Cool Campaign'
|
43
|
-
expect(page).to have_content('This campaign is very important')
|
44
|
-
|
45
|
-
click_link "Dashboard"
|
46
|
-
expect(page).to have_content("Bill Murray created campaign Cool Campaign")
|
47
|
-
expect(page).to have_content("Bill Murray created comment on Cool Campaign")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
scenario "remembers the comment field when the creation was unsuccessful", js: true do
|
52
|
-
visit campaigns_page
|
53
|
-
click_link 'Create Campaign'
|
54
|
-
|
55
|
-
click_link 'Comment'
|
56
|
-
fill_in 'comment_body', with: 'This campaign is very important'
|
57
|
-
click_button 'Create Campaign'
|
58
|
-
|
59
|
-
expect(find('#comment_body')).to have_content('This campaign is very important')
|
60
|
-
end
|
61
|
-
|
62
|
-
scenario 'should view and edit a campaign', js: true do
|
63
|
-
create(:campaign, name: "My Cool Campaign")
|
64
|
-
with_versioning do
|
65
|
-
visit campaigns_page
|
66
|
-
click_link 'My Cool Campaign'
|
67
|
-
click_link 'Edit'
|
68
|
-
fill_in 'campaign_name', with: 'My Even Cooler Campaign'
|
69
|
-
select2 'Started', from: 'Status:'
|
70
|
-
click_button 'Save Campaign'
|
71
|
-
expect(page).to have_content('My Even Cooler Campaign')
|
72
|
-
expect(page).to have_content('My Even Cooler Campaign')
|
73
|
-
click_link 'Dashboard'
|
74
|
-
expect(page).to have_content("Bill Murray updated campaign My Even Cooler Campaign")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
scenario 'should delete a campaign', js: true do
|
79
|
-
create(:campaign, name: "Old Campaign")
|
80
|
-
visit campaigns_page
|
81
|
-
click_link 'Old Campaign'
|
82
|
-
click_link 'Delete?'
|
83
|
-
expect(page).to have_content('Are you sure you want to delete this campaign?')
|
84
|
-
click_link 'Yes'
|
85
|
-
expect(page).to have_content('Old Campaign has been deleted.')
|
86
|
-
expect(find('div#campaigns')).not_to have_content('Old Campaign')
|
87
|
-
end
|
88
|
-
|
89
|
-
scenario 'should search for a campaign', js: true do
|
90
|
-
2.times { |i| create(:campaign, name: "Campaign #{i}") }
|
91
|
-
visit campaigns_page
|
92
|
-
expect(find('#campaigns')).to have_content("Campaign 0")
|
93
|
-
expect(find('#campaigns')).to have_content("Campaign 1")
|
94
|
-
fill_in 'query', with: "Campaign 0"
|
95
|
-
expect(find('#campaigns')).to have_content("Campaign 0")
|
96
|
-
expect(find('#campaigns')).not_to have_content("Campaign 1")
|
97
|
-
fill_in 'query', with: "Campaign"
|
98
|
-
expect(find('#campaigns')).to have_content("Campaign 0")
|
99
|
-
expect(find('#campaigns')).to have_content("Campaign 1")
|
100
|
-
fill_in 'query', with: "False"
|
101
|
-
expect(find('#campaigns')).not_to have_content("Campaign 0")
|
102
|
-
expect(find('#campaigns')).not_to have_content("Campaign 1")
|
103
|
-
end
|
104
|
-
end
|
@@ -1,134 +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
|
-
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
|
-
|
10
|
-
feature 'Contacts', '
|
11
|
-
In order to increase customer satisfaction
|
12
|
-
As a user
|
13
|
-
I want to manage contacts
|
14
|
-
' do
|
15
|
-
before :each do
|
16
|
-
do_login_if_not_already(first_name: "Bill", last_name: "Murray")
|
17
|
-
end
|
18
|
-
|
19
|
-
scenario 'should view a list of contacts' do
|
20
|
-
4.times { |i| create(:contact, first_name: "Test", last_name: "Subject \##{i}") }
|
21
|
-
visit contacts_page
|
22
|
-
expect(contacts_element).to have_content('Test Subject #0')
|
23
|
-
expect(contacts_element).to have_content('Test Subject #1')
|
24
|
-
expect(contacts_element).to have_content('Test Subject #2')
|
25
|
-
expect(contacts_element).to have_content('Test Subject #3')
|
26
|
-
expect(page).to have_content('Create Contact')
|
27
|
-
end
|
28
|
-
|
29
|
-
scenario 'should create a contact', js: true do
|
30
|
-
with_versioning do
|
31
|
-
visit contacts_page
|
32
|
-
click_link 'Create Contact'
|
33
|
-
select = find('#account_name', visible: true)
|
34
|
-
expect(select).to have_text("")
|
35
|
-
expect(page).to have_selector('#select2-account_id-container', visible: false)
|
36
|
-
expect(page).to have_selector('#contact_first_name', visible: true)
|
37
|
-
fill_in 'contact_first_name', with: 'Testy'
|
38
|
-
fill_in 'contact_last_name', with: 'McTest'
|
39
|
-
fill_in 'contact_email', with: "testy.mctest@example.com"
|
40
|
-
fill_in 'contact_phone', with: '+44 1234 567890'
|
41
|
-
click_link 'Comment'
|
42
|
-
fill_in 'comment_body', with: 'This is a very important person.'
|
43
|
-
click_button 'Create Contact'
|
44
|
-
expect(contacts_element).to have_content('Testy McTest')
|
45
|
-
|
46
|
-
contacts_element.click_link 'Testy McTest'
|
47
|
-
sleep(1) # avoid CI failure
|
48
|
-
expect(main_element).to have_content('This is a very important person.')
|
49
|
-
|
50
|
-
click_link "Dashboard"
|
51
|
-
expect(activities_element).to have_content('Bill Murray created contact Testy McTest')
|
52
|
-
expect(activities_element).to have_content('Bill Murray created comment on Testy McTest')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
scenario "remembers the comment field when the creation was unsuccessful", js: true do
|
57
|
-
visit contacts_page
|
58
|
-
click_link 'Create Contact'
|
59
|
-
|
60
|
-
click_link 'Comment'
|
61
|
-
fill_in 'comment_body', with: 'This is a very important person.'
|
62
|
-
click_button 'Create Contact'
|
63
|
-
|
64
|
-
expect(page).to have_field("comment_body", with: 'This is a very important person.')
|
65
|
-
end
|
66
|
-
|
67
|
-
scenario 'should view and edit a contact', js: true do
|
68
|
-
create(:contact, first_name: "Testy", last_name: "McTest", account: create(:account, name: "Toast"))
|
69
|
-
with_versioning do
|
70
|
-
visit contacts_page
|
71
|
-
click_link 'Testy McTest'
|
72
|
-
click_link 'Edit'
|
73
|
-
select = find('#select2-account_id-container', visible: true)
|
74
|
-
expect(select).to have_text("Toast")
|
75
|
-
expect(page).to have_selector('#account_name', visible: false)
|
76
|
-
fill_in 'contact_first_name', with: 'Test'
|
77
|
-
fill_in 'contact_last_name', with: 'Subject'
|
78
|
-
fill_in 'contact_email', with: "test.subject@example.com"
|
79
|
-
click_button 'Save Contact'
|
80
|
-
sleep(3) # TODO: A better ajax wait, or redirect on save
|
81
|
-
expect(find('#edit_contact_title')).to have_content('Test Subject')
|
82
|
-
|
83
|
-
click_link 'Dashboard'
|
84
|
-
expect(activities_element).to have_content("Bill Murray updated contact Test Subject")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
scenario 'should delete a contact', js: true do
|
89
|
-
create(:contact, first_name: "Test", last_name: "Subject")
|
90
|
-
visit contacts_page
|
91
|
-
click_link 'Test Subject'
|
92
|
-
click_link 'Delete?'
|
93
|
-
expect(menu_element).to have_content('Are you sure you want to delete this contact?')
|
94
|
-
click_link 'Yes'
|
95
|
-
expect(flash_element).to have_content('Test Subject has been deleted.')
|
96
|
-
expect(contacts_element).not_to have_content('Test Subject')
|
97
|
-
end
|
98
|
-
|
99
|
-
scenario 'should search for a contact', js: true do
|
100
|
-
2.times { |i| create(:contact, first_name: "Test", last_name: "Subject \##{i}") }
|
101
|
-
visit contacts_page
|
102
|
-
expect(contacts_element).to have_content('Test Subject #0')
|
103
|
-
expect(contacts_element).to have_content('Test Subject #1')
|
104
|
-
fill_in 'query', with: 'Test Subject #1'
|
105
|
-
expect(contacts_element).to have_content('Test Subject #1')
|
106
|
-
expect(contacts_element).not_to have_content('Test Subject #0')
|
107
|
-
fill_in 'query', with: 'Test Subject'
|
108
|
-
expect(contacts_element).to have_content('Test Subject #0')
|
109
|
-
expect(contacts_element).to have_content('Test Subject #1')
|
110
|
-
fill_in 'query', with: "Fake contact"
|
111
|
-
expect(contacts_element).not_to have_content('Test Subject #0')
|
112
|
-
expect(contacts_element).not_to have_content('Test Subject #1')
|
113
|
-
end
|
114
|
-
|
115
|
-
def main_element
|
116
|
-
find('#main')
|
117
|
-
end
|
118
|
-
|
119
|
-
def menu_element
|
120
|
-
find('#menu')
|
121
|
-
end
|
122
|
-
|
123
|
-
def flash_element
|
124
|
-
find('#flash')
|
125
|
-
end
|
126
|
-
|
127
|
-
def contacts_element
|
128
|
-
find('#contacts')
|
129
|
-
end
|
130
|
-
|
131
|
-
def activities_element
|
132
|
-
find('#activities')
|
133
|
-
end
|
134
|
-
end
|