fat_free_crm 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Capfile +1 -4
- data/Gemfile.lock +0 -1
- data/README.md +1 -0
- data/app/assets/javascripts/lists.js.coffee +1 -2
- data/app/controllers/application_controller.rb +27 -25
- data/app/controllers/emails_controller.rb +1 -30
- data/app/controllers/entities/contacts_controller.rb +1 -1
- data/app/controllers/entities/opportunities_controller.rb +1 -1
- data/app/controllers/entities_controller.rb +0 -1
- data/app/controllers/home_controller.rb +0 -4
- data/app/controllers/passwords_controller.rb +3 -3
- data/app/controllers/tasks_controller.rb +17 -10
- data/app/controllers/users_controller.rb +23 -46
- data/app/helpers/application_helper.rb +0 -3
- data/app/helpers/campaigns_helper.rb +0 -1
- data/app/helpers/leads_helper.rb +0 -11
- data/app/helpers/opportunities_helper.rb +0 -1
- data/app/helpers/tags_helper.rb +0 -8
- data/app/helpers/versions_helper.rb +1 -1
- data/app/models/entities/account_contact.rb +1 -1
- data/app/models/entities/campaign.rb +3 -3
- data/app/models/entities/contact.rb +3 -3
- data/app/models/entities/lead.rb +5 -5
- data/app/models/entities/opportunity.rb +1 -3
- data/app/models/fields/field_group.rb +1 -0
- data/app/models/list.rb +2 -1
- data/app/models/polymorphic/avatar.rb +1 -1
- data/app/models/polymorphic/task.rb +7 -4
- data/app/models/setting.rb +0 -3
- data/app/models/users/ability.rb +13 -2
- data/app/models/users/user.rb +4 -1
- data/app/views/home/index.html.haml +0 -4
- data/app/views/layouts/application.html.haml +7 -5
- data/app/views/leads/_contact.html.haml +0 -3
- data/app/views/lists/_personal_sidebar.html.haml +2 -2
- data/app/views/lists/_sidebar.html.haml +2 -2
- data/config/application.rb +2 -2
- data/config/environments/development.rb +2 -0
- data/config/environments/production.rb +2 -3
- data/config/initializers/secret_token.rb +25 -1
- data/config/locales/en-US_fat_free_crm.yml +1 -1
- data/config/routes.rb +27 -32
- data/config/settings.default.yml +3 -4
- data/lib/development_tasks/rspec.rake +1 -5
- data/lib/fat_free_crm.rb +11 -1
- data/lib/fat_free_crm/fields.rb +1 -1
- data/lib/fat_free_crm/gem_ext/rails/text_helper.rb +1 -2
- data/lib/fat_free_crm/secret_token_generator.rb +59 -0
- data/lib/fat_free_crm/version.rb +1 -1
- data/spec/controllers/admin/users_controller_spec.rb +1 -3
- data/spec/controllers/home_controller_spec.rb +0 -7
- data/spec/controllers/passwords_controller_spec.rb +23 -5
- data/spec/controllers/users_controller_spec.rb +45 -17
- data/spec/lib/secret_token_generator_spec.rb +55 -0
- data/spec/models/users/abilities/user_ability_spec.rb +58 -0
- data/spec/routing/emails_routing_spec.rb +13 -14
- data/spec/spec_helper.rb +2 -1
- metadata +5 -2
@@ -0,0 +1,55 @@
|
|
1
|
+
# Copyright (c) 2008-2014 Michael Dvorkin and contributors.
|
2
|
+
#
|
3
|
+
# Fat Free CRM is freely distributable under the terms of MIT license.
|
4
|
+
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
|
+
#------------------------------------------------------------------------------
|
6
|
+
|
7
|
+
require 'spec_helper'
|
8
|
+
require 'fat_free_crm/secret_token_generator'
|
9
|
+
|
10
|
+
describe FatFreeCRM::SecretTokenGenerator do
|
11
|
+
|
12
|
+
let(:token) { 'e5a4b315c062dec4ecb40dabcde84fd6c067cb016a813702d2f4299ad16255c88ed1020bd47fb527e8e5f7052b04be1fbb8e63c043b8fb36f88d3c7d79a68681' }
|
13
|
+
|
14
|
+
describe "setup!" do
|
15
|
+
|
16
|
+
it "should not generate a token if one already exists" do
|
17
|
+
FatFreeCRM::SecretTokenGenerator.stub(:token).and_return(nil)
|
18
|
+
expect(FatFreeCRM::SecretTokenGenerator).to receive(:generate_and_persist_token!)
|
19
|
+
FatFreeCRM::Application.config.stub(:secret_token).and_return(token)
|
20
|
+
FatFreeCRM::SecretTokenGenerator.setup!
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should generate a token if none exists already" do
|
24
|
+
FatFreeCRM::SecretTokenGenerator.stub(:token).and_return(token)
|
25
|
+
expect(FatFreeCRM::SecretTokenGenerator).not_to receive(:generate_and_persist_token!)
|
26
|
+
FatFreeCRM::SecretTokenGenerator.setup!
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should raise an error if the token is still blank (should never happen)" do
|
30
|
+
FatFreeCRM::SecretTokenGenerator.stub(:token).and_return(nil)
|
31
|
+
lambda { FatFreeCRM::SecretTokenGenerator.setup! }.should raise_error(RuntimeError)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "token" do
|
37
|
+
|
38
|
+
it "should delegate to Setting" do
|
39
|
+
expect(Setting).to receive(:secret_token).and_return(token)
|
40
|
+
expect(FatFreeCRM::SecretTokenGenerator.send(:token)).to eql(token)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "generate_and_persist_token!" do
|
46
|
+
|
47
|
+
it "should generate a random token" do
|
48
|
+
expect(SecureRandom).to receive(:hex).with(64).and_return(token)
|
49
|
+
expect(Setting).to receive(:secret_token=).with(token)
|
50
|
+
FatFreeCRM::SecretTokenGenerator.send(:generate_and_persist_token!)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'cancan/matchers'
|
3
|
+
|
4
|
+
def all_actions
|
5
|
+
[:index, :show, :create, :update, :destroy, :manage]
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "User abilities" do
|
9
|
+
|
10
|
+
subject(:ability) { Ability.new(user) }
|
11
|
+
let(:subject_user) { create :user }
|
12
|
+
|
13
|
+
context "when site manager, I" do
|
14
|
+
let(:user) { create :user, admin: true}
|
15
|
+
all_actions.each do |do_action|
|
16
|
+
it{ should be_able_to(do_action, subject_user) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "when myself, I" do
|
21
|
+
let(:user) { create :user }
|
22
|
+
let(:subject_user) { user }
|
23
|
+
all_actions.each do |do_action|
|
24
|
+
it{ should be_able_to(do_action, subject_user) }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when another user, I" do
|
29
|
+
let(:user) { create :user }
|
30
|
+
let(:can) { [] }
|
31
|
+
let(:cannot) { [:show, :create, :update, :index, :destroy, :manage] }
|
32
|
+
it{ can.each do |do_action|
|
33
|
+
should be_able_to(do_action, subject_user)
|
34
|
+
end}
|
35
|
+
it{ cannot.each do |do_action|
|
36
|
+
should_not be_able_to(do_action, subject_user)
|
37
|
+
end}
|
38
|
+
end
|
39
|
+
|
40
|
+
context "when anonymous user, I" do
|
41
|
+
let(:user) { nil }
|
42
|
+
let(:can) { [] }
|
43
|
+
let(:cannot) { [:show, :create, :update, :index, :destroy, :manage] }
|
44
|
+
it{ can.each do |do_action|
|
45
|
+
should be_able_to(do_action, subject_user)
|
46
|
+
end}
|
47
|
+
it{ cannot.each do |do_action|
|
48
|
+
should_not be_able_to(do_action, subject_user)
|
49
|
+
end}
|
50
|
+
|
51
|
+
it "and signup enabled" do
|
52
|
+
User.stub(:can_signup?).and_return(true)
|
53
|
+
should be_able_to(:create, User)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -3,33 +3,33 @@
|
|
3
3
|
# Fat Free CRM is freely distributable under the terms of MIT license.
|
4
4
|
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
5
5
|
#------------------------------------------------------------------------------
|
6
|
-
require
|
6
|
+
require 'spec_helper'
|
7
7
|
|
8
8
|
describe EmailsController do
|
9
9
|
describe "routing" do
|
10
10
|
|
11
|
-
it "
|
12
|
-
{ :get => "/emails" }.
|
11
|
+
it "should not recognize #index" do
|
12
|
+
{ :get => "/emails" }.should_not be_routable
|
13
13
|
end
|
14
14
|
|
15
|
-
it "
|
16
|
-
{ :get => "/emails/new" }.
|
15
|
+
it "should not recognize #new" do
|
16
|
+
{ :get => "/emails/new" }.should_not be_routable
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
20
|
-
{ :get => "/emails/1" }.
|
19
|
+
it "should not recognize #show" do
|
20
|
+
{ :get => "/emails/1" }.should_not be_routable
|
21
21
|
end
|
22
22
|
|
23
|
-
it "
|
24
|
-
{ :get => "/emails/1/edit" }.
|
23
|
+
it "should not recognize #edit" do
|
24
|
+
{ :get => "/emails/1/edit" }.should_not be_routable
|
25
25
|
end
|
26
26
|
|
27
|
-
it "
|
28
|
-
{ :post => "/emails" }.
|
27
|
+
it "should not recognize #create" do
|
28
|
+
{ :post => "/emails" }.should_not be_routable
|
29
29
|
end
|
30
30
|
|
31
|
-
it "
|
32
|
-
{ :put => "/emails/1" }.
|
31
|
+
it "should not recognize #update" do
|
32
|
+
{ :put => "/emails/1" }.should_not be_routable
|
33
33
|
end
|
34
34
|
|
35
35
|
it "recognizes and generates #destroy" do
|
@@ -37,4 +37,3 @@ describe EmailsController do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ require 'rspec/rails'
|
|
11
11
|
require 'capybara/rails'
|
12
12
|
|
13
13
|
require 'acts_as_fu'
|
14
|
-
require '
|
14
|
+
require 'factory_girl_rails'
|
15
15
|
require 'ffaker'
|
16
16
|
|
17
17
|
require 'coveralls'
|
@@ -38,6 +38,7 @@ RSpec.configure do |config|
|
|
38
38
|
|
39
39
|
# RSpec configuration options for Fat Free CRM.
|
40
40
|
config.include RSpec::Rails::Matchers
|
41
|
+
config.include(FactoryGirl::Syntax::Methods)
|
41
42
|
|
42
43
|
config.before(:each) do
|
43
44
|
# Overwrite locale settings within "config/settings.yml" if necessary.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_free_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dvorkin
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -1042,6 +1042,7 @@ files:
|
|
1042
1042
|
- lib/fat_free_crm/plugin.rb
|
1043
1043
|
- lib/fat_free_crm/plugin_dependencies.rb
|
1044
1044
|
- lib/fat_free_crm/renderers.rb
|
1045
|
+
- lib/fat_free_crm/secret_token_generator.rb
|
1045
1046
|
- lib/fat_free_crm/sortable.rb
|
1046
1047
|
- lib/fat_free_crm/tabs.rb
|
1047
1048
|
- lib/fat_free_crm/version.rb
|
@@ -1161,6 +1162,7 @@ files:
|
|
1161
1162
|
- spec/lib/mail_processor/dropbox_spec.rb
|
1162
1163
|
- spec/lib/mail_processor/sample_emails/dropbox.rb
|
1163
1164
|
- spec/lib/permissions_spec.rb
|
1165
|
+
- spec/lib/secret_token_generator_spec.rb
|
1164
1166
|
- spec/lib/view_factory_spec.rb
|
1165
1167
|
- spec/mailers/subscription_mailer_spec.rb
|
1166
1168
|
- spec/mailers/user_mailer_spec.rb
|
@@ -1186,6 +1188,7 @@ files:
|
|
1186
1188
|
- spec/models/polymorphic/task_spec.rb
|
1187
1189
|
- spec/models/polymorphic/version_spec.rb
|
1188
1190
|
- spec/models/setting_spec.rb
|
1191
|
+
- spec/models/users/abilities/user_ability_spec.rb
|
1189
1192
|
- spec/models/users/authentication_spec.rb
|
1190
1193
|
- spec/models/users/group_spec.rb
|
1191
1194
|
- spec/models/users/permission_spec.rb
|