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,167 +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
|
-
# This is a wrapper of assert_select for rspec.
|
9
|
-
|
10
|
-
module RSpec # :nodoc:
|
11
|
-
module Rails
|
12
|
-
module Matchers
|
13
|
-
class AssertSelect #:nodoc:
|
14
|
-
attr_reader :options
|
15
|
-
|
16
|
-
def initialize(selector_assertion, spec_scope, *args, &block)
|
17
|
-
@args, @options = args_and_options(args)
|
18
|
-
@spec_scope = spec_scope
|
19
|
-
@selector_assertion = selector_assertion
|
20
|
-
@block = block
|
21
|
-
end
|
22
|
-
|
23
|
-
def matches?(_response_or_text, &block)
|
24
|
-
@block = block if block
|
25
|
-
|
26
|
-
begin
|
27
|
-
@spec_scope.__send__(@selector_assertion, *@args, &@block)
|
28
|
-
true
|
29
|
-
rescue ::ActiveSupport::TestCase::Assertion => @error
|
30
|
-
false
|
31
|
-
rescue ::MiniTest::Assertion => @error
|
32
|
-
false
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def failure_message
|
37
|
-
@error.message
|
38
|
-
end
|
39
|
-
|
40
|
-
def failure_message_when_negated
|
41
|
-
"should not #{description}, but did"
|
42
|
-
end
|
43
|
-
|
44
|
-
def description
|
45
|
-
{
|
46
|
-
assert_select: "have tag#{format_args(*@args)}",
|
47
|
-
assert_select_email: "send email#{format_args(*@args)}"
|
48
|
-
}[@selector_assertion]
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def format_args(*args)
|
54
|
-
args.empty? ? "" : "(#{arg_list(*args)})"
|
55
|
-
end
|
56
|
-
|
57
|
-
def arg_list(*args)
|
58
|
-
args.map do |arg|
|
59
|
-
arg.respond_to?(:description) ? arg.description : arg.inspect
|
60
|
-
end.join(", ")
|
61
|
-
end
|
62
|
-
|
63
|
-
def args_and_options(args)
|
64
|
-
opts = { xml: false, strict: false }
|
65
|
-
if args.last.is_a?(::Hash)
|
66
|
-
opts[:strict] = args.last.delete(:strict) unless args.last[:strict].nil?
|
67
|
-
opts[:xml] = args.last.delete(:xml) unless args.last[:xml].nil?
|
68
|
-
args.pop if args.last.empty?
|
69
|
-
end
|
70
|
-
[args, opts]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# :call-seq:
|
75
|
-
# response.should have_tag(*args, &block)
|
76
|
-
# string.should have_tag(*args, &block)
|
77
|
-
#
|
78
|
-
# wrapper for assert_select with additional support for using
|
79
|
-
# css selectors to set expectation on Strings. Use this in
|
80
|
-
# helper specs, for example, to set expectations on the results
|
81
|
-
# of helper methods. Also allow specification of how the
|
82
|
-
# response is parsed using the options :xml and :strict options.
|
83
|
-
# By default, these options are set to false.
|
84
|
-
#
|
85
|
-
# == Examples
|
86
|
-
#
|
87
|
-
# # in a controller spec
|
88
|
-
# response.should have_tag("div", "some text")
|
89
|
-
#
|
90
|
-
# # to force xml and/or strict parsing of the response
|
91
|
-
# response.should have_tag("div", "some text", :xml => true)
|
92
|
-
# response.should have_tag("div", "some text", :strict => true)
|
93
|
-
# response.should have_tag("div", "some text", :xml => true, :strict => false)
|
94
|
-
#
|
95
|
-
# # in a helper spec (person_address_tag is a method in the helper)
|
96
|
-
# person_address_tag.should have_tag("input#person_address")
|
97
|
-
#
|
98
|
-
# see documentation for assert_select at http://api.rubyonrails.org/
|
99
|
-
def have_tag(*args, &block)
|
100
|
-
@__current_scope_for_assert_select = AssertSelect.new(:assert_select, self, *args, &block)
|
101
|
-
end
|
102
|
-
|
103
|
-
# wrapper for a nested assert_select
|
104
|
-
#
|
105
|
-
# response.should have_tag("div#form") do
|
106
|
-
# with_tag("input#person_name[name=?]", "person[name]")
|
107
|
-
# end
|
108
|
-
#
|
109
|
-
# see documentation for assert_select at http://api.rubyonrails.org/
|
110
|
-
def with_tag(*args, &block)
|
111
|
-
args = prepare_args(args, @__current_scope_for_assert_select)
|
112
|
-
expect(@__current_scope_for_assert_select).to have_tag(*args, &block)
|
113
|
-
end
|
114
|
-
|
115
|
-
# wrapper for a nested assert_select with false
|
116
|
-
#
|
117
|
-
# response.should have_tag("div#1") do
|
118
|
-
# without_tag("span", "some text that shouldn't be there")
|
119
|
-
# end
|
120
|
-
#
|
121
|
-
# see documentation for assert_select at http://api.rubyonrails.org/
|
122
|
-
def without_tag(*args, &block)
|
123
|
-
args = prepare_args(args, @__current_scope_for_assert_select)
|
124
|
-
expect(@__current_scope_for_assert_select).not_to have_tag(*args, &block)
|
125
|
-
end
|
126
|
-
|
127
|
-
# :call-seq:
|
128
|
-
# response.should have_rjs(*args, &block)
|
129
|
-
#
|
130
|
-
# wrapper for assert_select_rjs
|
131
|
-
#
|
132
|
-
# see documentation for assert_select_rjs at http://api.rubyonrails.org/
|
133
|
-
def have_rjs(*args, &block)
|
134
|
-
AssertSelect.new(:assert_select_rjs, self, *args, &block)
|
135
|
-
end
|
136
|
-
|
137
|
-
# :call-seq:
|
138
|
-
# response.should send_email(*args, &block)
|
139
|
-
#
|
140
|
-
# wrapper for assert_select_email
|
141
|
-
#
|
142
|
-
# see documentation for assert_select_email at http://api.rubyonrails.org/
|
143
|
-
def send_email(*args, &block)
|
144
|
-
AssertSelect.new(:assert_select_email, self, *args, &block)
|
145
|
-
end
|
146
|
-
|
147
|
-
# wrapper for assert_select_encoded
|
148
|
-
#
|
149
|
-
# see documentation for assert_select_encoded at http://api.rubyonrails.org/
|
150
|
-
def with_encoded(*args, &block)
|
151
|
-
is_expected.to AssertSelect.new(:assert_select_encoded, self, *args, &block)
|
152
|
-
end
|
153
|
-
|
154
|
-
private
|
155
|
-
|
156
|
-
def prepare_args(args, current_scope = nil)
|
157
|
-
return args if current_scope.nil?
|
158
|
-
|
159
|
-
defaults = current_scope.options || { strict: false, xml: false }
|
160
|
-
args << {} unless args.last.is_a?(::Hash)
|
161
|
-
args.last[:strict] = defaults[:strict] if args.last[:strict].nil?
|
162
|
-
args.last[:xml] = defaults[:xml] if args.last[:xml].nil?
|
163
|
-
args
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
@@ -1,28 +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
|
-
module DeviseHelpers
|
9
|
-
def login
|
10
|
-
user = create :user
|
11
|
-
perform_login(user)
|
12
|
-
end
|
13
|
-
|
14
|
-
def login_admin
|
15
|
-
admin = FactoryBot.create(:user, admin: true)
|
16
|
-
perform_login(admin)
|
17
|
-
end
|
18
|
-
|
19
|
-
def perform_login(user)
|
20
|
-
user.confirm
|
21
|
-
user.update_attribute(:suspended_at, nil)
|
22
|
-
sign_in user
|
23
|
-
end
|
24
|
-
|
25
|
-
def current_user
|
26
|
-
User.find_by_id(session['warden.user.user.key'][0][0])
|
27
|
-
end
|
28
|
-
end
|
@@ -1,32 +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
|
-
|
9
|
-
module FeatureHelpers
|
10
|
-
# Put helper methods you need to be available in all acceptance specs here.
|
11
|
-
|
12
|
-
def do_login(options = {})
|
13
|
-
@user = create(:user, options)
|
14
|
-
@user.confirm
|
15
|
-
@user.update_attribute(:suspended_at, nil)
|
16
|
-
login_as(@user)
|
17
|
-
end
|
18
|
-
|
19
|
-
def login_as_user(user)
|
20
|
-
user.confirm
|
21
|
-
user.update_attribute(:suspended_at, nil)
|
22
|
-
visit '/users/sign_in'
|
23
|
-
fill_in "user[email]", with: user.username
|
24
|
-
fill_in "user[password]", with: user.password
|
25
|
-
click_button "Login"
|
26
|
-
end
|
27
|
-
|
28
|
-
# if we're already logged in, don't bother doing it again
|
29
|
-
def do_login_if_not_already(options = {})
|
30
|
-
do_login(options) unless @user.present?
|
31
|
-
end
|
32
|
-
end
|
data/spec/support/macros.rb
DELETED
@@ -1,49 +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
|
-
#----------------------------------------------------------------------------
|
9
|
-
def set_current_tab(tab)
|
10
|
-
controller.session[:current_tab] = tab
|
11
|
-
end
|
12
|
-
|
13
|
-
#----------------------------------------------------------------------------
|
14
|
-
def stub_task(view)
|
15
|
-
assigns[:task] = if view == "completed"
|
16
|
-
create(:task, completed_at: Time.now - 1.minute)
|
17
|
-
elsif view == "assigned"
|
18
|
-
create(:task, assignee: create(:user))
|
19
|
-
else
|
20
|
-
create(:task)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
#----------------------------------------------------------------------------
|
25
|
-
def stub_task_total(view = "pending")
|
26
|
-
settings = (view == "completed" ? Setting.task_completed : Setting.task_bucket)
|
27
|
-
settings.each_with_object(all: 0) do |key, hash|
|
28
|
-
hash[key] = 1
|
29
|
-
hash
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Get current server timezone and set it (see rake time:zones:local for details).
|
34
|
-
#----------------------------------------------------------------------------
|
35
|
-
def set_timezone
|
36
|
-
offset = [Time.now.beginning_of_year.utc_offset, Time.now.beginning_of_year.change(month: 7).utc_offset].min
|
37
|
-
offset *= 3600 if offset.abs < 13
|
38
|
-
Time.zone = ActiveSupport::TimeZone.all.select { |zone| zone.utc_offset == offset }.first
|
39
|
-
end
|
40
|
-
|
41
|
-
# Adjusts current timezone by given offset (in seconds).
|
42
|
-
#----------------------------------------------------------------------------
|
43
|
-
def adjust_timezone(offset)
|
44
|
-
if offset
|
45
|
-
ActiveSupport::TimeZone[offset]
|
46
|
-
adjusted_time = Time.now + offset.seconds
|
47
|
-
allow(Time).to receive(:now).and_return(adjusted_time)
|
48
|
-
end
|
49
|
-
end
|
@@ -1,37 +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
|
-
module MockIMAP
|
9
|
-
def mock_imap
|
10
|
-
@imap = double
|
11
|
-
@settings = @crawler.instance_variable_get("@settings")
|
12
|
-
@settings[:address] = @mock_address
|
13
|
-
allow(Net::IMAP).to receive(:new).with(@settings[:server], @settings[:port], @settings[:ssl]).and_return(@imap)
|
14
|
-
end
|
15
|
-
|
16
|
-
def mock_connect
|
17
|
-
mock_imap
|
18
|
-
allow(@imap).to receive(:login).and_return(true)
|
19
|
-
allow(@imap).to receive(:select).and_return(true)
|
20
|
-
end
|
21
|
-
|
22
|
-
def mock_disconnect
|
23
|
-
allow(@imap).to receive(:disconnected?).and_return(false)
|
24
|
-
allow(@imap).to receive(:logout).and_return(true)
|
25
|
-
allow(@imap).to receive(:disconnect).and_return(true)
|
26
|
-
end
|
27
|
-
|
28
|
-
def mock_message(body)
|
29
|
-
@fetch_data = double
|
30
|
-
allow(@fetch_data).to receive(:attr).and_return("RFC822" => body)
|
31
|
-
allow(@imap).to receive(:uid_search).and_return([:uid])
|
32
|
-
allow(@imap).to receive(:uid_fetch).and_return([@fetch_data])
|
33
|
-
allow(@imap).to receive(:uid_copy).and_return(true)
|
34
|
-
allow(@imap).to receive(:uid_store).and_return(true)
|
35
|
-
body
|
36
|
-
end
|
37
|
-
end
|
@@ -1,10 +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
|
-
Rack::Test::UploadedFile.class_eval do
|
9
|
-
attr_accessor :tempfile
|
10
|
-
end
|
@@ -1,43 +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 "/accounts/_edit" do
|
11
|
-
include AccountsHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:account, @account = create(:account))
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should render [edit account] form" do
|
19
|
-
render
|
20
|
-
|
21
|
-
expect(view).to render_template(partial: "_top_section")
|
22
|
-
expect(view).to render_template(partial: "_contact_info")
|
23
|
-
expect(view).to render_template(partial: "_permissions")
|
24
|
-
|
25
|
-
expect(rendered).to have_tag('form[class="simple_form edit_account"]') do |form|
|
26
|
-
expect(form).to have_tag "input[type=hidden][id=account_user_id][value='#{@account.user_id}']"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should render background info field if settings require so" do
|
31
|
-
Setting.background_info = [:account]
|
32
|
-
|
33
|
-
render
|
34
|
-
expect(rendered).to have_tag("textarea[id=account_background_info]")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should not render background info field if settings do not require so" do
|
38
|
-
Setting.background_info = []
|
39
|
-
|
40
|
-
render
|
41
|
-
expect(rendered).not_to have_tag("textarea[id=account_background_info]")
|
42
|
-
end
|
43
|
-
end
|
@@ -1,42 +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 "/accounts/_new" do
|
11
|
-
include AccountsHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:account, Account.new)
|
16
|
-
assign(:users, [current_user])
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should render [create account] form" do
|
20
|
-
render
|
21
|
-
|
22
|
-
expect(view).to render_template(partial: "_top_section")
|
23
|
-
expect(view).to render_template(partial: "_contact_info")
|
24
|
-
expect(view).to render_template(partial: "_permissions")
|
25
|
-
|
26
|
-
expect(rendered).to have_tag('form[class="simple_form new_account"]')
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should render background info field if settings require so" do
|
30
|
-
Setting.background_info = [:account]
|
31
|
-
|
32
|
-
render
|
33
|
-
expect(rendered).to have_tag("textarea[id=account_background_info]")
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should not render background info field if settings do not require so" do
|
37
|
-
Setting.background_info = []
|
38
|
-
|
39
|
-
render
|
40
|
-
expect(rendered).not_to have_tag("textarea[id=account_background_info]")
|
41
|
-
end
|
42
|
-
end
|
@@ -1,52 +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 "/accounts/create" do
|
11
|
-
include AccountsHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
end
|
16
|
-
|
17
|
-
# Note: [Create Account] is only called from Accounts index. Unlike other
|
18
|
-
# core object Account partial is not embedded.
|
19
|
-
describe "create success" do
|
20
|
-
before do
|
21
|
-
assign(:account, @account = build_stubbed(:account))
|
22
|
-
assign(:accounts, [@account].paginate)
|
23
|
-
assign(:account_category_total, Hash.new(1))
|
24
|
-
render
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should hide [Create Account] form and insert account partial" do
|
28
|
-
expect(rendered).to include("$('#accounts').prepend('<li class=\\'highlight account\\' id=\\'account_#{@account.id}\\'")
|
29
|
-
expect(rendered).to include(%/$('#account_#{@account.id}').effect("highlight"/)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should update pagination" do
|
33
|
-
expect(rendered).to include("#paginate")
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should refresh accounts sidebar" do
|
37
|
-
expect(rendered).to include("#sidebar")
|
38
|
-
expect(rendered).to have_text("Account Categories")
|
39
|
-
expect(rendered).to have_text("Recent Items")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "create failure" do
|
44
|
-
it "should re-render [create] template in :create_account div" do
|
45
|
-
assign(:account, build(:account, name: nil)) # make it invalid
|
46
|
-
assign(:users, [current_user])
|
47
|
-
render
|
48
|
-
|
49
|
-
expect(rendered).to include("#create_account")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/accounts/destroy" do
|
11
|
-
include AccountsHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:account, @account = build_stubbed(:account))
|
16
|
-
assign(:accounts, [@account].paginate)
|
17
|
-
assign(:account_category_total, Hash.new(1))
|
18
|
-
render
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should blind up destroyed account partial" do
|
22
|
-
expect(rendered).to include("slideUp")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should update accounts pagination" do
|
26
|
-
expect(rendered).to include("#paginate")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should update accounts sidebar" do
|
30
|
-
expect(rendered).to include("#sidebar")
|
31
|
-
expect(rendered).to have_text("Account Categories")
|
32
|
-
expect(rendered).to have_text("Recent Items")
|
33
|
-
end
|
34
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/accounts/edit" do
|
11
|
-
include AccountsHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
assign(:account, @account = build_stubbed(:account, user: current_user))
|
16
|
-
assign(:users, [current_user])
|
17
|
-
end
|
18
|
-
|
19
|
-
it "cancel from accounts index page: should replace [Edit Account] form with account partial" do
|
20
|
-
params[:cancel] = "true"
|
21
|
-
|
22
|
-
render
|
23
|
-
expect(rendered).to include("account_#{@account.id}")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "cancel from account landing page: should hide [Edit Account] form" do
|
27
|
-
controller.request.env["HTTP_REFERER"] = "http://localhost/accounts/123"
|
28
|
-
params[:cancel] = "true"
|
29
|
-
|
30
|
-
render
|
31
|
-
expect(rendered).to include("crm.flip_form('edit_account'")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "edit: should hide previously open [Edit Account] for and replace it with account partial" do
|
35
|
-
params[:cancel] = nil
|
36
|
-
assign(:previous, previous = build_stubbed(:account, user: current_user))
|
37
|
-
|
38
|
-
render
|
39
|
-
expect(rendered).to include("account_#{previous.id}")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "edit: should remove previously open [Edit Account] if it's no longer available" do
|
43
|
-
params[:cancel] = nil
|
44
|
-
assign(:previous, previous = 41)
|
45
|
-
|
46
|
-
render
|
47
|
-
expect(rendered).to include("crm.flick('account_#{previous}', 'remove');")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "edit from accounts index page: should turn off highlight, hide [Create Account] form, and replace current account with [edit account] form" do
|
51
|
-
params[:cancel] = nil
|
52
|
-
|
53
|
-
render
|
54
|
-
expect(rendered).to include("crm.highlight_off('account_#{@account.id}');")
|
55
|
-
expect(rendered).to include("crm.hide_form('create_account')")
|
56
|
-
expect(rendered).to include("account_#{@account.id}")
|
57
|
-
end
|
58
|
-
|
59
|
-
it "edit from account landing page: should show [edit account] form" do
|
60
|
-
params[:cancel] = "false"
|
61
|
-
|
62
|
-
render
|
63
|
-
expect(rendered).to include("edit_account")
|
64
|
-
expect(rendered).to include("crm.flip_form('edit_account'")
|
65
|
-
end
|
66
|
-
end
|
@@ -1,43 +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 "/accounts/index" do
|
11
|
-
include AccountsHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
view.lookup_context.prefixes << 'entities'
|
15
|
-
assign :per_page, Account.per_page
|
16
|
-
assign :sort_by, Account.sort_by
|
17
|
-
assign :ransack_search, Account.ransack
|
18
|
-
login
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should render account name" do
|
22
|
-
assign(:accounts, [build_stubbed(:account, name: 'New Media Inc'), build_stubbed(:account)].paginate)
|
23
|
-
render
|
24
|
-
expect(rendered).to have_tag('a', text: "New Media Inc")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should render list of accounts if list of accounts is not empty" do
|
28
|
-
assign(:accounts, [build_stubbed(:account), build_stubbed(:account)].paginate)
|
29
|
-
|
30
|
-
render
|
31
|
-
expect(view).to render_template(partial: "_account")
|
32
|
-
expect(view).to render_template(partial: "shared/_paginate_with_per_page")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should render a message if there're no accounts" do
|
36
|
-
assign(:accounts, [].paginate)
|
37
|
-
|
38
|
-
render
|
39
|
-
expect(view).not_to render_template(partial: "_account")
|
40
|
-
expect(view).to render_template(partial: "shared/_empty")
|
41
|
-
expect(view).to render_template(partial: "shared/_paginate_with_per_page")
|
42
|
-
end
|
43
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe "/accounts/index" do
|
11
|
-
include AccountsHelper
|
12
|
-
|
13
|
-
before do
|
14
|
-
login
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should render [account] template with @accounts collection if there are accounts" do
|
18
|
-
assign(:accounts, [build_stubbed(:account, id: 42)].paginate)
|
19
|
-
|
20
|
-
render template: 'accounts/index', formats: [:js]
|
21
|
-
|
22
|
-
expect(rendered).to include("$('#accounts').html")
|
23
|
-
expect(rendered).to include("$('#paginate').html")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should render [empty] template if @accounts collection if there are no accounts" do
|
27
|
-
assign(:accounts, [].paginate)
|
28
|
-
|
29
|
-
render template: 'accounts/index', formats: [:js]
|
30
|
-
|
31
|
-
expect(rendered).to include("$('#accounts').html('<div id=\\'empty\\'")
|
32
|
-
expect(rendered).to include("$('#paginate').html")
|
33
|
-
end
|
34
|
-
end
|