fat_free_crm 0.18.1 → 0.20.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/.github/workflows/brakeman-analysis.yml +46 -0
- data/.github/workflows/rubocop-analysis.yml +40 -0
- data/.github/workflows/ruby.yml +52 -0
- data/.rubocop_todo.yml +80 -173
- data/.travis.yml +17 -20
- data/CHANGELOG.md +63 -3
- data/CONTRIBUTORS.md +1 -0
- data/Dockerfile +45 -14
- data/Gemfile +21 -11
- data/Gemfile.lock +315 -263
- data/Procfile +1 -1
- data/README.md +6 -5
- data/Rakefile +1 -1
- data/SECURITY.md +11 -0
- data/app/assets/javascripts/application.js.erb +3 -0
- data/app/assets/stylesheets/application.css.erb +1 -0
- data/app/assets/stylesheets/base.scss +9 -2
- data/app/assets/stylesheets/bootstrap-custom.scss +206 -0
- data/app/assets/stylesheets/common.scss +88 -68
- data/app/assets/stylesheets/header.scss +0 -8
- data/app/controllers/admin/application_controller.rb +1 -1
- data/app/controllers/admin/field_groups_controller.rb +2 -4
- data/app/controllers/admin/fields_controller.rb +1 -1
- data/app/controllers/admin/groups_controller.rb +1 -1
- data/app/controllers/admin/tags_controller.rb +3 -5
- data/app/controllers/admin/users_controller.rb +7 -9
- data/app/controllers/application_controller.rb +21 -45
- data/app/controllers/comments_controller.rb +3 -6
- data/{config/initializers/authlogic.rb → app/controllers/confirmations_controller.rb} +4 -2
- data/app/controllers/emails_controller.rb +0 -2
- data/app/controllers/entities/accounts_controller.rb +2 -4
- data/app/controllers/entities/campaigns_controller.rb +2 -4
- data/app/controllers/entities/contacts_controller.rb +4 -24
- data/app/controllers/entities/leads_controller.rb +7 -10
- data/app/controllers/entities/opportunities_controller.rb +4 -14
- data/app/controllers/entities_controller.rb +21 -7
- data/app/controllers/home_controller.rb +5 -5
- data/app/controllers/lists_controller.rb +1 -1
- data/app/controllers/passwords_controller.rb +3 -59
- data/{spec/features/support/maintain_sessions.rb → app/controllers/registrations_controller.rb} +12 -5
- data/{lib/development_tasks/gem.rake → app/controllers/sessions_controller.rb} +6 -6
- data/app/controllers/tasks_controller.rb +11 -20
- data/app/controllers/users_controller.rb +11 -30
- data/app/helpers/accounts_helper.rb +12 -0
- data/app/helpers/admin/users_helper.rb +1 -1
- data/app/helpers/application_helper.rb +30 -37
- data/app/helpers/campaigns_helper.rb +1 -1
- data/app/helpers/contacts_helper.rb +1 -3
- data/app/helpers/opportunities_helper.rb +4 -12
- data/app/helpers/tasks_helper.rb +3 -3
- data/app/helpers/users_helper.rb +1 -3
- data/{config/initializers/paper_trail.rb → app/mailers/devise_mailer.rb} +5 -1
- data/app/mailers/user_mailer.rb +0 -9
- data/app/models/entities/account.rb +11 -11
- data/app/models/entities/account_contact.rb +1 -1
- data/app/models/entities/account_opportunity.rb +1 -1
- data/app/models/entities/campaign.rb +5 -7
- data/app/models/entities/contact.rb +25 -13
- data/app/models/entities/lead.rb +8 -8
- data/app/models/entities/opportunity.rb +8 -10
- data/app/models/fields/custom_field.rb +1 -0
- data/app/models/fields/custom_field_date_pair.rb +2 -0
- data/app/models/fields/custom_field_pair.rb +2 -2
- data/app/models/fields/field.rb +1 -3
- data/app/models/list.rb +1 -1
- data/app/models/observers/entity_observer.rb +3 -7
- data/app/models/observers/lead_observer.rb +2 -4
- data/app/models/observers/opportunity_observer.rb +3 -5
- data/app/models/observers/task_observer.rb +1 -1
- data/app/models/polymorphic/address.rb +1 -1
- data/app/models/polymorphic/comment.rb +1 -1
- data/app/models/polymorphic/email.rb +3 -3
- data/app/models/polymorphic/task.rb +14 -10
- data/app/models/polymorphic/version.rb +3 -2
- data/app/models/setting.rb +5 -1
- data/app/models/users/permission.rb +3 -3
- data/app/models/users/preference.rb +4 -3
- data/app/models/users/user.rb +67 -42
- data/app/views/accounts/_edit.html.haml +2 -2
- data/app/views/accounts/_new.html.haml +2 -2
- data/app/views/accounts/_sidebar_index.html.haml +2 -2
- data/app/views/accounts/_sidebar_show.html.haml +19 -19
- data/app/views/accounts/_top_section.html.haml +1 -1
- data/app/views/accounts/create.js.haml +1 -2
- data/app/views/accounts/destroy.js.haml +1 -1
- data/app/views/accounts/edit.js.haml +1 -1
- data/app/views/accounts/show.html.haml +1 -0
- data/app/views/accounts/update.js.haml +4 -5
- data/app/views/admin/field_groups/create.js.haml +0 -1
- data/app/views/admin/field_groups/destroy.js.haml +0 -1
- data/app/views/admin/field_groups/update.js.haml +0 -1
- data/app/views/admin/fields/create.js.haml +0 -1
- data/app/views/admin/fields/destroy.js.haml +0 -1
- data/app/views/admin/fields/update.js.haml +0 -1
- data/app/views/admin/groups/create.js.haml +0 -1
- data/app/views/admin/groups/destroy.js.haml +0 -1
- data/app/views/admin/groups/update.js.haml +0 -1
- data/app/views/admin/tags/create.js.haml +0 -1
- data/app/views/admin/tags/destroy.js.haml +0 -1
- data/app/views/admin/tags/update.js.haml +0 -1
- data/app/views/admin/users/_user.html.haml +4 -4
- data/app/views/admin/users/create.js.haml +0 -1
- data/app/views/admin/users/destroy.js.haml +0 -1
- data/app/views/admin/users/update.js.haml +0 -1
- data/app/views/campaigns/_edit.html.haml +1 -1
- data/app/views/campaigns/_new.html.haml +1 -1
- data/app/views/campaigns/_sidebar_index.html.haml +2 -2
- data/app/views/campaigns/_sidebar_show.html.haml +68 -67
- data/app/views/campaigns/create.js.haml +1 -2
- data/app/views/campaigns/destroy.js.haml +1 -1
- data/app/views/campaigns/show.html.haml +1 -0
- data/app/views/campaigns/update.js.haml +3 -4
- data/app/views/comments/_edit.html.haml +1 -1
- data/app/views/comments/_new.html.haml +1 -1
- data/app/views/comments/update.js.haml +0 -1
- data/app/views/contacts/_edit.html.haml +1 -1
- data/app/views/contacts/_index_brief.html.haml +1 -1
- data/app/views/contacts/_index_full.html.haml +1 -1
- data/app/views/contacts/_index_long.html.haml +1 -1
- data/app/views/contacts/_new.html.haml +1 -1
- data/app/views/contacts/_sidebar_show.html.haml +18 -18
- data/app/views/contacts/create.js.haml +0 -1
- data/app/views/contacts/destroy.js.haml +1 -1
- data/app/views/contacts/show.html.haml +1 -0
- data/app/views/contacts/update.js.haml +2 -3
- data/app/views/devise/confirmations/new.html.haml +9 -0
- data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/devise/mailer/password_change.html.haml +3 -0
- data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/devise/passwords/edit.html.haml +18 -0
- data/app/views/devise/passwords/new.html.haml +10 -0
- data/app/views/devise/registrations/new.html.haml +21 -0
- data/app/views/devise/sessions/new.html.haml +32 -0
- data/app/views/entities/_title_bar.html.haml +1 -1
- data/app/views/entities/attach.js.haml +2 -2
- data/app/views/entities/discard.js.haml +2 -2
- data/app/views/home/_opportunity.html.haml +1 -1
- data/app/views/home/_task.html.haml +1 -1
- data/app/views/home/index.xls.builder +51 -0
- data/app/views/layouts/_about.html.haml +5 -5
- data/app/views/layouts/_header.html.haml +3 -3
- data/app/views/layouts/_sidebar.html.haml +2 -2
- data/app/views/layouts/_tabbed.html.haml +14 -11
- data/app/views/layouts/admin/_header.html.haml +1 -1
- data/app/views/layouts/application.html.haml +2 -2
- data/app/views/leads/_edit.html.haml +2 -2
- data/app/views/leads/_new.html.haml +2 -2
- data/app/views/leads/_sidebar_index.html.haml +2 -2
- data/app/views/leads/_sidebar_show.html.haml +30 -30
- data/app/views/leads/create.js.haml +2 -3
- data/app/views/leads/destroy.js.haml +2 -2
- data/app/views/leads/promote.js.haml +3 -4
- data/app/views/leads/reject.js.haml +3 -3
- data/app/views/leads/show.html.haml +1 -1
- data/app/views/leads/update.js.haml +4 -5
- data/app/views/lists/create.js.haml +0 -1
- data/app/views/opportunities/_edit.html.haml +1 -1
- data/app/views/opportunities/_index_brief.html.haml +1 -1
- data/app/views/opportunities/_index_long.html.haml +1 -1
- data/app/views/opportunities/_new.html.haml +1 -1
- data/app/views/opportunities/_sidebar_index.html.haml +2 -2
- data/app/views/opportunities/_sidebar_show.html.haml +47 -46
- data/app/views/opportunities/create.js.haml +3 -4
- data/app/views/opportunities/destroy.js.haml +3 -3
- data/app/views/opportunities/show.html.haml +1 -0
- data/app/views/opportunities/update.js.haml +5 -6
- data/app/views/shared/_address.html.haml +5 -5
- data/app/views/shared/_empty.html.haml +1 -1
- data/app/views/shared/_inline_styles.html.haml +0 -26
- data/app/views/shared/_paginate_with_per_page.html.haml +1 -0
- data/app/views/tasks/_assigned.html.haml +1 -1
- data/app/views/tasks/_completed.html.haml +1 -1
- data/app/views/tasks/_edit.html.haml +1 -1
- data/app/views/tasks/_new.html.haml +1 -1
- data/app/views/tasks/_pending.html.haml +1 -1
- data/app/views/tasks/_related.html.haml +1 -1
- data/app/views/tasks/_selector.html.haml +7 -8
- data/app/views/tasks/_sidebar_index.html.haml +2 -2
- data/app/views/tasks/_title.html.haml +1 -1
- data/app/views/tasks/complete.js.haml +1 -1
- data/app/views/tasks/create.js.haml +1 -2
- data/app/views/tasks/destroy.js.haml +1 -1
- data/app/views/tasks/uncomplete.js.haml +1 -2
- data/app/views/tasks/update.js.haml +0 -1
- data/app/views/users/_avatar.html.haml +1 -1
- data/app/views/users/change_password.js.haml +0 -1
- data/app/views/users/update.js.haml +0 -1
- data/app/views/users/upload_avatar.js.haml +0 -1
- data/app/views/versions/_version_item.html.haml +1 -1
- data/bin/bundle +1 -1
- data/bin/rails +1 -1
- data/bin/setup +38 -0
- data/bin/update +33 -0
- data/bin/yarn +13 -0
- data/config/application.rb +8 -6
- data/config/boot.rb +1 -1
- data/config/brakeman.ignore +2 -2
- data/config/database.postgres.docker.yml +5 -5
- data/config/environment.rb +2 -2
- data/config/environments/development.rb +1 -0
- data/config/environments/test.rb +7 -0
- data/config/initializers/action_mailer.rb +1 -3
- data/config/initializers/application_controller_renderer.rb +9 -0
- data/config/initializers/assets.rb +6 -11
- data/config/initializers/backtrace_silencers.rb +0 -6
- data/config/initializers/content_security_policy.rb +31 -0
- data/config/initializers/cookies_serializer.rb +3 -6
- data/config/initializers/devise.rb +289 -0
- data/config/initializers/filter_parameter_logging.rb +0 -5
- data/config/initializers/gravatar.rb +0 -1
- data/config/initializers/inflections.rb +0 -6
- data/config/initializers/mime_types.rb +1 -9
- data/config/initializers/new_framework_defaults_6_0.rb +46 -0
- data/config/initializers/relative_url_root.rb +1 -3
- data/config/initializers/session_store.rb +1 -3
- data/config/initializers/simple_form.rb +135 -55
- data/config/initializers/simple_form_bootstrap.rb +433 -0
- data/config/initializers/wrap_parameters.rb +4 -9
- data/config/locales/fat_free_crm.cs.yml +86 -47
- data/config/locales/fat_free_crm.en-GB.yml +5 -5
- data/config/locales/fat_free_crm.en-US.yml +5 -5
- data/config/locales/fat_free_crm.fr.yml +1 -1
- data/config/locales/fat_free_crm.ru.yml +2 -0
- data/config/routes.rb +20 -9
- data/config/settings.default.yml +0 -41
- data/db/demo/users.yml +62 -81
- data/db/migrate/20100928030620_remove_uuid.rb +1 -2
- data/db/migrate/20120316045804_activities_to_versions.rb +1 -0
- data/db/migrate/20120510025219_add_not_null_constraints_for_timestamp_columns.rb +1 -0
- data/db/migrate/20180107082701_authlogic_to_devise.rb +58 -0
- data/db/migrate/20200806004152_add_pattern_to_fields.rb +7 -0
- data/db/migrate/20200806004459_add_html5_to_fields.rb +10 -0
- data/db/schema.rb +58 -48
- data/docker-compose.yml +10 -0
- data/fat_free_crm.gemspec +13 -15
- data/lib/development_tasks/license.rake +2 -2
- data/lib/fat_free_crm/callback.rb +2 -2
- data/lib/fat_free_crm/comment_extensions.rb +2 -4
- data/lib/fat_free_crm/core_ext/string.rb +1 -1
- data/lib/fat_free_crm/core_ext.rb +1 -1
- data/lib/fat_free_crm/engine.rb +1 -1
- data/lib/fat_free_crm/errors.rb +1 -1
- data/lib/fat_free_crm/export_csv.rb +1 -0
- data/lib/fat_free_crm/exportable.rb +1 -1
- data/lib/fat_free_crm/fields.rb +1 -1
- data/lib/fat_free_crm/gem_dependencies.rb +1 -1
- data/lib/fat_free_crm/gem_ext.rb +0 -1
- data/lib/fat_free_crm/i18n.rb +2 -2
- data/lib/fat_free_crm/mail_processor/base.rb +4 -10
- data/lib/fat_free_crm/mail_processor/dropbox.rb +5 -15
- data/lib/fat_free_crm/permissions.rb +7 -4
- data/lib/fat_free_crm/sortable.rb +1 -1
- data/lib/fat_free_crm/tabs.rb +2 -2
- data/lib/fat_free_crm/version.rb +2 -2
- data/lib/gravatar_image_tag.rb +8 -9
- data/lib/missing_translation_detector.rb +1 -0
- data/lib/tasks/ffcrm/missing_translations.rake +1 -0
- data/lib/tasks/ffcrm/preference_update.rake +19 -0
- data/lib/tasks/ffcrm/setup.rake +11 -2
- data/lib/tasks/ffcrm/update_data.rake +2 -2
- data/lib/templates/erb/scaffold/_form.html.erb +4 -2
- data/script/rails +2 -2
- data/spec/controllers/admin/users_controller_spec.rb +0 -56
- data/spec/controllers/comments_controller_spec.rb +12 -12
- data/spec/controllers/entities/campaigns_controller_spec.rb +1 -1
- data/spec/controllers/entities/contacts_controller_spec.rb +2 -1
- data/spec/controllers/entities/leads_controller_spec.rb +2 -2
- data/spec/controllers/entities/opportunities_controller_spec.rb +1 -1
- data/spec/controllers/entities_controller_spec.rb +5 -0
- data/spec/controllers/home_controller_spec.rb +8 -8
- data/spec/controllers/tasks_controller_spec.rb +6 -4
- data/spec/controllers/users_controller_spec.rb +41 -99
- data/spec/factories/account_factories.rb +5 -5
- data/spec/factories/campaign_factories.rb +3 -3
- data/spec/factories/contact_factories.rb +8 -8
- data/spec/factories/field_factories.rb +4 -3
- data/spec/factories/lead_factories.rb +5 -5
- data/spec/factories/list_factories.rb +2 -2
- data/spec/factories/opportunity_factories.rb +3 -3
- data/spec/factories/setting_factories.rb +2 -2
- data/spec/factories/shared_factories.rb +11 -9
- data/spec/factories/task_factories.rb +7 -7
- data/spec/factories/user_factories.rb +21 -21
- data/spec/features/acceptance_helper.rb +1 -1
- data/spec/features/accounts_spec.rb +2 -2
- data/spec/features/admin/groups_spec.rb +2 -2
- data/spec/features/admin/users_spec.rb +4 -2
- data/spec/features/campaigns_spec.rb +3 -3
- data/spec/features/contacts_spec.rb +3 -6
- data/spec/features/dashboard_spec.rb +1 -1
- data/spec/features/devise/sign_in_spec.rb +58 -0
- data/spec/features/devise/sign_up_spec.rb +36 -0
- data/spec/features/leads_spec.rb +12 -8
- data/spec/features/opportunities_overview_spec.rb +1 -1
- data/spec/features/opportunities_spec.rb +7 -7
- data/spec/features/support/browser.rb +8 -3
- data/spec/features/support/selector_helpers.rb +10 -1
- data/spec/features/tasks_spec.rb +7 -7
- data/spec/helpers/accounts_helper_spec.rb +57 -0
- data/spec/helpers/admin/field_groups_helper_spec.rb +1 -1
- data/spec/helpers/users_helper_spec.rb +4 -4
- data/spec/lib/comment_extensions_spec.rb +10 -4
- data/spec/lib/errors_spec.rb +2 -2
- data/spec/lib/mail_processor/dropbox_spec.rb +1 -1
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +8 -8
- data/spec/lib/permissions_spec.rb +8 -3
- data/spec/mailers/devise_mailer_spec.rb +35 -0
- data/spec/mailers/user_mailer_spec.rb +0 -26
- data/spec/models/entities/account_spec.rb +27 -0
- data/spec/models/entities/contact_spec.rb +96 -1
- data/spec/models/entities/opportunity_spec.rb +2 -2
- data/spec/models/fields/custom_field_date_pair_spec.rb +4 -2
- data/spec/models/fields/custom_field_pair_spec.rb +2 -2
- data/spec/models/fields/custom_field_spec.rb +4 -2
- data/spec/models/observers/entity_observer_spec.rb +4 -4
- data/spec/models/polymorphic/task_spec.rb +11 -11
- data/spec/models/polymorphic/version_spec.rb +9 -9
- data/spec/models/users/preference_spec.rb +1 -1
- data/spec/models/users/user_spec.rb +22 -26
- data/spec/routing/users_routing_spec.rb +30 -8
- data/spec/shared/controllers.rb +3 -9
- data/spec/spec_helper.rb +10 -2
- data/spec/support/assert_select.rb +1 -0
- data/spec/support/devise_helpers.rb +28 -0
- data/spec/{features/support/helpers.rb → support/feature_helpers.rb} +10 -10
- data/spec/support/macros.rb +4 -1
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/_new.haml_spec.rb +1 -1
- data/spec/views/accounts/create.js.haml_spec.rb +1 -2
- data/spec/views/accounts/update.js.haml_spec.rb +2 -5
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +0 -1
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +0 -1
- data/spec/views/admin/users/create.js.haml_spec.rb +0 -1
- data/spec/views/admin/users/destroy.js.haml_spec.rb +0 -6
- data/spec/views/admin/users/update.js.haml_spec.rb +1 -2
- data/spec/views/campaigns/_edit.haml_spec.rb +1 -1
- data/spec/views/campaigns/_new.haml_spec.rb +1 -1
- data/spec/views/campaigns/create.js.haml_spec.rb +1 -2
- data/spec/views/campaigns/destroy.js.haml_spec.rb +0 -1
- data/spec/views/campaigns/edit.js.haml_spec.rb +2 -2
- data/spec/views/campaigns/index.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/update.js.haml_spec.rb +3 -7
- data/spec/views/contacts/_edit.haml_spec.rb +1 -1
- data/spec/views/contacts/_new.haml_spec.rb +1 -1
- data/spec/views/contacts/create.js.haml_spec.rb +1 -2
- data/spec/views/contacts/edit.js.haml_spec.rb +1 -1
- data/spec/views/contacts/index.js.html_spec.rb +1 -1
- data/spec/views/contacts/update.js.haml_spec.rb +6 -10
- data/spec/views/home/index.haml_spec.rb +2 -2
- data/spec/views/leads/_edit.haml_spec.rb +1 -1
- data/spec/views/leads/_new.haml_spec.rb +1 -1
- data/spec/views/leads/create.js.haml_spec.rb +0 -3
- data/spec/views/leads/destroy.js.haml_spec.rb +0 -2
- data/spec/views/leads/promote.js.haml_spec.rb +3 -11
- data/spec/views/leads/reject.js.haml_spec.rb +0 -3
- data/spec/views/leads/update.js.haml_spec.rb +3 -11
- data/spec/views/opportunities/_edit.haml_spec.rb +1 -1
- data/spec/views/opportunities/_new.haml_spec.rb +1 -1
- data/spec/views/opportunities/create.js.haml_spec.rb +0 -2
- data/spec/views/opportunities/destroy.js.haml_spec.rb +0 -3
- data/spec/views/opportunities/update.js.haml_spec.rb +4 -12
- data/spec/views/tasks/_edit.haml_spec.rb +1 -1
- data/spec/views/tasks/complete.js.haml_spec.rb +0 -1
- data/spec/views/tasks/create.js.haml_spec.rb +0 -2
- data/spec/views/tasks/destroy.js.haml_spec.rb +0 -1
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +0 -1
- data/spec/views/tasks/update.js.haml_spec.rb +1 -4
- data/spec/views/users/change_password.js.haml_spec.rb +1 -2
- data/spec/views/users/update.js.haml_spec.rb +1 -2
- data/spec/views/users/upload_avatar.js.haml_spec.rb +1 -2
- metadata +63 -77
- data/app/controllers/authentications_controller.rb +0 -53
- data/app/models/users/authentication.rb +0 -56
- data/app/views/authentications/new.html.haml +0 -19
- data/app/views/passwords/edit.html.haml +0 -15
- data/app/views/passwords/new.html.haml +0 -10
- data/app/views/user_mailer/password_reset_instructions.html.haml +0 -6
- data/app/views/users/new.html.haml +0 -19
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +0 -26
- data/spec/controllers/authentications_controller_spec.rb +0 -150
- data/spec/controllers/passwords_controller_spec.rb +0 -32
- data/spec/models/users/authentication_spec.rb +0 -19
- data/spec/support/auth_macros.rb +0 -49
- data/spec/views/authentications/new.haml_spec.rb +0 -31
@@ -7,9 +7,9 @@
|
|
7
7
|
#------------------------------------------------------------------------------
|
8
8
|
FactoryBot.define do
|
9
9
|
factory :version do
|
10
|
-
whodunnit ""
|
10
|
+
whodunnit { "" }
|
11
11
|
item { raise "Please specify :item for the version" }
|
12
|
-
event "create"
|
12
|
+
event { "create" }
|
13
13
|
created_at { FactoryBot.generate(:time) }
|
14
14
|
end
|
15
15
|
|
@@ -17,9 +17,11 @@ FactoryBot.define do
|
|
17
17
|
user
|
18
18
|
commentable { raise "Please specify :commentable for the comment" }
|
19
19
|
title { FactoryBot.generate(:title) }
|
20
|
-
|
20
|
+
|
21
|
+
private { false }
|
22
|
+
|
21
23
|
comment { FFaker::Lorem.paragraph }
|
22
|
-
state "Expanded"
|
24
|
+
state { "Expanded" }
|
23
25
|
updated_at { FactoryBot.generate(:time) }
|
24
26
|
created_at { FactoryBot.generate(:time) }
|
25
27
|
end
|
@@ -31,14 +33,14 @@ FactoryBot.define do
|
|
31
33
|
sent_from { FFaker::Internet.email }
|
32
34
|
sent_to { FFaker::Internet.email }
|
33
35
|
cc { FFaker::Internet.email }
|
34
|
-
bcc nil
|
36
|
+
bcc { nil }
|
35
37
|
subject { FFaker::Lorem.sentence }
|
36
38
|
body { FFaker::Lorem.paragraph[0, 255] }
|
37
|
-
header nil
|
39
|
+
header { nil }
|
38
40
|
sent_at { FactoryBot.generate(:time) }
|
39
41
|
received_at { FactoryBot.generate(:time) }
|
40
|
-
deleted_at nil
|
41
|
-
state "Expanded"
|
42
|
+
deleted_at { nil }
|
43
|
+
state { "Expanded" }
|
42
44
|
updated_at { FactoryBot.generate(:time) }
|
43
45
|
created_at { FactoryBot.generate(:time) }
|
44
46
|
end
|
@@ -55,7 +57,7 @@ FactoryBot.define do
|
|
55
57
|
address_type { %w[Business Billing Shipping].sample }
|
56
58
|
updated_at { FactoryBot.generate(:time) }
|
57
59
|
created_at { FactoryBot.generate(:time) }
|
58
|
-
deleted_at nil
|
60
|
+
deleted_at { nil }
|
59
61
|
end
|
60
62
|
|
61
63
|
factory :avatar do
|
@@ -8,17 +8,17 @@
|
|
8
8
|
FactoryBot.define do
|
9
9
|
factory :task do
|
10
10
|
user
|
11
|
-
asset nil
|
12
|
-
assigned_to nil
|
13
|
-
completed_by nil
|
11
|
+
asset { nil }
|
12
|
+
assigned_to { nil }
|
13
|
+
completed_by { nil }
|
14
14
|
name { FFaker::Lorem.sentence[0, 64] }
|
15
|
-
priority nil
|
15
|
+
priority { nil }
|
16
16
|
category { %w[call email follow_up lunch meeting money presentation trip].sample }
|
17
|
-
bucket "due_asap"
|
17
|
+
bucket { "due_asap" }
|
18
18
|
due_at { FactoryBot.generate(:time) }
|
19
19
|
background_info { FFaker::Lorem.paragraph[0, 255] }
|
20
|
-
completed_at nil
|
21
|
-
deleted_at nil
|
20
|
+
completed_at { nil }
|
21
|
+
deleted_at { nil }
|
22
22
|
updated_at { FactoryBot.generate(:time) }
|
23
23
|
created_at { FactoryBot.generate(:time) }
|
24
24
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#------------------------------------------------------------------------------
|
8
8
|
FactoryBot.define do
|
9
9
|
factory :user do
|
10
|
-
username {
|
10
|
+
username { FFaker::InternetSE.user_name_variant_short }
|
11
11
|
email { FFaker::Internet.email }
|
12
12
|
first_name { FFaker::Name.first_name }
|
13
13
|
last_name { FFaker::Name.last_name }
|
@@ -16,31 +16,31 @@ FactoryBot.define do
|
|
16
16
|
alt_email { FFaker::Internet.email }
|
17
17
|
phone { FFaker::PhoneNumber.phone_number }
|
18
18
|
mobile { FFaker::PhoneNumber.phone_number }
|
19
|
-
aim nil
|
20
|
-
yahoo nil
|
21
|
-
google nil
|
22
|
-
skype nil
|
23
|
-
admin false
|
24
|
-
|
19
|
+
aim { nil }
|
20
|
+
yahoo { nil }
|
21
|
+
google { nil }
|
22
|
+
skype { nil }
|
23
|
+
admin { false }
|
24
|
+
encrypted_password { SecureRandom.hex(64) }
|
25
25
|
password_salt { SecureRandom.hex(64) }
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
current_login_ip "127.0.0.1"
|
33
|
-
login_count { rand(1..100) }
|
34
|
-
deleted_at nil
|
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 }
|
35
32
|
updated_at { FactoryBot.generate(:time) }
|
36
33
|
created_at { FactoryBot.generate(:time) }
|
37
|
-
suspended_at nil
|
38
|
-
password "password"
|
39
|
-
password_confirmation "password"
|
40
|
-
end
|
34
|
+
suspended_at { nil }
|
35
|
+
password { "password" }
|
36
|
+
password_confirmation { "password" }
|
41
37
|
|
38
|
+
# For unit tests, we dont need to enforce uniqueness
|
39
|
+
to_create { |instance| instance.save(validate: false) }
|
40
|
+
end
|
41
|
+
|
42
42
|
factory :admin do
|
43
|
-
admin true
|
43
|
+
admin { true }
|
44
44
|
end
|
45
45
|
|
46
46
|
factory :permission do
|
@@ -31,8 +31,8 @@ feature 'Accounts', '
|
|
31
31
|
click_link 'Create Account'
|
32
32
|
expect(page).to have_selector('#account_name', visible: true)
|
33
33
|
fill_in 'account_name', with: 'My new account'
|
34
|
-
|
35
|
-
|
34
|
+
select2 'Affiliate', from: 'Category:'
|
35
|
+
select2 'Myself', from: 'Assigned to:'
|
36
36
|
click_link 'Contact Information'
|
37
37
|
fill_in 'account_phone', with: '+1 2345 6789'
|
38
38
|
fill_in 'account_website', with: 'http://www.example.com'
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('../acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Groups tab', '
|
11
11
|
In order to increase customer satisfaction
|
@@ -23,7 +23,7 @@ feature 'Groups tab', '
|
|
23
23
|
click_link 'create a new group'
|
24
24
|
expect(page).to have_selector('#group_name', visible: true)
|
25
25
|
fill_in 'group_name', with: 'The Enterprise Bridge'
|
26
|
-
|
26
|
+
select2 'Mr Spock', from: 'Users'
|
27
27
|
click_button 'Create Group'
|
28
28
|
expect(page).to have_content('The Enterprise Bridge')
|
29
29
|
expect(page).to have_content('members: Mr Spock')
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('../acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Users tab', '
|
11
11
|
In order to increase customer satisfaction
|
@@ -25,9 +25,11 @@ feature 'Users tab', '
|
|
25
25
|
fill_in 'user_email', with: 'lightning@example.com'
|
26
26
|
fill_in 'user_first_name', with: 'Captain'
|
27
27
|
fill_in 'user_last_name', with: 'Thunder'
|
28
|
+
fill_in 'user_password', with: 'password'
|
29
|
+
fill_in 'user_password_confirmation', with: 'password'
|
28
30
|
fill_in 'user_title', with: 'Chief'
|
29
31
|
fill_in 'user_company', with: 'Weather Inc.'
|
30
|
-
|
32
|
+
select2 'Superheroes', from: 'Groups:'
|
31
33
|
|
32
34
|
click_button 'Create User'
|
33
35
|
expect(find('#users')).to have_content('Captain Thunder')
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Campaigns', '
|
11
11
|
In order to increase customer satisfaction
|
@@ -31,7 +31,7 @@ feature 'Campaigns', '
|
|
31
31
|
click_link 'Create Campaign'
|
32
32
|
expect(page).to have_selector('#campaign_name', visible: true)
|
33
33
|
fill_in 'campaign_name', with: 'Cool Campaign'
|
34
|
-
|
34
|
+
select2 'On Hold', from: 'Status:'
|
35
35
|
click_link 'Comment'
|
36
36
|
fill_in 'comment_body', with: 'This campaign is very important'
|
37
37
|
click_button 'Create Campaign'
|
@@ -66,7 +66,7 @@ feature 'Campaigns', '
|
|
66
66
|
click_link 'My Cool Campaign'
|
67
67
|
click_link 'Edit'
|
68
68
|
fill_in 'campaign_name', with: 'My Even Cooler Campaign'
|
69
|
-
|
69
|
+
select2 'Started', from: 'Status:'
|
70
70
|
click_button 'Save Campaign'
|
71
71
|
expect(page).to have_content('My Even Cooler Campaign')
|
72
72
|
expect(page).to have_content('My Even Cooler Campaign')
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Contacts', '
|
11
11
|
In order to increase customer satisfaction
|
@@ -77,7 +77,8 @@ feature 'Contacts', '
|
|
77
77
|
fill_in 'contact_last_name', with: 'Subject'
|
78
78
|
fill_in 'contact_email', with: "test.subject@example.com"
|
79
79
|
click_button 'Save Contact'
|
80
|
-
|
80
|
+
sleep(3) # TODO: A better ajax wait, or redirect on save
|
81
|
+
expect(find('#edit_contact_title')).to have_content('Test Subject')
|
81
82
|
|
82
83
|
click_link 'Dashboard'
|
83
84
|
expect(activities_element).to have_content("Bill Murray updated contact Test Subject")
|
@@ -115,10 +116,6 @@ feature 'Contacts', '
|
|
115
116
|
find('#main')
|
116
117
|
end
|
117
118
|
|
118
|
-
def summary_element
|
119
|
-
find('#summary')
|
120
|
-
end
|
121
|
-
|
122
119
|
def menu_element
|
123
120
|
find('#menu')
|
124
121
|
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Dashboard', '
|
11
11
|
In order to monitor activity
|
@@ -0,0 +1,58 @@
|
|
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 'Devise Sign-in' do
|
11
|
+
background do
|
12
|
+
Setting.user_signup = :needs_approval
|
13
|
+
@user = create :user,
|
14
|
+
username: 'john',
|
15
|
+
password: 'password',
|
16
|
+
password_confirmation: 'password',
|
17
|
+
email: 'john@example.com',
|
18
|
+
sign_in_count: 0
|
19
|
+
end
|
20
|
+
|
21
|
+
scenario 'without confirmation' do
|
22
|
+
login_process('john', 'password')
|
23
|
+
expect(page).to have_content("You have to confirm your email address before continuing.")
|
24
|
+
end
|
25
|
+
|
26
|
+
scenario 'without approval' do
|
27
|
+
@user.confirm
|
28
|
+
login_process('john', 'password')
|
29
|
+
expect(page).to have_content("Your account has not been approved yet.")
|
30
|
+
end
|
31
|
+
|
32
|
+
scenario 'with approved and confirmed account' do
|
33
|
+
@user.confirm
|
34
|
+
@user.update_attribute(:suspended_at, nil)
|
35
|
+
login_process('john', 'password')
|
36
|
+
expect(page).to have_content("Signed in successfully.")
|
37
|
+
end
|
38
|
+
|
39
|
+
scenario 'invalid credentials' do
|
40
|
+
login_process('jo', 'pass')
|
41
|
+
expect(current_path).to eq "/users/sign_in"
|
42
|
+
expect(page).to have_content("Invalid Email or password")
|
43
|
+
end
|
44
|
+
|
45
|
+
scenario 'login with email' do
|
46
|
+
@user.confirm
|
47
|
+
@user.update_attribute(:suspended_at, nil)
|
48
|
+
login_process('john@example.com', 'password')
|
49
|
+
expect(page).to have_content("Signed in successfully")
|
50
|
+
end
|
51
|
+
|
52
|
+
def login_process(username, password)
|
53
|
+
visit '/users/sign_in'
|
54
|
+
fill_in 'user[email]', with: username
|
55
|
+
fill_in 'user[password]', with: password
|
56
|
+
click_button 'Login'
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,36 @@
|
|
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 'Devise Sign-up' do
|
11
|
+
scenario 'with valid credentials' do
|
12
|
+
visit "/users/sign_up"
|
13
|
+
|
14
|
+
fill_in "user[email]", with: "john@example.com"
|
15
|
+
fill_in "user[username]", with: "john"
|
16
|
+
fill_in "user[password]", with: "password"
|
17
|
+
fill_in "user[password_confirmation]", with: "password"
|
18
|
+
click_button("Sign Up")
|
19
|
+
|
20
|
+
expect(current_path).to eq "/users/sign_in"
|
21
|
+
expect(page).to have_content("A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.")
|
22
|
+
end
|
23
|
+
|
24
|
+
scenario 'without credentials' do
|
25
|
+
visit "/users/sign_up"
|
26
|
+
click_button("Sign Up")
|
27
|
+
|
28
|
+
expect(page).to have_content("6 errors prohibited this User from being saved")
|
29
|
+
expect(page).to have_content("Please specify email address")
|
30
|
+
expect(page).to have_content("Email is too short (minimum is 3 characters)")
|
31
|
+
expect(page).to have_content("Email is invalid")
|
32
|
+
expect(page).to have_content("Please specify username")
|
33
|
+
expect(page).to have_content("Username is invalid")
|
34
|
+
expect(page).to have_content("Password can't be blank")
|
35
|
+
end
|
36
|
+
end
|
data/spec/features/leads_spec.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Leads', '
|
11
11
|
In order to increase sales
|
@@ -36,13 +36,16 @@ feature 'Leads', '
|
|
36
36
|
fill_in 'lead_email', with: 'mr_lead@example.com'
|
37
37
|
fill_in 'lead_phone', with: '+44 1234 567890'
|
38
38
|
click_link 'Status'
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
select2 'Myself', from: 'Assigned to:'
|
40
|
+
select2 'Contacted', from: 'Status:'
|
41
|
+
select2 'Campaign', from: 'Source:'
|
42
42
|
click_link 'Comment'
|
43
43
|
fill_in 'comment_body', with: 'This is an important lead.'
|
44
|
-
|
45
|
-
|
44
|
+
|
45
|
+
# TODO: Refactor to a page object
|
46
|
+
# This panel is already open, so clicking status again closed the div.
|
47
|
+
# click_link 'Status'
|
48
|
+
select2 'Contacted', from: 'Status:'
|
46
49
|
click_button 'Create Lead'
|
47
50
|
expect(leads_element).to have_content('Mr Lead')
|
48
51
|
|
@@ -79,9 +82,10 @@ feature 'Leads', '
|
|
79
82
|
fill_in 'lead_first_name', with: 'Mrs'
|
80
83
|
fill_in 'lead_phone', with: '+44 0987 654321'
|
81
84
|
click_link('Status')
|
82
|
-
|
85
|
+
select2 'Rejected', from: 'Status:'
|
83
86
|
click_button 'Save Lead'
|
84
|
-
|
87
|
+
sleep(3) # TODO: A better AJAX observing call, or just a redirect on save.
|
88
|
+
expect(find('#title')).to have_content('Mrs Lead')
|
85
89
|
|
86
90
|
click_link "Dashboard"
|
87
91
|
expect(activities_element).to have_content("Bill Murray updated lead Mrs Lead")
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Opportunities Overview', "
|
11
11
|
In order to keep track of my team's responsibilities
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Opportunities', '
|
11
11
|
In order to increase sales
|
@@ -38,7 +38,7 @@ feature 'Opportunities', '
|
|
38
38
|
sleep(1)
|
39
39
|
find('li', text: 'Example Account').click
|
40
40
|
expect(page).to have_content('Example Account')
|
41
|
-
|
41
|
+
select2 'Prospecting', from: 'Stage'
|
42
42
|
click_link 'Comment'
|
43
43
|
fill_in 'comment_body', with: 'This is a very important opportunity.'
|
44
44
|
click_button 'Create Opportunity'
|
@@ -67,7 +67,7 @@ feature 'Opportunities', '
|
|
67
67
|
scenario "remembers the comment field when the creation was unsuccessful", js: true do
|
68
68
|
visit opportunities_page
|
69
69
|
click_link 'Create Opportunity'
|
70
|
-
|
70
|
+
select2 'Prospecting', from: 'Stage:'
|
71
71
|
|
72
72
|
click_link 'Comment'
|
73
73
|
fill_in 'comment_body', with: 'This is a very important opportunity.'
|
@@ -85,8 +85,8 @@ feature 'Opportunities', '
|
|
85
85
|
click_link 'A Cool Opportunity'
|
86
86
|
click_link 'Edit'
|
87
87
|
fill_in 'opportunity_name', with: 'An Even Cooler Opportunity'
|
88
|
-
|
89
|
-
|
88
|
+
select2 'Other Example Account', from: 'Account (create new or select existing):'
|
89
|
+
select2 'Analysis', from: 'Stage:'
|
90
90
|
click_button 'Save Opportunity'
|
91
91
|
expect(page).to have_content('An Even Cooler Opportunity')
|
92
92
|
click_link "Dashboard"
|
@@ -120,13 +120,13 @@ feature 'Opportunities', '
|
|
120
120
|
expect(find('#opportunities')).not_to have_content("Opportunity 1")
|
121
121
|
end
|
122
122
|
|
123
|
-
scenario 'should add
|
123
|
+
scenario 'should add comment to opportunity', js: true do
|
124
124
|
opportunity = create(:opportunity, name: 'Awesome Opportunity')
|
125
125
|
visit opportunities_page
|
126
126
|
click_link 'Awesome Opportunity'
|
127
127
|
find("#opportunity_#{opportunity.id}_post_new_note").click
|
128
128
|
fill_in 'comment[comment]', with: 'Most awesome opportunity'
|
129
|
-
click_button 'Add
|
129
|
+
click_button 'Add Comment'
|
130
130
|
expect(page).to have_content('Most awesome opportunity')
|
131
131
|
end
|
132
132
|
end
|
@@ -7,17 +7,22 @@
|
|
7
7
|
#------------------------------------------------------------------------------
|
8
8
|
Capaybara.app_host = ENV['APP_URL'] if ENV['APP_URL']
|
9
9
|
Capybara.default_max_wait_time = 7
|
10
|
+
Capybara.server = :webrick
|
10
11
|
|
11
12
|
if ENV['BROWSER'] == 'chrome'
|
12
13
|
Capybara.register_driver :selenium do |app|
|
13
|
-
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: [
|
14
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w[no-sandbox headless disable-gpu] })
|
14
15
|
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
|
15
16
|
end
|
16
17
|
else
|
18
|
+
# For local testing in an environment with a display or remote X server configured
|
19
|
+
# such as WSL2, use NO_HEADLESS=1 bundle exec rspec spec/features
|
20
|
+
#
|
21
|
+
# For modern firefox, use MARIONETTE=1 bundle exec rspec spec/features
|
17
22
|
Capybara.register_driver :selenium do |app|
|
18
23
|
options = Selenium::WebDriver::Firefox::Options.new
|
19
|
-
options.args << '--headless'
|
20
|
-
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(marionette:
|
24
|
+
options.args << '--headless' unless ENV['NO_HEADLESS'].present?
|
25
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(marionette: ENV['MARIONETTE'].present?)
|
21
26
|
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options, desired_capabilities: capabilities)
|
22
27
|
end
|
23
28
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
#------------------------------------------------------------------------------
|
8
8
|
module SelectorHelpers
|
9
9
|
def click_filter_tab(filter_name)
|
10
|
-
tab = find(:xpath, "//div[@class='filters']//
|
10
|
+
tab = find(:xpath, "//div[@class='filters']//a[contains(text(), '#{filter_name}')]")
|
11
11
|
tab.click
|
12
12
|
end
|
13
13
|
|
@@ -22,6 +22,15 @@ module SelectorHelpers
|
|
22
22
|
page.execute_script "$('#task_#{task_id} a')[1].click()"
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
# See github.com/goodwill/capybara-select2
|
27
|
+
def select2(value, options = {})
|
28
|
+
select2_container = find("div.label", text: options[:from]).find(:xpath, '..').find('.select2-container')
|
29
|
+
|
30
|
+
select2_container.find(".select2-selection").click
|
31
|
+
drop_container = ".select2-dropdown"
|
32
|
+
find(:xpath, "//body").find("#{drop_container} li.select2-results__option", text: value).click
|
33
|
+
end
|
25
34
|
end
|
26
35
|
|
27
36
|
RSpec.configuration.include SelectorHelpers, type: :feature
|
data/spec/features/tasks_spec.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
6
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
7
|
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(
|
8
|
+
require File.expand_path('acceptance_helper.rb', __dir__)
|
9
9
|
|
10
10
|
feature 'Tasks', '
|
11
11
|
In order to increase keep track of things
|
@@ -33,9 +33,9 @@ feature 'Tasks', '
|
|
33
33
|
click_link 'Create Task'
|
34
34
|
expect(page).to have_selector('#task_name', visible: true)
|
35
35
|
fill_in 'task_name', with: 'Task I Need To Do'
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
select2 'Tomorrow', from: 'Due:'
|
37
|
+
select2 'Myself', from: 'Assign to:'
|
38
|
+
select2 'Call', from: 'Category:'
|
39
39
|
click_button 'Create Task'
|
40
40
|
expect(page).to have_content('Task I Need To Do')
|
41
41
|
|
@@ -51,9 +51,9 @@ feature 'Tasks', '
|
|
51
51
|
click_link 'Create Task'
|
52
52
|
expect(page).to have_selector('#task_name', visible: true)
|
53
53
|
fill_in 'task_name', with: 'Task For Someone Else'
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
select2 'Tomorrow', from: 'Due:'
|
55
|
+
select2 'Another User', from: 'Assign to:'
|
56
|
+
select2 'Call', from: 'Category:'
|
57
57
|
click_button 'Create Task'
|
58
58
|
expect(page).to have_content('The task has been created and assigned to Another User')
|
59
59
|
|
@@ -8,9 +8,66 @@
|
|
8
8
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
9
9
|
|
10
10
|
describe AccountsHelper do
|
11
|
+
let(:assignee) { create(:user) }
|
11
12
|
# Delete this example and add some real ones or delete this file
|
12
13
|
it "should be included in the object returned by #helper" do
|
13
14
|
included_modules = (class << helper; self; end).send :included_modules
|
14
15
|
expect(included_modules).to include(AccountsHelper)
|
15
16
|
end
|
17
|
+
describe '#display_pipeline' do
|
18
|
+
context 'when the pipeline is zero' do
|
19
|
+
it 'returns "N/A"' do
|
20
|
+
expect(display_value(0)).to eq('N/A')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
context 'when the pipeline is has 300' do
|
24
|
+
it 'returns "$300"' do
|
25
|
+
expect(display_value(300)).to eq('$300')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
describe '#display_won' do
|
30
|
+
context 'when the won is zero' do
|
31
|
+
it 'returns "N/A"' do
|
32
|
+
expect(display_value(0)).to eq('N/A')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
context 'when the won is has 300' do
|
36
|
+
it 'returns "$300"' do
|
37
|
+
expect(display_value(300)).to eq('$300')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
describe '#display_lost' do
|
42
|
+
context 'when the lost is zero' do
|
43
|
+
it 'returns "N/A"' do
|
44
|
+
expect(display_value(0)).to eq('N/A')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
context 'when the lost is has 300' do
|
48
|
+
it 'returns "$300"' do
|
49
|
+
expect(display_value(300)).to eq('$300')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
describe '#display_assigned' do
|
54
|
+
context 'when the name is under 16 chars' do
|
55
|
+
it 'returns the name' do
|
56
|
+
@account = create(:account)
|
57
|
+
allow(@account).to receive(:assignee).and_return(assignee)
|
58
|
+
allow(assignee).to receive(:full_name).and_return('Abe Lincoln')
|
59
|
+
allow(@account).to receive(:assigned_to).and_return(1)
|
60
|
+
expect(display_assigned(@account)).to eq('Abe Lincoln')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
context 'when the name is over 16 chars' do
|
64
|
+
it 'returns the truncated name' do
|
65
|
+
@account = create(:account)
|
66
|
+
allow(@account).to receive(:assignee).and_return(assignee)
|
67
|
+
allow(assignee).to receive(:full_name).and_return('Richard Milhouse Nixon')
|
68
|
+
allow(@account).to receive(:assigned_to).and_return(1)
|
69
|
+
expect(display_assigned(@account)).to eq('Richard Milho...')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
16
73
|
end
|
@@ -9,7 +9,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
9
9
|
|
10
10
|
describe Admin::FieldGroupsHelper do
|
11
11
|
it "should return the correct info text about tag restrictions and classes for groups" do
|
12
|
-
field_group =
|
12
|
+
field_group = create(:field_group, klass_name: "Contact", label: "Test Field Group")
|
13
13
|
html = helper.field_group_subtitle(field_group)
|
14
14
|
expect(html).to include("Test Field Group")
|
15
15
|
expect(html).to include("This field group applies to contacts tagged with")
|