fat_free_crm 0.17.2 → 0.19.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 +5 -5
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +71 -148
- data/.travis.yml +35 -14
- data/CHANGELOG.md +88 -5
- data/CONTRIBUTORS.md +96 -53
- data/Dockerfile +45 -14
- data/Gemfile +23 -13
- data/Gemfile.lock +249 -241
- data/Procfile +1 -1
- data/README.md +9 -6
- data/Rakefile +1 -1
- data/app/assets/javascripts/crm.js.coffee +3 -3
- data/app/assets/javascripts/crm_select2.js.coffee +15 -14
- data/app/assets/stylesheets/common.scss +1 -1
- data/app/controllers/admin/application_controller.rb +1 -1
- data/app/controllers/admin/field_groups_controller.rb +9 -4
- data/app/controllers/admin/fields_controller.rb +4 -4
- data/app/controllers/admin/groups_controller.rb +1 -1
- data/app/controllers/admin/tags_controller.rb +2 -4
- data/app/controllers/admin/users_controller.rb +5 -8
- data/app/controllers/application_controller.rb +22 -45
- data/app/controllers/comments_controller.rb +16 -11
- 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 +1 -3
- data/app/controllers/entities/campaigns_controller.rb +8 -5
- data/app/controllers/entities/contacts_controller.rb +4 -24
- data/app/controllers/entities/leads_controller.rb +16 -12
- data/app/controllers/entities/opportunities_controller.rb +17 -16
- data/app/controllers/entities_controller.rb +31 -12
- data/app/controllers/home_controller.rb +2 -4
- data/app/controllers/lists_controller.rb +5 -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 +22 -17
- data/app/controllers/users_controller.rb +8 -29
- data/app/helpers/accounts_helper.rb +1 -1
- data/app/helpers/admin/users_helper.rb +1 -1
- data/app/helpers/application_helper.rb +28 -33
- data/app/helpers/campaigns_helper.rb +1 -1
- data/app/helpers/contacts_helper.rb +1 -3
- data/app/helpers/leads_helper.rb +1 -1
- data/app/helpers/opportunities_helper.rb +48 -3
- data/app/helpers/tags_helper.rb +1 -1
- data/app/helpers/tasks_helper.rb +1 -1
- 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 +10 -10
- data/app/models/entities/campaign.rb +4 -6
- data/app/models/entities/contact.rb +24 -12
- data/app/models/entities/lead.rb +7 -14
- data/app/models/entities/opportunity.rb +10 -11
- data/app/models/fields/custom_field.rb +1 -0
- data/app/models/fields/custom_field_date_pair.rb +2 -0
- 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 +5 -7
- data/app/models/observers/task_observer.rb +1 -1
- data/app/models/polymorphic/email.rb +2 -2
- data/app/models/polymorphic/task.rb +13 -9
- data/app/models/polymorphic/version.rb +3 -2
- data/app/models/setting.rb +2 -0
- data/app/models/users/ability.rb +3 -4
- data/app/models/users/permission.rb +3 -3
- data/app/models/users/preference.rb +2 -1
- data/app/models/users/user.rb +67 -42
- data/app/views/accounts/_top_section.html.haml +1 -1
- data/app/views/accounts/edit.js.haml +1 -1
- data/app/views/accounts/update.js.haml +2 -2
- data/app/views/admin/users/_user.html.haml +4 -4
- data/app/views/campaigns/_metrics.html.haml +3 -3
- 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/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/home/_opportunity.html.haml +4 -19
- data/app/views/layouts/_about.html.haml +5 -5
- data/app/views/layouts/_header.html.haml +3 -3
- data/app/views/layouts/admin/_header.html.haml +1 -1
- data/app/views/opportunities/_index_long.html.haml +1 -24
- data/app/views/opportunities/_sidebar_show.html.haml +3 -3
- data/app/views/opportunities/_top_section.html.haml +1 -1
- data/app/views/shared/_address.html.haml +5 -5
- data/app/views/shared/_paginate_with_per_page.html.haml +1 -0
- data/app/views/users/_avatar.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 +1 -1
- 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 +26 -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_5_2.rb +40 -0
- data/config/initializers/relative_url_root.rb +1 -3
- data/config/initializers/session_store.rb +1 -3
- data/config/initializers/wrap_parameters.rb +4 -9
- 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 +1 -0
- data/config/routes.rb +20 -9
- 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/schema.rb +48 -46
- data/docker-compose.yml +10 -0
- data/fat_free_crm.gemspec +12 -14
- 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/engine.rb +2 -2
- 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 +2 -2
- data/lib/fat_free_crm/gem_dependencies.rb +1 -1
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +1 -3
- 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 -18
- 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 +7 -8
- data/lib/missing_translation_detector.rb +1 -0
- data/lib/tasks/ffcrm/missing_translations.rake +1 -0
- data/lib/tasks/ffcrm/setup.rake +13 -4
- data/lib/tasks/ffcrm/update_data.rake +2 -2
- data/script/rails +2 -2
- data/spec/controllers/admin/users_controller_spec.rb +25 -81
- data/spec/controllers/comments_controller_spec.rb +19 -19
- data/spec/controllers/emails_controller_spec.rb +2 -2
- data/spec/controllers/entities/accounts_controller_spec.rb +56 -56
- data/spec/controllers/entities/campaigns_controller_spec.rb +66 -66
- data/spec/controllers/entities/contacts_controller_spec.rb +69 -68
- data/spec/controllers/entities/leads_controller_spec.rb +126 -126
- data/spec/controllers/entities/opportunities_controller_spec.rb +101 -101
- data/spec/controllers/entities_controller_spec.rb +5 -0
- data/spec/controllers/home_controller_spec.rb +30 -30
- data/spec/controllers/tasks_controller_spec.rb +42 -40
- data/spec/controllers/users_controller_spec.rb +43 -113
- data/spec/factories/account_factories.rb +13 -13
- data/spec/factories/campaign_factories.rb +8 -8
- data/spec/factories/contact_factories.rb +18 -18
- data/spec/factories/field_factories.rb +11 -10
- data/spec/factories/lead_factories.rb +13 -13
- data/spec/factories/list_factories.rb +3 -3
- data/spec/factories/opportunity_factories.rb +9 -9
- data/spec/factories/sequences.rb +1 -1
- data/spec/factories/setting_factories.rb +5 -5
- data/spec/factories/shared_factories.rb +25 -23
- data/spec/factories/subscription_factories.rb +1 -1
- data/spec/factories/tag_factories.rb +1 -1
- data/spec/factories/task_factories.rb +11 -11
- data/spec/factories/user_factories.rb +27 -30
- data/spec/features/accounts_spec.rb +17 -4
- data/spec/features/admin/groups_spec.rb +2 -2
- data/spec/features/admin/users_spec.rb +4 -2
- data/spec/features/campaigns_spec.rb +5 -5
- data/spec/features/contacts_spec.rb +11 -5
- data/spec/features/dashboard_spec.rb +8 -8
- 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 +5 -5
- data/spec/features/opportunities_overview_spec.rb +16 -16
- data/spec/features/opportunities_spec.rb +35 -9
- data/spec/features/support/autocomlete_helper.rb +17 -0
- data/spec/features/support/browser.rb +5 -9
- data/spec/features/tasks_spec.rb +5 -5
- data/spec/helpers/admin/field_groups_helper_spec.rb +1 -1
- data/spec/helpers/application_helper_spec.rb +1 -1
- data/spec/helpers/tasks_helper_spec.rb +1 -1
- data/spec/helpers/users_helper_spec.rb +7 -7
- data/spec/lib/comment_extensions_spec.rb +11 -5
- data/spec/lib/errors_spec.rb +2 -2
- data/spec/lib/mail_processor/base_spec.rb +3 -3
- data/spec/lib/mail_processor/comment_replies_spec.rb +3 -3
- data/spec/lib/mail_processor/dropbox_spec.rb +17 -17
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +8 -8
- data/spec/lib/permissions_spec.rb +15 -28
- data/spec/mailers/devise_mailer_spec.rb +35 -0
- data/spec/mailers/user_mailer_spec.rb +6 -32
- data/spec/models/entities/account_spec.rb +58 -32
- data/spec/models/entities/campaign_spec.rb +18 -25
- data/spec/models/entities/contact_spec.rb +113 -21
- data/spec/models/entities/lead_spec.rb +9 -11
- data/spec/models/entities/opportunity_spec.rb +45 -45
- data/spec/models/fields/custom_field_date_pair_spec.rb +4 -2
- data/spec/models/fields/custom_field_spec.rb +21 -19
- data/spec/models/list_spec.rb +2 -2
- data/spec/models/observers/entity_observer_spec.rb +7 -7
- data/spec/models/polymorphic/address_spec.rb +1 -1
- data/spec/models/polymorphic/avatar_spec.rb +5 -5
- data/spec/models/polymorphic/comment_spec.rb +5 -5
- data/spec/models/polymorphic/task_spec.rb +65 -58
- data/spec/models/polymorphic/version_spec.rb +31 -31
- data/spec/models/setting_spec.rb +2 -2
- data/spec/models/users/preference_spec.rb +6 -6
- data/spec/models/users/user_spec.rb +46 -50
- data/spec/routing/users_routing_spec.rb +30 -8
- data/spec/shared/controllers.rb +3 -9
- data/spec/shared/models.rb +22 -22
- data/spec/spec_helper.rb +12 -4
- 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} +11 -11
- data/spec/support/macros.rb +7 -4
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/create.js.haml_spec.rb +2 -2
- data/spec/views/accounts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/accounts/edit.js.haml_spec.rb +2 -2
- data/spec/views/accounts/index.haml_spec.rb +2 -2
- data/spec/views/accounts/index.js.haml_spec.rb +1 -1
- data/spec/views/accounts/show.haml_spec.rb +4 -4
- data/spec/views/accounts/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/create.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/destroy.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/edit.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/index.haml_spec.rb +1 -1
- data/spec/views/admin/users/index.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/suspend.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/update.js.haml_spec.rb +1 -1
- data/spec/views/application/auto_complete.haml_spec.rb +3 -3
- data/spec/views/campaigns/_edit.haml_spec.rb +1 -1
- data/spec/views/campaigns/create.js.haml_spec.rb +3 -3
- data/spec/views/campaigns/destroy.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/edit.js.haml_spec.rb +2 -2
- data/spec/views/campaigns/index.haml_spec.rb +1 -1
- data/spec/views/campaigns/index.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/show.haml_spec.rb +4 -4
- data/spec/views/campaigns/update.js.haml_spec.rb +1 -1
- data/spec/views/contacts/_edit.haml_spec.rb +7 -7
- data/spec/views/contacts/_new.haml_spec.rb +1 -1
- data/spec/views/contacts/create.js.haml_spec.rb +4 -4
- data/spec/views/contacts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/contacts/edit.js.haml_spec.rb +3 -3
- data/spec/views/contacts/index.haml_spec.rb +1 -1
- data/spec/views/contacts/index.js.html_spec.rb +1 -1
- data/spec/views/contacts/new.js.haml_spec.rb +1 -1
- data/spec/views/contacts/show.haml_spec.rb +3 -3
- data/spec/views/contacts/update.js.haml_spec.rb +3 -3
- data/spec/views/home/index.haml_spec.rb +1 -1
- data/spec/views/home/index.js.haml_spec.rb +1 -1
- data/spec/views/home/options.js.haml_spec.rb +2 -2
- data/spec/views/leads/_convert.haml_spec.rb +3 -3
- data/spec/views/leads/_edit.haml_spec.rb +2 -2
- data/spec/views/leads/_new.haml_spec.rb +2 -2
- data/spec/views/leads/_sidebar_show.haml_spec.rb +5 -5
- data/spec/views/leads/convert.js.haml_spec.rb +4 -4
- data/spec/views/leads/create.js.haml_spec.rb +5 -5
- data/spec/views/leads/destroy.js.haml_spec.rb +2 -2
- data/spec/views/leads/edit.js.haml_spec.rb +4 -4
- data/spec/views/leads/index.haml_spec.rb +1 -1
- data/spec/views/leads/index.js.haml_spec.rb +1 -1
- data/spec/views/leads/new.js.haml_spec.rb +1 -1
- data/spec/views/leads/promote.js.haml_spec.rb +7 -7
- data/spec/views/leads/reject.js.haml_spec.rb +2 -2
- data/spec/views/leads/show.haml_spec.rb +2 -2
- data/spec/views/leads/update.js.haml_spec.rb +4 -4
- data/spec/views/opportunities/_edit.haml_spec.rb +7 -7
- data/spec/views/opportunities/_new.haml_spec.rb +2 -2
- data/spec/views/opportunities/create.js.haml_spec.rb +6 -6
- data/spec/views/opportunities/destroy.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/edit.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/index.haml_spec.rb +1 -1
- data/spec/views/opportunities/index.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/new.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/show.haml_spec.rb +3 -3
- data/spec/views/opportunities/update.js.haml_spec.rb +5 -5
- data/spec/views/tasks/_edit.haml_spec.rb +1 -1
- data/spec/views/tasks/complete.js.haml_spec.rb +4 -4
- data/spec/views/tasks/create.js.haml_spec.rb +6 -6
- data/spec/views/tasks/destroy.js.haml_spec.rb +2 -2
- data/spec/views/tasks/index.haml_spec.rb +4 -4
- data/spec/views/tasks/new.js.haml_spec.rb +1 -1
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +2 -2
- data/spec/views/tasks/update.js.haml_spec.rb +18 -18
- data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
- data/vendor/gems/ransack_ui-1.3.4/.gitignore +17 -0
- data/vendor/gems/ransack_ui-1.3.4/Gemfile +7 -0
- data/vendor/gems/ransack_ui-1.3.4/LICENSE.txt +22 -0
- data/vendor/gems/ransack_ui-1.3.4/README.md +57 -0
- data/vendor/gems/ransack_ui-1.3.4/Rakefile +1 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/images/ransack_ui/calendar.png +0 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/images/ransack_ui/delete.png +0 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack/predicates.js.coffee +41 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_bootstrap/button_group_select.js.coffee +26 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_bootstrap/index.js.coffee +2 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_jquery/index.js +2 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_jquery/search_form.js.coffee.erb +499 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/stylesheets/ransack_ui_bootstrap/index.css +3 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/stylesheets/ransack_ui_bootstrap/search.css.scss +41 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_condition_fields.html.erb +15 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_grouping_fields.html.erb +16 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_search.html.erb +29 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_sort_fields.html.erb +4 -0
- data/vendor/gems/ransack_ui-1.3.4/config/locales/en.yml +24 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui.rb +9 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/adapters/active_record.rb +6 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/adapters/active_record/base.rb +46 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/controller_helpers.rb +18 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/rails/engine.rb +21 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/adapters/active_record/base.rb +47 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/configuration.rb +15 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/context.rb +9 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/helpers/form_builder.rb +262 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/attribute.rb +13 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/condition.rb +13 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/grouping.rb +20 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/version.rb +3 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/view_helpers.rb +30 -0
- data/vendor/gems/ransack_ui-1.3.4/ransack_ui.gemspec +23 -0
- metadata +83 -70
- 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/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
@@ -41,25 +41,23 @@
|
|
41
41
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
42
42
|
|
43
43
|
describe Lead do
|
44
|
-
let(:current_user) { FactoryGirl.create(:user) }
|
45
|
-
|
46
44
|
it "should create a new instance given valid attributes" do
|
47
45
|
Lead.create!(first_name: "Billy", last_name: "Bones")
|
48
46
|
end
|
49
47
|
|
50
48
|
describe "Attach" do
|
51
49
|
before do
|
52
|
-
@lead =
|
50
|
+
@lead = create(:lead)
|
53
51
|
end
|
54
52
|
|
55
53
|
it "should return nil when attaching existing task" do
|
56
|
-
@task =
|
54
|
+
@task = create(:task, asset: @lead)
|
57
55
|
|
58
56
|
expect(@lead.attach!(@task)).to eq(nil)
|
59
57
|
end
|
60
58
|
|
61
59
|
it "should return non-empty list of tasks when attaching new task" do
|
62
|
-
@task =
|
60
|
+
@task = create(:task)
|
63
61
|
|
64
62
|
expect(@lead.attach!(@task)).to eq([@task])
|
65
63
|
end
|
@@ -67,11 +65,11 @@ describe Lead do
|
|
67
65
|
|
68
66
|
describe "Discard" do
|
69
67
|
before do
|
70
|
-
@lead =
|
68
|
+
@lead = create(:lead)
|
71
69
|
end
|
72
70
|
|
73
71
|
it "should discard a task" do
|
74
|
-
@task =
|
72
|
+
@task = create(:task, asset: @lead)
|
75
73
|
expect(@lead.tasks.count).to eq(1)
|
76
74
|
|
77
75
|
@lead.discard!(@task)
|
@@ -82,16 +80,16 @@ describe Lead do
|
|
82
80
|
|
83
81
|
describe "Exportable" do
|
84
82
|
describe "assigned lead" do
|
85
|
-
let(:lead1) {
|
86
|
-
let(:lead2) {
|
83
|
+
let(:lead1) { build(:lead, assignee: create(:user)) }
|
84
|
+
let(:lead2) { build(:lead, user: create(:user, first_name: nil, last_name: nil), assignee: create(:user, first_name: nil, last_name: nil)) }
|
87
85
|
it_should_behave_like("exportable") do
|
88
86
|
let(:exported) { [lead1, lead2] }
|
89
87
|
end
|
90
88
|
end
|
91
89
|
|
92
90
|
describe "unassigned lead" do
|
93
|
-
let(:lead1) {
|
94
|
-
let(:lead2) {
|
91
|
+
let(:lead1) { build(:lead, assignee: nil) }
|
92
|
+
let(:lead2) { build(:lead, user: create(:user, first_name: nil, last_name: nil), assignee: nil) }
|
95
93
|
it_should_behave_like("exportable") do
|
96
94
|
let(:exported) { [lead1, lead2] }
|
97
95
|
end
|
@@ -35,8 +35,8 @@ describe Opportunity do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should be possible to create opportunity with the same name" do
|
38
|
-
|
39
|
-
expect {
|
38
|
+
create(:opportunity, name: "Hello")
|
39
|
+
expect { create(:opportunity, name: "Hello") }.to_not raise_error
|
40
40
|
end
|
41
41
|
|
42
42
|
it "have a default stage" do
|
@@ -50,8 +50,8 @@ describe Opportunity do
|
|
50
50
|
|
51
51
|
describe "Update existing opportunity" do
|
52
52
|
before(:each) do
|
53
|
-
@account =
|
54
|
-
@opportunity =
|
53
|
+
@account = create(:account)
|
54
|
+
@opportunity = create(:opportunity, account: @account)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should create new account if requested so" do
|
@@ -66,7 +66,7 @@ describe Opportunity do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should update the account another account was selected" do
|
69
|
-
@another_account =
|
69
|
+
@another_account = create(:account)
|
70
70
|
expect do
|
71
71
|
@opportunity.update_with_account_and_permissions(
|
72
72
|
account: { id: @another_account.id },
|
@@ -100,7 +100,7 @@ describe Opportunity do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should change account if entered name of another account was found" do
|
103
|
-
@another_account =
|
103
|
+
@another_account = create(:account, name: "Another name")
|
104
104
|
expect do
|
105
105
|
@opportunity.update_with_account_and_permissions(
|
106
106
|
account: { name: "Another name" },
|
@@ -112,14 +112,14 @@ describe Opportunity do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should set the probability to 0% if opportunity has been lost" do
|
115
|
-
opportunity =
|
115
|
+
opportunity = create(:opportunity, stage: "prospecting", probability: 25)
|
116
116
|
opportunity.update_attributes(stage: 'lost')
|
117
117
|
opportunity.reload
|
118
118
|
expect(opportunity.probability).to eq(0)
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should set the probablility to 100% if opportunity has been won" do
|
122
|
-
opportunity =
|
122
|
+
opportunity = create(:opportunity, stage: "prospecting", probability: 65)
|
123
123
|
opportunity.update_attributes(stage: 'won')
|
124
124
|
opportunity.reload
|
125
125
|
expect(opportunity.probability).to eq(100)
|
@@ -130,12 +130,12 @@ describe Opportunity do
|
|
130
130
|
it "should find non-closed opportunities" do
|
131
131
|
Opportunity.delete_all
|
132
132
|
@opportunities = [
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
create(:opportunity, stage: "prospecting", amount: 1),
|
134
|
+
create(:opportunity, stage: "analysis", amount: 1),
|
135
|
+
create(:opportunity, stage: "won", amount: 2),
|
136
|
+
create(:opportunity, stage: "won", amount: 2),
|
137
|
+
create(:opportunity, stage: "lost", amount: 3),
|
138
|
+
create(:opportunity, stage: "lost", amount: 3)
|
139
139
|
]
|
140
140
|
expect(Opportunity.pipeline.sum(:amount)).to eq(2)
|
141
141
|
expect(Opportunity.won.sum(:amount)).to eq(4)
|
@@ -144,8 +144,8 @@ describe Opportunity do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
context "unassigned" do
|
147
|
-
let(:unassigned_opportunity) {
|
148
|
-
let(:assigned_opportunity) {
|
147
|
+
let(:unassigned_opportunity) { create(:opportunity, assignee: nil) }
|
148
|
+
let(:assigned_opportunity) { create(:opportunity, assignee: create(:user)) }
|
149
149
|
|
150
150
|
it "includes unassigned opportunities" do
|
151
151
|
expect(Opportunity.unassigned).to include(unassigned_opportunity)
|
@@ -159,12 +159,12 @@ describe Opportunity do
|
|
159
159
|
|
160
160
|
describe "Attach" do
|
161
161
|
before do
|
162
|
-
@opportunity =
|
162
|
+
@opportunity = create(:opportunity)
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should return nil when attaching existing asset" do
|
166
|
-
@task =
|
167
|
-
@contact =
|
166
|
+
@task = create(:task, asset: @opportunity)
|
167
|
+
@contact = create(:contact)
|
168
168
|
@opportunity.contacts << @contact
|
169
169
|
|
170
170
|
expect(@opportunity.attach!(@task)).to eq(nil)
|
@@ -172,8 +172,8 @@ describe Opportunity do
|
|
172
172
|
end
|
173
173
|
|
174
174
|
it "should return non-empty list of attachments when attaching new asset" do
|
175
|
-
@task =
|
176
|
-
@contact =
|
175
|
+
@task = create(:task)
|
176
|
+
@contact = create(:contact)
|
177
177
|
|
178
178
|
expect(@opportunity.attach!(@task)).to eq([@task])
|
179
179
|
expect(@opportunity.attach!(@contact)).to eq([@contact])
|
@@ -182,11 +182,11 @@ describe Opportunity do
|
|
182
182
|
|
183
183
|
describe "Discard" do
|
184
184
|
before do
|
185
|
-
@opportunity =
|
185
|
+
@opportunity = create(:opportunity)
|
186
186
|
end
|
187
187
|
|
188
188
|
it "should discard a task" do
|
189
|
-
@task =
|
189
|
+
@task = create(:task, asset: @opportunity)
|
190
190
|
expect(@opportunity.tasks.count).to eq(1)
|
191
191
|
|
192
192
|
@opportunity.discard!(@task)
|
@@ -195,7 +195,7 @@ describe Opportunity do
|
|
195
195
|
end
|
196
196
|
|
197
197
|
it "should discard an contact" do
|
198
|
-
@contact =
|
198
|
+
@contact = create(:contact)
|
199
199
|
@opportunity.contacts << @contact
|
200
200
|
expect(@opportunity.contacts.count).to eq(1)
|
201
201
|
|
@@ -207,16 +207,16 @@ describe Opportunity do
|
|
207
207
|
|
208
208
|
describe "Exportable" do
|
209
209
|
describe "assigned opportunity" do
|
210
|
-
let(:opportunity1) {
|
211
|
-
let(:opportunity2) {
|
210
|
+
let(:opportunity1) { build(:opportunity, user: create(:user), assignee: create(:user)) }
|
211
|
+
let(:opportunity2) { build(:opportunity, user: create(:user, first_name: nil, last_name: nil), assignee: create(:user, first_name: nil, last_name: nil)) }
|
212
212
|
it_should_behave_like("exportable") do
|
213
213
|
let(:exported) { [opportunity1, opportunity2] }
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
217
|
describe "unassigned opportunity" do
|
218
|
-
let(:opportunity1) {
|
219
|
-
let(:opportunity2) {
|
218
|
+
let(:opportunity1) { build(:opportunity, user: create(:user), assignee: nil) }
|
219
|
+
let(:opportunity2) { build(:opportunity, user: create(:user, first_name: nil, last_name: nil), assignee: nil) }
|
220
220
|
it_should_behave_like("exportable") do
|
221
221
|
let(:exported) { [opportunity1, opportunity2] }
|
222
222
|
end
|
@@ -230,14 +230,14 @@ describe Opportunity do
|
|
230
230
|
describe "scopes" do
|
231
231
|
context "visible_on_dashboard" do
|
232
232
|
before :each do
|
233
|
-
@user =
|
234
|
-
@o1 =
|
235
|
-
@o2 =
|
236
|
-
@o3 =
|
237
|
-
@o4 =
|
238
|
-
@o5 =
|
239
|
-
@o6 =
|
240
|
-
@o7 =
|
233
|
+
@user = create(:user)
|
234
|
+
@o1 = create(:opportunity_in_pipeline, user: @user, stage: 'prospecting')
|
235
|
+
@o2 = create(:opportunity_in_pipeline, user: @user, assignee: create(:user), stage: 'prospecting')
|
236
|
+
@o3 = create(:opportunity_in_pipeline, user: create(:user), assignee: @user, stage: 'prospecting')
|
237
|
+
@o4 = create(:opportunity_in_pipeline, user: create(:user), assignee: create(:user), stage: 'prospecting')
|
238
|
+
@o5 = create(:opportunity_in_pipeline, user: create(:user), assignee: @user, stage: 'prospecting')
|
239
|
+
@o6 = create(:opportunity, assignee: @user, stage: 'won')
|
240
|
+
@o7 = create(:opportunity, assignee: @user, stage: 'lost')
|
241
241
|
end
|
242
242
|
|
243
243
|
it "should show opportunities which have been created by the user and are unassigned" do
|
@@ -263,9 +263,9 @@ describe Opportunity do
|
|
263
263
|
end
|
264
264
|
|
265
265
|
context "by_closes_on" do
|
266
|
-
let(:o1) {
|
267
|
-
let(:o2) {
|
268
|
-
let(:o3) {
|
266
|
+
let(:o1) { create(:opportunity, closes_on: 3.days.from_now) }
|
267
|
+
let(:o2) { create(:opportunity, closes_on: 7.days.from_now) }
|
268
|
+
let(:o3) { create(:opportunity, closes_on: 5.days.from_now) }
|
269
269
|
|
270
270
|
it "should show opportunities ordered by closes on" do
|
271
271
|
expect(Opportunity.by_closes_on).to eq([o1, o3, o2])
|
@@ -273,9 +273,9 @@ describe Opportunity do
|
|
273
273
|
end
|
274
274
|
|
275
275
|
context "by_amount" do
|
276
|
-
let(:o1) {
|
277
|
-
let(:o2) {
|
278
|
-
let(:o3) {
|
276
|
+
let(:o1) { create(:opportunity, amount: 50_000) }
|
277
|
+
let(:o2) { create(:opportunity, amount: 10_000) }
|
278
|
+
let(:o3) { create(:opportunity, amount: 750_000) }
|
279
279
|
|
280
280
|
it "should show opportunities ordered by amount" do
|
281
281
|
expect(Opportunity.by_amount).to eq([o3, o1, o2])
|
@@ -283,9 +283,9 @@ describe Opportunity do
|
|
283
283
|
end
|
284
284
|
|
285
285
|
context "not lost" do
|
286
|
-
let(:o1) {
|
287
|
-
let(:o2) {
|
288
|
-
let(:o3) {
|
286
|
+
let(:o1) { create(:opportunity, stage: 'won') }
|
287
|
+
let(:o2) { create(:opportunity, stage: 'lost') }
|
288
|
+
let(:o3) { create(:opportunity, stage: 'analysis') }
|
289
289
|
|
290
290
|
it "should show opportunities which are not lost" do
|
291
291
|
expect(Opportunity.not_lost).to include(o1, o3)
|
@@ -67,7 +67,8 @@ describe CustomFieldDatePair do
|
|
67
67
|
|
68
68
|
it "when from > to it should not be valid" do
|
69
69
|
foo = double(cf_event_from: @today, cf_event_to: @today - 1.day)
|
70
|
-
err = double(:errors)
|
70
|
+
err = double(:errors)
|
71
|
+
allow(err).to receive(:add)
|
71
72
|
expect(foo).to receive(:errors).and_return(err)
|
72
73
|
@to.custom_validator(foo)
|
73
74
|
end
|
@@ -82,7 +83,8 @@ describe CustomFieldDatePair do
|
|
82
83
|
it "should call custom field validation on super class" do
|
83
84
|
from = CustomFieldDatePair.new(name: 'cf_event_from', required: true)
|
84
85
|
foo = double(cf_event_from: nil)
|
85
|
-
err = double(:errors)
|
86
|
+
err = double(:errors)
|
87
|
+
allow(err).to receive(:add)
|
86
88
|
expect(foo).to receive(:errors).and_return(err)
|
87
89
|
from.custom_validator(foo)
|
88
90
|
end
|
@@ -35,16 +35,16 @@ describe CustomField do
|
|
35
35
|
expect(Contact).to receive(:reset_column_information)
|
36
36
|
expect(Contact).to receive(:serialize_custom_fields!)
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
create(:custom_field,
|
39
|
+
as: "string",
|
40
|
+
name: "cf_test_field",
|
41
|
+
label: "Test Field",
|
42
|
+
field_group: create(:field_group, klass_name: "Contact"))
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should generate a unique column name for a custom field" do
|
46
|
-
field_group =
|
47
|
-
c =
|
46
|
+
field_group = build(:field_group, klass_name: "Contact")
|
47
|
+
c = build(:custom_field, label: "Test Field", field_group: field_group)
|
48
48
|
|
49
49
|
columns = []
|
50
50
|
%w[cf_test_field cf_test_field_2 cf_test_field_3 cf_test_field_4].each do |field|
|
@@ -54,12 +54,12 @@ describe CustomField do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should evaluate the safety of database transitions" do
|
57
|
-
c =
|
57
|
+
c = build(:custom_field, as: "string")
|
58
58
|
expect(c.send(:db_transition_safety, c.as, "email")).to eq(:null)
|
59
59
|
expect(c.send(:db_transition_safety, c.as, "text")).to eq(:safe)
|
60
60
|
expect(c.send(:db_transition_safety, c.as, "datetime")).to eq(:unsafe)
|
61
61
|
|
62
|
-
c =
|
62
|
+
c = build(:custom_field, as: "datetime")
|
63
63
|
expect(c.send(:db_transition_safety, c.as, "date")).to eq(:safe)
|
64
64
|
expect(c.send(:db_transition_safety, c.as, "url")).to eq(:unsafe)
|
65
65
|
end
|
@@ -67,7 +67,7 @@ describe CustomField do
|
|
67
67
|
it "should return a safe list of types for the 'as' select options" do
|
68
68
|
{ "email" => %w[check_boxes text string email url tel select radio_buttons],
|
69
69
|
"integer" => %w[integer float] }.each do |type, expected_arr|
|
70
|
-
c =
|
70
|
+
c = build(:custom_field, as: type)
|
71
71
|
opts = c.available_as
|
72
72
|
expect(opts.map(&:first)).to match_array(expected_arr)
|
73
73
|
end
|
@@ -81,12 +81,12 @@ describe CustomField do
|
|
81
81
|
expect(Contact).to receive(:reset_column_information).twice
|
82
82
|
expect(Contact).to receive(:serialize_custom_fields!).twice
|
83
83
|
|
84
|
-
field_group =
|
85
|
-
c =
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
84
|
+
field_group = create(:field_group, klass_name: "Contact")
|
85
|
+
c = create(:custom_field,
|
86
|
+
label: "Test Field",
|
87
|
+
name: nil,
|
88
|
+
as: "email",
|
89
|
+
field_group: field_group)
|
90
90
|
c.as = "text"
|
91
91
|
c.save
|
92
92
|
end
|
@@ -102,7 +102,7 @@ describe CustomField do
|
|
102
102
|
expect(Contact).to receive(:reset_column_information)
|
103
103
|
expect(Contact).to receive(:serialize_custom_fields!)
|
104
104
|
|
105
|
-
contact =
|
105
|
+
contact = build(:contact)
|
106
106
|
expect(contact.cf_another_new_field).to eq(nil)
|
107
107
|
end
|
108
108
|
end
|
@@ -111,7 +111,8 @@ describe CustomField do
|
|
111
111
|
it "should have errors if custom field is required" do
|
112
112
|
event = CustomField.new(name: 'cf_event', required: true)
|
113
113
|
foo = double(cf_event: nil)
|
114
|
-
err = double(:errors)
|
114
|
+
err = double(:errors)
|
115
|
+
allow(err).to receive(:add)
|
115
116
|
expect(foo).to receive(:errors).and_return(err)
|
116
117
|
event.custom_validator(foo)
|
117
118
|
end
|
@@ -119,7 +120,8 @@ describe CustomField do
|
|
119
120
|
it "should have errors if custom field is longer than maxlength" do
|
120
121
|
event = CustomField.new(name: 'cf_event', maxlength: 5)
|
121
122
|
foo = double(cf_event: "This is too long")
|
122
|
-
err = double(:errors)
|
123
|
+
err = double(:errors)
|
124
|
+
allow(err).to receive(:add)
|
123
125
|
expect(foo).to receive(:errors).and_return(err)
|
124
126
|
event.custom_validator(foo)
|
125
127
|
end
|
data/spec/models/list_spec.rb
CHANGED
@@ -10,10 +10,10 @@ require 'spec_helper'
|
|
10
10
|
describe List do
|
11
11
|
it "should parse the controller from the url" do
|
12
12
|
["/controller/action", "controller/action?utf8=%E2%9C%93"].each do |url|
|
13
|
-
list =
|
13
|
+
list = build(:list, url: url)
|
14
14
|
expect(list.controller).to eq("controller")
|
15
15
|
end
|
16
|
-
list =
|
16
|
+
list = build(:list, url: nil)
|
17
17
|
expect(list.controller).to eq(nil)
|
18
18
|
end
|
19
19
|
end
|
@@ -10,14 +10,14 @@ require 'spec_helper'
|
|
10
10
|
describe EntityObserver do
|
11
11
|
before do
|
12
12
|
allow(Setting).to receive(:host).and_return('http://www.example.com')
|
13
|
-
allow(PaperTrail).to receive(:whodunnit).and_return(assigner)
|
13
|
+
allow(PaperTrail.request).to receive(:whodunnit).and_return(assigner)
|
14
14
|
end
|
15
15
|
|
16
16
|
%i[account contact lead opportunity].each do |entity_type|
|
17
17
|
describe "on creation of #{entity_type}" do
|
18
|
-
let(:assignee) {
|
19
|
-
let(:assigner) {
|
20
|
-
let!(:entity) {
|
18
|
+
let(:assignee) { create(:user) }
|
19
|
+
let(:assigner) { create(:user) }
|
20
|
+
let!(:entity) { build(entity_type, user: assigner, assignee: assignee) }
|
21
21
|
let(:mail) { double('mail', deliver_now: true) }
|
22
22
|
|
23
23
|
after :each do
|
@@ -45,9 +45,9 @@ describe EntityObserver do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
describe "on update of #{entity_type}" do
|
48
|
-
let(:assignee) {
|
49
|
-
let(:assigner) {
|
50
|
-
let!(:entity) {
|
48
|
+
let(:assignee) { create(:user) }
|
49
|
+
let(:assigner) { create(:user) }
|
50
|
+
let!(:entity) { create(entity_type, user: create(:user)) }
|
51
51
|
let(:mail) { double('mail', deliver_now: true) }
|
52
52
|
|
53
53
|
it "notifies the new owner if the entity is re-assigned" do
|
@@ -29,6 +29,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
29
29
|
|
30
30
|
describe Address do
|
31
31
|
it "should create a new instance given valid attributes" do
|
32
|
-
Address.create!(street1: "street1", street2: "street2", city: "city", state: "state", zipcode: "zipcode", country: "country", full_address: "fa", address_type: "Lead", addressable:
|
32
|
+
Address.create!(street1: "street1", street2: "street2", city: "city", state: "state", zipcode: "zipcode", country: "country", full_address: "fa", address_type: "Lead", addressable: create(:lead))
|
33
33
|
end
|
34
34
|
end
|
@@ -24,22 +24,22 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
24
24
|
|
25
25
|
describe Avatar do
|
26
26
|
before(:each) do
|
27
|
-
@user =
|
27
|
+
@user = create(:user)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should create a new instance given valid attributes" do
|
31
|
-
expect(
|
31
|
+
expect(create(:avatar, entity: @user)).to be_valid
|
32
32
|
end
|
33
33
|
|
34
34
|
it "user should have one avatar as entity" do
|
35
|
-
avatar =
|
35
|
+
avatar = create(:avatar, entity: @user)
|
36
36
|
expect(@user.avatar).to eq(avatar)
|
37
37
|
end
|
38
38
|
|
39
39
|
it "user might have many avatars as owner" do
|
40
40
|
avatars = [
|
41
|
-
|
42
|
-
|
41
|
+
create(:avatar, user: @user, entity: create(:user)),
|
42
|
+
create(:avatar, user: @user, entity: create(:user))
|
43
43
|
]
|
44
44
|
expect(@user.avatars).to eq(avatars)
|
45
45
|
end
|