fat_free_crm 0.20.0 → 0.21.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/manifest.js +3 -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/polymorphic/avatar.rb +1 -30
- data/app/models/polymorphic/task.rb +2 -0
- data/app/views/home/index.xls.builder +1 -0
- data/app/views/shared/_address.html.haml +1 -1
- data/config/application.rb +13 -0
- data/config/environments/development.rb +3 -0
- data/config/puma.rb +2 -2
- data/config/storage.yml +34 -0
- 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 +91 -0
- data/db/schema.rb +65 -35
- data/db/seeds/fields.rb +7 -21
- data/lib/development_tasks/license.rake +10 -10
- 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/version.rb +2 -2
- metadata +16 -279
- 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/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/fixtures/rails.png +0 -0
- 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
@@ -1,238 +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
|
-
# == Schema Information
|
9
|
-
#
|
10
|
-
# Table name: users
|
11
|
-
#
|
12
|
-
# id :integer not null, primary key
|
13
|
-
# username :string(32) default(""), not null
|
14
|
-
# email :string(254) default(""), not null
|
15
|
-
# first_name :string(32)
|
16
|
-
# last_name :string(32)
|
17
|
-
# title :string(64)
|
18
|
-
# company :string(64)
|
19
|
-
# alt_email :string(64)
|
20
|
-
# phone :string(32)
|
21
|
-
# mobile :string(32)
|
22
|
-
# aim :string(32)
|
23
|
-
# yahoo :string(32)
|
24
|
-
# google :string(32)
|
25
|
-
# skype :string(32)
|
26
|
-
# encrypted_password :string(255) default(""), not null
|
27
|
-
# password_salt :string(255) default(""), not null
|
28
|
-
# last_sign_in_at :datetime
|
29
|
-
# current_sign_in_at :datetime
|
30
|
-
# last_sign_in_ip :string(255)
|
31
|
-
# current_sign_in_ip :string(255)
|
32
|
-
# sign_in_count :integer default(0), not null
|
33
|
-
# deleted_at :datetime
|
34
|
-
# created_at :datetime
|
35
|
-
# updated_at :datetime
|
36
|
-
# admin :boolean default(FALSE), not null
|
37
|
-
# suspended_at :datetime
|
38
|
-
# unconfirmed_email :string(254) default(""), not null
|
39
|
-
# reset_password_token :string(255)
|
40
|
-
# reset_password_sent_at :datetime
|
41
|
-
# remember_token :string(255)
|
42
|
-
# remember_created_at :datetime
|
43
|
-
# authentication_token :string(255)
|
44
|
-
# confirmation_token :string(255)
|
45
|
-
# confirmed_at :datetime
|
46
|
-
# confirmation_sent_at :datetime
|
47
|
-
#
|
48
|
-
|
49
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
50
|
-
|
51
|
-
describe User do
|
52
|
-
it "should create a new instance given valid attributes" do
|
53
|
-
expect(User.new(
|
54
|
-
username: "username",
|
55
|
-
email: "user@example.com",
|
56
|
-
password: "password",
|
57
|
-
password_confirmation: "password"
|
58
|
-
).valid?).to eq true
|
59
|
-
end
|
60
|
-
|
61
|
-
it "should have a valid factory" do
|
62
|
-
expect(build(:user)).to be_valid
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '#destroyable?' do
|
66
|
-
describe "Destroying users with and without related assets" do
|
67
|
-
before do
|
68
|
-
@user = build(:user)
|
69
|
-
@current_user = build(:user)
|
70
|
-
end
|
71
|
-
|
72
|
-
%w[account campaign lead contact opportunity].each do |asset|
|
73
|
-
it "should not destroy the user if she owns #{asset}" do
|
74
|
-
create(asset, user: @user)
|
75
|
-
expect(@user.destroyable?(@current_user)).to eq(false)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should not destroy the user if she has #{asset} assigned" do
|
79
|
-
create(asset, assignee: @user)
|
80
|
-
expect(@user.destroyable?(@current_user)).to eq(false)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should not destroy the user if she owns a comment" do
|
85
|
-
account = build(:account, user: @current_user)
|
86
|
-
FactoryBot.create(:comment, user: @user, commentable: account)
|
87
|
-
expect(@user.destroyable?(@current_user)).to eq(false)
|
88
|
-
end
|
89
|
-
|
90
|
-
it "should not destroy the current user" do
|
91
|
-
expect(@user.destroyable?(@user)).to eq(false)
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should destroy the user" do
|
95
|
-
expect(@user.destroyable?(@current_user)).to eq(true)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe '#destroy' do
|
101
|
-
before do
|
102
|
-
@user = create(:user)
|
103
|
-
end
|
104
|
-
it "once the user gets deleted all her permissions must be deleted too" do
|
105
|
-
create(:permission, user: @user, asset: create(:account))
|
106
|
-
create(:permission, user: @user, asset: create(:contact))
|
107
|
-
expect(@user.permissions.count).to eq(2)
|
108
|
-
@user.destroy
|
109
|
-
expect(@user.permissions.count).to eq(0)
|
110
|
-
end
|
111
|
-
|
112
|
-
it "once the user gets deleted all her preferences must be deleted too" do
|
113
|
-
create(:preference, user: @user, name: "Hello", value: "World")
|
114
|
-
create(:preference, user: @user, name: "World", value: "Hello")
|
115
|
-
expect(@user.preferences.count).to eq(2)
|
116
|
-
@user.destroy
|
117
|
-
expect(@user.preferences.count).to eq(0)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe '#suspend_if_needs_approval' do
|
122
|
-
it "should set suspended timestamp upon creation if signups need approval and the user is not an admin" do
|
123
|
-
allow(Setting).to receive(:user_signup).and_return(:needs_approval)
|
124
|
-
@user = build(:user, suspended_at: nil)
|
125
|
-
|
126
|
-
@user.suspend_if_needs_approval
|
127
|
-
|
128
|
-
expect(@user).to be_suspended
|
129
|
-
end
|
130
|
-
|
131
|
-
it "should not set suspended timestamp upon creation if signups need approval and the user is an admin" do
|
132
|
-
allow(Setting).to receive(:user_signup).and_return(:needs_approval)
|
133
|
-
@user = build(:user, admin: true, suspended_at: nil)
|
134
|
-
|
135
|
-
@user.suspend_if_needs_approval
|
136
|
-
|
137
|
-
expect(@user).not_to be_suspended
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
context "scopes" do
|
142
|
-
describe "have_assigned_opportunities" do
|
143
|
-
before do
|
144
|
-
@user1 = create(:user)
|
145
|
-
create(:opportunity, assignee: @user1, stage: 'analysis', account: nil, campaign: nil, user: nil)
|
146
|
-
|
147
|
-
@user2 = create(:user)
|
148
|
-
|
149
|
-
@user3 = create(:user)
|
150
|
-
create(:opportunity, assignee: @user3, stage: 'won', account: nil, campaign: nil, user: nil)
|
151
|
-
|
152
|
-
@user4 = create(:user)
|
153
|
-
create(:opportunity, assignee: @user4, stage: 'lost', account: nil, campaign: nil, user: nil)
|
154
|
-
|
155
|
-
@result = User.have_assigned_opportunities
|
156
|
-
end
|
157
|
-
|
158
|
-
it "includes users with assigned opportunities" do
|
159
|
-
expect(@result).to include(@user1)
|
160
|
-
end
|
161
|
-
|
162
|
-
it "excludes users without any assigned opportunities" do
|
163
|
-
expect(@result).not_to include(@user2)
|
164
|
-
end
|
165
|
-
|
166
|
-
it "excludes users with opportunities that have been won or lost" do
|
167
|
-
expect(@result).not_to include(@user3)
|
168
|
-
expect(@result).not_to include(@user4)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
context "instance methods" do
|
174
|
-
describe "assigned_opportunities" do
|
175
|
-
before do
|
176
|
-
@user = create(:user)
|
177
|
-
|
178
|
-
@opportunity1 = create(:opportunity, assignee: @user, account: nil, campaign: nil, user: nil)
|
179
|
-
@opportunity2 = create(:opportunity, assignee: create(:user), account: nil, campaign: nil, user: nil)
|
180
|
-
|
181
|
-
@result = @user.assigned_opportunities
|
182
|
-
end
|
183
|
-
|
184
|
-
it "includes opportunities assigned to user" do
|
185
|
-
expect(@result).to include(@opportunity1)
|
186
|
-
end
|
187
|
-
|
188
|
-
it "does not include opportunities assigned to another user" do
|
189
|
-
expect(@result).not_to include(@opportunity2)
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe "Setting I18n.locale" do
|
195
|
-
before do
|
196
|
-
@user = build(:user)
|
197
|
-
@locale = I18n.locale
|
198
|
-
end
|
199
|
-
|
200
|
-
after do
|
201
|
-
I18n.locale = @locale
|
202
|
-
end
|
203
|
-
|
204
|
-
it "should update I18n.locale if proference[:locale] is set" do
|
205
|
-
@user.preference[:locale] = :es
|
206
|
-
@user.set_individual_locale
|
207
|
-
expect(I18n.locale).to eq(:es)
|
208
|
-
end
|
209
|
-
|
210
|
-
it "should not update I18n.locale if proference[:locale] is not set" do
|
211
|
-
@user.preference[:locale] = nil
|
212
|
-
@user.set_individual_locale
|
213
|
-
expect(I18n.locale).to eq(@locale)
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
describe "serialization" do
|
218
|
-
let(:user) { build(:user) }
|
219
|
-
|
220
|
-
it "to json" do
|
221
|
-
expect(user.to_json).to eql([user.name].to_json)
|
222
|
-
end
|
223
|
-
|
224
|
-
it "to xml" do
|
225
|
-
expect(user.to_xml).to eql([user.name].to_xml)
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
describe "text_search" do
|
230
|
-
it "should find user by email" do
|
231
|
-
create(:user, email: 'no-reply@example.com')
|
232
|
-
user = create(:user, email: 'test@example.com')
|
233
|
-
search = User.text_search('test')
|
234
|
-
expect(search.size).to eql(1)
|
235
|
-
expect(search.first).to eql(user)
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
@@ -1,60 +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 AccountsController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/accounts").to route_to(controller: "accounts", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #new" do
|
17
|
-
expect(get: "/accounts/new").to route_to(controller: "accounts", action: "new")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #show" do
|
21
|
-
expect(get: "/accounts/1").to route_to(controller: "accounts", action: "show", id: "1")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "doesn't recognize #show with non-numeric id" do
|
25
|
-
expect(get: "/accounts/aaron").not_to be_routable
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #edit" do
|
29
|
-
expect(get: "/accounts/1/edit").to route_to(controller: "accounts", action: "edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "doesn't recognize #edit with non-numeric id" do
|
33
|
-
expect(get: "/accounts/aaron/edit").not_to be_routable
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #create" do
|
37
|
-
expect(post: "/accounts").to route_to(controller: "accounts", action: "create")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "recognizes and generates #update" do
|
41
|
-
expect(put: "/accounts/1").to route_to(controller: "accounts", action: "update", id: "1")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "doesn't recognize #update with non-numeric id" do
|
45
|
-
expect(put: "/accounts/aaron").not_to be_routable
|
46
|
-
end
|
47
|
-
|
48
|
-
it "recognizes and generates #destroy" do
|
49
|
-
expect(delete: "/accounts/1").to route_to(controller: "accounts", action: "destroy", id: "1")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "doesn't recognize #destroy with non-numeric id" do
|
53
|
-
expect(delete: "/accounts/aaron").not_to be_routable
|
54
|
-
end
|
55
|
-
|
56
|
-
it "recognizes and generates #auto_complete" do
|
57
|
-
expect(get: "/accounts/auto_complete").to route_to(controller: "accounts", action: "auto_complete")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
9
|
-
|
10
|
-
describe Admin::UsersController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/admin").to route_to(controller: "admin/users", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #new" do
|
17
|
-
expect(get: "/admin/users/new").to route_to(controller: "admin/users", action: "new")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #create" do
|
21
|
-
expect(post: "/admin/users").to route_to(controller: "admin/users", action: "create")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "recognizes and generates #show" do
|
25
|
-
expect(get: "/admin/users/1").to route_to(controller: "admin/users", action: "show", id: "1")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #edit" do
|
29
|
-
expect(get: "/admin/users/1/edit").to route_to(controller: "admin/users", action: "edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "recognizes and generates #update" do
|
33
|
-
expect(put: "/admin/users/1").to route_to(controller: "admin/users", action: "update", id: "1")
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #destroy" do
|
37
|
-
expect(delete: "/admin/users/1").to route_to(controller: "admin/users", action: "destroy", id: "1")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
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 File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
9
|
-
|
10
|
-
describe CampaignsController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/campaigns").to route_to(controller: "campaigns", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #new" do
|
17
|
-
expect(get: "/campaigns/new").to route_to(controller: "campaigns", action: "new")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #show" do
|
21
|
-
expect(get: "/campaigns/1").to route_to(controller: "campaigns", action: "show", id: "1")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "doesn't recognize #show with non-numeric id" do
|
25
|
-
expect(get: "/campaigns/aaron").not_to be_routable
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #edit" do
|
29
|
-
expect(get: "/campaigns/1/edit").to route_to(controller: "campaigns", action: "edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "doesn't recognize #edit with non-numeric id" do
|
33
|
-
expect(get: "/campaigns/aaron/edit").not_to be_routable
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #create" do
|
37
|
-
expect(post: "/campaigns").to route_to(controller: "campaigns", action: "create")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "recognizes and generates #update" do
|
41
|
-
expect(put: "/campaigns/1").to route_to(controller: "campaigns", action: "update", id: "1")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "doesn't recognize #update with non-numeric id" do
|
45
|
-
expect(put: "/campaigns/aaron").not_to be_routable
|
46
|
-
end
|
47
|
-
|
48
|
-
it "recognizes and generates #destroy" do
|
49
|
-
expect(delete: "/campaigns/1").to route_to(controller: "campaigns", action: "destroy", id: "1")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "doesn't recognize #destroy with non-numeric id" do
|
53
|
-
expect(delete: "/campaigns/aaron").not_to be_routable
|
54
|
-
end
|
55
|
-
|
56
|
-
it "recognizes and generates #auto_complete" do
|
57
|
-
expect(get: "/campaigns/auto_complete").to route_to(controller: "campaigns", action: "auto_complete")
|
58
|
-
end
|
59
|
-
|
60
|
-
it "recognizes and generates #filter" do
|
61
|
-
expect(post: "/campaigns/filter").to route_to(controller: "campaigns", action: "filter")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
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
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
9
|
-
|
10
|
-
describe CommentsController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/comments").to route_to(controller: "comments", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #edit" do
|
17
|
-
expect(get: "/comments/1/edit").to route_to(controller: "comments", action: "edit", id: "1")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #create" do
|
21
|
-
expect(post: "/comments").to route_to(controller: "comments", action: "create")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "recognizes and generates #update" do
|
25
|
-
expect(put: "/comments/1").to route_to(controller: "comments", action: "update", id: "1")
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #destroy" do
|
29
|
-
expect(delete: "/comments/1").to route_to(controller: "comments", action: "destroy", id: "1")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,60 +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 ContactsController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/contacts").to route_to(controller: "contacts", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #new" do
|
17
|
-
expect(get: "/contacts/new").to route_to(controller: "contacts", action: "new")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #show" do
|
21
|
-
expect(get: "/contacts/1").to route_to(controller: "contacts", action: "show", id: "1")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "doesn't recognize #show with non-numeric id" do
|
25
|
-
expect(get: "/contacts/aaron").not_to be_routable
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #edit" do
|
29
|
-
expect(get: "/contacts/1/edit").to route_to(controller: "contacts", action: "edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "doesn't recognize #edit with non-numeric id" do
|
33
|
-
expect(get: "/campaigns/aaron/edit").not_to be_routable
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #create" do
|
37
|
-
expect(post: "/contacts").to route_to(controller: "contacts", action: "create")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "recognizes and generates #update" do
|
41
|
-
expect(put: "/contacts/1").to route_to(controller: "contacts", action: "update", id: "1")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "doesn't recognize #update with non-numeric id" do
|
45
|
-
expect(put: "/campaigns/aaron").not_to be_routable
|
46
|
-
end
|
47
|
-
|
48
|
-
it "recognizes and generates #destroy" do
|
49
|
-
expect(delete: "/contacts/1").to route_to(controller: "contacts", action: "destroy", id: "1")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "doesn't recognize #delete with non-numeric id" do
|
53
|
-
expect(delete: "/campaigns/aaron").not_to be_routable
|
54
|
-
end
|
55
|
-
|
56
|
-
it "recognizes and generates #auto_complete" do
|
57
|
-
expect(get: "/contacts/auto_complete").to route_to(controller: "contacts", action: "auto_complete")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
|
4
|
-
#
|
5
|
-
# Fat Free CRM is freely distributable under the terms of MIT license.
|
6
|
-
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
7
|
-
#------------------------------------------------------------------------------
|
8
|
-
require 'spec_helper'
|
9
|
-
|
10
|
-
describe EmailsController do
|
11
|
-
describe "routing" do
|
12
|
-
it "should not recognize #index" do
|
13
|
-
expect(get: "/emails").not_to be_routable
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should not recognize #new" do
|
17
|
-
expect(get: "/emails/new").not_to be_routable
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should not recognize #show" do
|
21
|
-
expect(get: "/emails/1").not_to be_routable
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should not recognize #edit" do
|
25
|
-
expect(get: "/emails/1/edit").not_to be_routable
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should not recognize #create" do
|
29
|
-
expect(post: "/emails").not_to be_routable
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should not recognize #update" do
|
33
|
-
expect(put: "/emails/1").not_to be_routable
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #destroy" do
|
37
|
-
expect(delete: "/emails/1").to route_to(controller: "emails", action: "destroy", id: "1")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,88 +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 LeadsController do
|
11
|
-
describe "routing" do
|
12
|
-
it "recognizes and generates #index" do
|
13
|
-
expect(get: "/leads").to route_to(controller: "leads", action: "index")
|
14
|
-
end
|
15
|
-
|
16
|
-
it "recognizes and generates #new" do
|
17
|
-
expect(get: "/leads/new").to route_to(controller: "leads", action: "new")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "recognizes and generates #show" do
|
21
|
-
expect(get: "/leads/1").to route_to(controller: "leads", action: "show", id: "1")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "doesn't recognize #show with non-numeric id" do
|
25
|
-
expect(get: "/leads/aaron").not_to be_routable
|
26
|
-
end
|
27
|
-
|
28
|
-
it "recognizes and generates #edit" do
|
29
|
-
expect(get: "/leads/1/edit").to route_to(controller: "leads", action: "edit", id: "1")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "doesn't recognize #edit with non-numeric id" do
|
33
|
-
expect(get: "/leads/aaron/edit").not_to be_routable
|
34
|
-
end
|
35
|
-
|
36
|
-
it "recognizes and generates #create" do
|
37
|
-
expect(post: "/leads").to route_to(controller: "leads", action: "create")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "recognizes and generates #update" do
|
41
|
-
expect(put: "/leads/1").to route_to(controller: "leads", action: "update", id: "1")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "doesn't recognize #update with non-numeric id" do
|
45
|
-
expect(put: "/leads/aaron").not_to be_routable
|
46
|
-
end
|
47
|
-
|
48
|
-
it "recognizes and generates #destroy" do
|
49
|
-
expect(delete: "/leads/1").to route_to(controller: "leads", action: "destroy", id: "1")
|
50
|
-
end
|
51
|
-
|
52
|
-
it "doesn't recognize #destroy with non-numeric id" do
|
53
|
-
expect(delete: "/leads/aaron").not_to be_routable
|
54
|
-
end
|
55
|
-
|
56
|
-
it "recognizes and generates #auto_complete" do
|
57
|
-
expect(get: "/leads/auto_complete").to route_to(controller: "leads", action: "auto_complete")
|
58
|
-
end
|
59
|
-
|
60
|
-
it "recognizes and generates #filter" do
|
61
|
-
expect(post: "/leads/filter").to route_to(controller: "leads", action: "filter")
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should generate params for #convert" do
|
65
|
-
expect(get: "/leads/1/convert").to route_to(controller: "leads", action: "convert", id: "1")
|
66
|
-
end
|
67
|
-
|
68
|
-
it "doesn't recognize #convert with non-numeric id" do
|
69
|
-
expect(get: "/leads/aaron/convert").not_to be_routable
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should generate params for #promote" do
|
73
|
-
expect(put: "/leads/1/promote").to route_to(controller: "leads", action: "promote", id: "1")
|
74
|
-
end
|
75
|
-
|
76
|
-
it "doesn't recognize #promote with non-numeric id" do
|
77
|
-
expect(put: "/leads/aaron/promote").not_to be_routable
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should generate params for #reject" do
|
81
|
-
expect(put: "/leads/1/reject").to route_to(controller: "leads", action: "reject", id: "1")
|
82
|
-
end
|
83
|
-
|
84
|
-
it "doesn't recognize #reject with non-numeric id" do
|
85
|
-
expect(put: "/leads/aaron/reject").not_to be_routable
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|