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,118 +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
|
-
describe "/leads/update" do
|
11
|
-
before do
|
12
|
-
login
|
13
|
-
assign(:lead, @lead = build_stubbed(:lead, user: current_user, assignee: build_stubbed(:user)))
|
14
|
-
assign(:users, [current_user])
|
15
|
-
assign(:campaigns, [build_stubbed(:campaign)])
|
16
|
-
assign(:lead_status_total, Hash.new(1))
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "no errors:" do
|
20
|
-
describe "on landing page -" do
|
21
|
-
before do
|
22
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/leads/123"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should flip [edit_lead] form" do
|
26
|
-
render
|
27
|
-
expect(rendered).not_to include("lead_#{@lead.id}x")
|
28
|
-
expect(rendered).to include("crm.flip_form('edit_lead'")
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should update sidebar" do
|
32
|
-
render
|
33
|
-
expect(rendered).to include("#sidebar")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "on index page -" do
|
38
|
-
before do
|
39
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/leads"
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should replace [Edit Lead] with lead partial and highlight it" do
|
43
|
-
render
|
44
|
-
expect(rendered).to include("$('#lead_#{@lead.id}').replaceWith('<li class=\\'highlight lead\\' id=\\'lead_#{@lead.id}\\'")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should update sidebar" do
|
48
|
-
render
|
49
|
-
expect(rendered).to include("#sidebar")
|
50
|
-
expect(rendered).to have_text("Lead Statuses")
|
51
|
-
expect(rendered).to have_text("Recent Items")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe "on related asset page -" do
|
56
|
-
before do
|
57
|
-
assign(:campaign, build_stubbed(:campaign))
|
58
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/123"
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should replace [Edit Lead] with lead partial and highlight it" do
|
62
|
-
render
|
63
|
-
expect(rendered).to include("$('#lead_#{@lead.id}').replaceWith('<li class=\\'highlight lead\\' id=\\'lead_#{@lead.id}\\'")
|
64
|
-
expect(rendered).to include(%/$('#lead_#{@lead.id}').effect("highlight"/)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should update campaign sidebar" do
|
68
|
-
assign(:campaign, build_stubbed(:campaign))
|
69
|
-
render
|
70
|
-
|
71
|
-
expect(rendered).to include("sidebar")
|
72
|
-
expect(rendered).to have_text("Recent Items")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "validation errors :" do
|
78
|
-
before do
|
79
|
-
@lead.errors.add(:first_name)
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "on landing page -" do
|
83
|
-
before do
|
84
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/leads/123"
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should redraw the [edit_lead] form" do
|
88
|
-
render
|
89
|
-
expect(rendered).to include("#edit_lead")
|
90
|
-
expect(rendered).to include('focus()')
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "on index page -" do
|
95
|
-
before do
|
96
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/leads"
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should redraw the [edit_lead] form" do
|
100
|
-
render
|
101
|
-
expect(rendered).to include("$('#lead_#{@lead.id}').html")
|
102
|
-
expect(rendered).to include('focus()')
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "on related asset page -" do
|
107
|
-
before do
|
108
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/123"
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should redraw the [edit_lead] form" do
|
112
|
-
render
|
113
|
-
expect(rendered).to include("$('#lead_#{@lead.id}').html")
|
114
|
-
expect(rendered).to include('focus()')
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
@@ -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
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
9
|
-
|
10
|
-
describe "/opportunities/_edit" do
|
11
|
-
include OpportunitiesHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:account, @account = build_stubbed(:account))
|
16
|
-
assign(:accounts, [@account])
|
17
|
-
assign(:stage, Setting.unroll(:opportunity_stage))
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should render [edit opportunity] form" do
|
21
|
-
assign(:users, [current_user])
|
22
|
-
assign(:opportunity, @opportunity = build_stubbed(:opportunity, campaign: @campaign = build_stubbed(:campaign)))
|
23
|
-
render
|
24
|
-
|
25
|
-
expect(rendered).to have_tag('form[class="simple_form edit_opportunity"]') do
|
26
|
-
with_tag "input[type=hidden][id=opportunity_user_id][value='#{@opportunity.user_id}']"
|
27
|
-
with_tag "input[type=hidden][id=opportunity_campaign_id][value='#{@opportunity.campaign_id}']"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should pick default assignee (Myself)" do
|
32
|
-
assign(:users, [current_user])
|
33
|
-
assign(:opportunity, build_stubbed(:opportunity, assignee: nil))
|
34
|
-
render
|
35
|
-
|
36
|
-
expect(rendered).to have_tag("select[id=opportunity_assigned_to]") do |options|
|
37
|
-
expect(options.to_s).not_to include(%(selected="selected"))
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should show correct assignee" do
|
42
|
-
@user = create(:user)
|
43
|
-
assign(:users, [current_user, @user])
|
44
|
-
assign(:opportunity, create(:opportunity, assignee: @user))
|
45
|
-
render
|
46
|
-
|
47
|
-
expect(rendered).to have_tag("select[id=opportunity_assigned_to]") do |_options|
|
48
|
-
with_tag "option[selected=selected]"
|
49
|
-
with_tag "option[value='#{@user.id}']"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should render background info field if settings require so" do
|
54
|
-
assign(:users, [current_user])
|
55
|
-
assign(:opportunity, build_stubbed(:opportunity))
|
56
|
-
Setting.background_info = [:opportunity]
|
57
|
-
|
58
|
-
render
|
59
|
-
expect(rendered).to have_tag("textarea[id=opportunity_background_info]")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should not render background info field if settings do not require so" do
|
63
|
-
assign(:users, [current_user])
|
64
|
-
assign(:opportunity, build_stubbed(:opportunity))
|
65
|
-
Setting.background_info = []
|
66
|
-
|
67
|
-
render
|
68
|
-
expect(rendered).not_to have_tag("textarea[id=opportunity_background_info]")
|
69
|
-
end
|
70
|
-
end
|
@@ -1,51 +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(File.dirname(__FILE__) + '/../../spec_helper')
|
9
|
-
|
10
|
-
describe "/opportunities/_new" do
|
11
|
-
include OpportunitiesHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:opportunity, build(:opportunity))
|
16
|
-
@account = build_stubbed(:account)
|
17
|
-
assign(:account, @account)
|
18
|
-
assign(:accounts, [@account])
|
19
|
-
assign(:users, [current_user])
|
20
|
-
assign(:stage, Setting.unroll(:opportunity_stage))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should render [create opportunity] form" do
|
24
|
-
render
|
25
|
-
expect(view).to render_template(partial: "opportunities/_top_section")
|
26
|
-
expect(view).to render_template(partial: "entities/_permissions")
|
27
|
-
|
28
|
-
expect(rendered).to have_tag('form[class="simple_form new_opportunity"]')
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should pick default assignee (Myself)" do
|
32
|
-
render
|
33
|
-
expect(rendered).to have_tag("select[id=opportunity_assigned_to]") do |options|
|
34
|
-
expect(options.to_s).not_to include(%(selected="selected"))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should render background info field if settings require so" do
|
39
|
-
Setting.background_info = [:opportunity]
|
40
|
-
|
41
|
-
render
|
42
|
-
expect(rendered).to have_tag("textarea[id=opportunity_background_info]")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should not render background info field if settings do not require so" do
|
46
|
-
Setting.background_info = []
|
47
|
-
|
48
|
-
render
|
49
|
-
expect(rendered).not_to have_tag("textarea[id=opportunity_background_info]")
|
50
|
-
end
|
51
|
-
end
|
@@ -1,86 +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
|
-
describe "/opportunities/create" do
|
11
|
-
before do
|
12
|
-
login
|
13
|
-
assign(:stage, Setting.unroll(:opportunity_stage))
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "create success" do
|
17
|
-
before do
|
18
|
-
assign(:opportunity, @opportunity = build_stubbed(:opportunity))
|
19
|
-
assign(:opportunities, [@opportunities].paginate)
|
20
|
-
assign(:opportunity_stage_total, Hash.new(1))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should hide [Create Opportunity] form and insert opportunity partial" do
|
24
|
-
render
|
25
|
-
|
26
|
-
expect(rendered).to include("$('#opportunities').prepend('<li class=\\'highlight opportunity\\' id=\\'opportunity_#{@opportunity.id}\\'")
|
27
|
-
expect(rendered).to include(%/$('#opportunity_#{@opportunity.id}').effect("highlight"/)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should update sidebar filters and recently viewed items when called from opportunities page" do
|
31
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/opportunities"
|
32
|
-
render
|
33
|
-
|
34
|
-
expect(rendered).to include("#sidebar")
|
35
|
-
expect(rendered).to have_text("Opportunity Stages")
|
36
|
-
expect(rendered).to have_text("Recent Items")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should update pagination when called from opportunities index" do
|
40
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/opportunities"
|
41
|
-
render
|
42
|
-
|
43
|
-
expect(rendered).to include("#paginate")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should update related account sidebar when called from related account" do
|
47
|
-
assign(:account, account = create(:account))
|
48
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/accounts/#{account.id}"
|
49
|
-
render
|
50
|
-
|
51
|
-
expect(rendered).to include("#sidebar")
|
52
|
-
expect(rendered).to have_text("Recent Items")
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should update related campaign sidebar when called from related campaign" do
|
56
|
-
assign(:campaign, campaign = create(:campaign))
|
57
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
58
|
-
render
|
59
|
-
|
60
|
-
expect(rendered).to include("#sidebar")
|
61
|
-
expect(rendered).to have_text("Recent Items")
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should update sidebar when called from related contact" do
|
65
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/contacts/123"
|
66
|
-
render
|
67
|
-
|
68
|
-
expect(rendered).to include("#recently")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "create failure" do
|
73
|
-
it "should re-render [create] template in :create_opportunity div" do
|
74
|
-
assign(:opportunity, build(:opportunity, name: nil)) # make it invalid
|
75
|
-
@account = build_stubbed(:account)
|
76
|
-
assign(:users, [build_stubbed(:user)])
|
77
|
-
assign(:account, @account)
|
78
|
-
assign(:accounts, [@account])
|
79
|
-
|
80
|
-
render
|
81
|
-
|
82
|
-
expect(rendered).to include("$('#create_opportunity').html")
|
83
|
-
expect(rendered).to include("crm.create_or_select_account(false)")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,64 +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
|
-
describe "/opportunities/destroy" do
|
11
|
-
before do
|
12
|
-
login
|
13
|
-
assign(:opportunity, @opportunity = build_stubbed(:opportunity))
|
14
|
-
assign(:stage, Setting.unroll(:opportunity_stage))
|
15
|
-
assign(:opportunity_stage_total, Hash.new(1))
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should blind up destroyed opportunity partial" do
|
19
|
-
render
|
20
|
-
expect(rendered).to include("slideUp")
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should update opportunities sidebar when called from opportunities index" do
|
24
|
-
assign(:opportunities, [@opportunity].paginate)
|
25
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/opportunities"
|
26
|
-
render
|
27
|
-
|
28
|
-
expect(rendered).to include("#sidebar")
|
29
|
-
expect(rendered).to have_text("Recent Items")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should update pagination when called from opportunities index" do
|
33
|
-
assign(:opportunities, [@opportunity].paginate)
|
34
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/opportunities"
|
35
|
-
render
|
36
|
-
|
37
|
-
expect(rendered).to include("#paginate")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should update related account sidebar when called from related account" do
|
41
|
-
assign(:account, account = build_stubbed(:account))
|
42
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/accounts/#{account.id}"
|
43
|
-
render
|
44
|
-
|
45
|
-
expect(rendered).to include("#sidebar")
|
46
|
-
expect(rendered).to have_text("Recent Items")
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should update related campaign sidebar when called from related campaign" do
|
50
|
-
assign(:campaign, campaign = build_stubbed(:campaign))
|
51
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/campaigns/#{campaign.id}"
|
52
|
-
render
|
53
|
-
|
54
|
-
expect(rendered).to include("#sidebar")
|
55
|
-
expect(rendered).to have_text("Recent Items")
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should update recently viewed items when called from related contact" do
|
59
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/contacts/123"
|
60
|
-
render
|
61
|
-
|
62
|
-
expect(rendered).to include("#recently")
|
63
|
-
end
|
64
|
-
end
|
@@ -1,75 +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
|
-
describe "/opportunities/edit" do
|
11
|
-
include OpportunitiesHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
|
16
|
-
assign(:opportunity, @opportunity = build_stubbed(:opportunity, user: current_user))
|
17
|
-
assign(:users, [current_user])
|
18
|
-
assign(:account, @account = build_stubbed(:account))
|
19
|
-
assign(:accounts, [@account])
|
20
|
-
assign(:stage, Setting.unroll(:opportunity_stage))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "cancel from opportunity index page: should replace [Edit Opportunity] form with opportunity partial" do
|
24
|
-
params[:cancel] = "true"
|
25
|
-
|
26
|
-
render
|
27
|
-
expect(rendered).to include("$('#opportunity_#{@opportunity.id}').replaceWith")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "cancel from opportunity landing page: should hide [Edit Opportunity] form" do
|
31
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/opportunities/123"
|
32
|
-
params[:cancel] = "true"
|
33
|
-
|
34
|
-
render
|
35
|
-
expect(rendered).to include("crm.flip_form('edit_opportunity'")
|
36
|
-
end
|
37
|
-
|
38
|
-
it "edit: should hide previously open [Edit Opportunity] for and replace it with opportunity partial" do
|
39
|
-
params[:cancel] = nil
|
40
|
-
assign(:previous, previous = build_stubbed(:opportunity, user: current_user))
|
41
|
-
|
42
|
-
render
|
43
|
-
expect(rendered).to include("$('#opportunity_#{previous.id}').replaceWith")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "edit: remove previously open [Edit Opportunity] if it's no longer available" do
|
47
|
-
params[:cancel] = nil
|
48
|
-
assign(:previous, previous = 41)
|
49
|
-
|
50
|
-
render
|
51
|
-
expect(rendered).to include("crm.flick('opportunity_#{previous}', 'remove');")
|
52
|
-
end
|
53
|
-
|
54
|
-
it "edit from opportunities index page: should turn off highlight, hide [Create Opportunity] form, and replace current opportunity with [Edit Opportunity] form" do
|
55
|
-
params[:cancel] = nil
|
56
|
-
|
57
|
-
render
|
58
|
-
expect(rendered).to include("crm.highlight_off('opportunity_#{@opportunity.id}');")
|
59
|
-
expect(rendered).to include("crm.hide_form('create_opportunity')")
|
60
|
-
expect(rendered).to include("$('#opportunity_#{@opportunity.id}').html")
|
61
|
-
end
|
62
|
-
|
63
|
-
it "edit from opportunity landing page: should show [Edit Opportunity] form" do
|
64
|
-
params[:cancel] = "false"
|
65
|
-
|
66
|
-
render
|
67
|
-
expect(rendered).to include("$('#edit_opportunity').html")
|
68
|
-
expect(rendered).to include("crm.flip_form('edit_opportunity'")
|
69
|
-
end
|
70
|
-
|
71
|
-
it "edit: should handle new or existing account for the opportunity" do
|
72
|
-
render
|
73
|
-
expect(rendered).to include("crm.create_or_select_account")
|
74
|
-
end
|
75
|
-
end
|
@@ -1,38 +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(File.dirname(__FILE__) + '/../../spec_helper')
|
9
|
-
|
10
|
-
describe "/opportunities/index" do
|
11
|
-
include OpportunitiesHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
view.lookup_context.prefixes << 'entities'
|
16
|
-
assign :stage, Setting.unroll(:opportunity_stage)
|
17
|
-
assign :per_page, Opportunity.per_page
|
18
|
-
assign :sort_by, Opportunity.sort_by
|
19
|
-
assign :ransack_search, Opportunity.ransack
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should render list of accounts if list of opportunities is not empty" do
|
23
|
-
assign(:opportunities, [build_stubbed(:opportunity)].paginate)
|
24
|
-
|
25
|
-
render
|
26
|
-
expect(view).to render_template(partial: "_opportunity")
|
27
|
-
expect(view).to render_template(partial: "shared/_paginate_with_per_page")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should render a message if there're no opportunities" do
|
31
|
-
assign(:opportunities, [].paginate)
|
32
|
-
|
33
|
-
render
|
34
|
-
expect(view).not_to render_template(partial: "_opportunities")
|
35
|
-
expect(view).to render_template(partial: "shared/_empty")
|
36
|
-
expect(view).to render_template(partial: "shared/_paginate_with_per_page")
|
37
|
-
end
|
38
|
-
end
|
@@ -1,35 +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
|
-
describe "/opportunities/index" do
|
11
|
-
include OpportunitiesHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:stage, Setting.unroll(:opportunity_stage))
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should render [opportunity] template with @opportunities collection if there are opportunities" do
|
19
|
-
assign(:opportunities, [build_stubbed(:opportunity, id: 42)].paginate)
|
20
|
-
|
21
|
-
render template: 'opportunities/index', formats: [:js]
|
22
|
-
|
23
|
-
expect(rendered).to include("$('#opportunities').html")
|
24
|
-
expect(rendered).to include("#paginate")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should render [empty] template if @opportunities collection if there are no opportunities" do
|
28
|
-
assign(:opportunities, [].paginate)
|
29
|
-
|
30
|
-
render template: 'opportunities/index', formats: [:js]
|
31
|
-
|
32
|
-
expect(rendered).to include("$('#opportunities').html('<div id=\\'empty\\'>")
|
33
|
-
expect(rendered).to include("#paginate")
|
34
|
-
end
|
35
|
-
end
|
@@ -1,54 +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
|
-
describe "/opportunities/new" do
|
11
|
-
include OpportunitiesHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
@account = build_stubbed(:account)
|
16
|
-
assign(:opportunity, Opportunity.new(user: current_user))
|
17
|
-
assign(:users, [current_user])
|
18
|
-
assign(:account, @account)
|
19
|
-
assign(:accounts, [@account])
|
20
|
-
assign(:stage, Setting.unroll(:opportunity_stage))
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should toggle empty message div if it exists" do
|
24
|
-
render
|
25
|
-
|
26
|
-
expect(rendered).to include("crm.flick('empty', 'toggle')")
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "new opportunity" do
|
30
|
-
it "should render [new] template into :create_opportunity div" do
|
31
|
-
params[:cancel] = nil
|
32
|
-
render
|
33
|
-
|
34
|
-
expect(rendered).to include("#create_opportunity")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should call JavaScript functions to load Calendar popup" do
|
38
|
-
params[:cancel] = nil
|
39
|
-
render
|
40
|
-
|
41
|
-
expect(rendered).to include("crm.flip_form('create_opportunity')")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "cancel new opportunity" do
|
46
|
-
it "should hide [create campaign] form" do
|
47
|
-
params[:cancel] = "true"
|
48
|
-
render
|
49
|
-
|
50
|
-
expect(rendered).not_to include("#create_opportunity")
|
51
|
-
expect(rendered).to include("crm.flip_form('create_opportunity')")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,35 +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(File.dirname(__FILE__) + '/../../spec_helper')
|
9
|
-
|
10
|
-
describe "/opportunities/show" do
|
11
|
-
include OpportunitiesHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
@opportunity = create(:opportunity, id: 42,
|
16
|
-
contacts: [create(:contact)])
|
17
|
-
assign(:opportunity, @opportunity)
|
18
|
-
assign(:users, [current_user])
|
19
|
-
assign(:comment, Comment.new)
|
20
|
-
assign(:timeline, [create(:comment, commentable: @opportunity)])
|
21
|
-
|
22
|
-
# controller#controller_name and controller#action_name are not set in view specs
|
23
|
-
allow(view).to receive(:template_for_current_view).and_return(nil)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should render opportunity landing page" do
|
27
|
-
render
|
28
|
-
expect(view).to render_template(partial: "comments/_new")
|
29
|
-
expect(view).to render_template(partial: "shared/_timeline")
|
30
|
-
expect(view).to render_template(partial: "shared/_tasks")
|
31
|
-
expect(view).to render_template(partial: "contacts/_contact")
|
32
|
-
|
33
|
-
expect(rendered).to have_tag("div[id=edit_opportunity]")
|
34
|
-
end
|
35
|
-
end
|