fat_free_crm 0.11.0 → 0.11.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.
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/Gemfile +15 -2
- data/Gemfile.lock +34 -14
- data/README.md +37 -124
- data/app/assets/javascripts/application.js.erb +1 -1
- data/app/assets/javascripts/crm.js +22 -1
- data/app/assets/javascripts/crm_fields.js +2 -3
- data/app/assets/javascripts/jquery-noconflict.js +17 -0
- data/app/assets/stylesheets/application.css.erb +1 -0
- data/app/assets/stylesheets/common.scss +26 -0
- data/app/assets/stylesheets/ffcrm_chosen.scss +1 -1
- data/app/controllers/admin/application_controller.rb +1 -1
- data/app/controllers/application_controller.rb +0 -8
- data/app/controllers/{accounts_controller.rb → entities/accounts_controller.rb} +1 -13
- data/app/controllers/{campaigns_controller.rb → entities/campaigns_controller.rb} +1 -13
- data/app/controllers/{contacts_controller.rb → entities/contacts_controller.rb} +1 -7
- data/app/controllers/{leads_controller.rb → entities/leads_controller.rb} +1 -1
- data/app/controllers/{opportunities_controller.rb → entities/opportunities_controller.rb} +1 -7
- data/app/controllers/{tasks_controller.rb → entities/tasks_controller.rb} +1 -1
- data/app/controllers/{base_controller.rb → entities_controller.rb} +32 -1
- data/app/controllers/home_controller.rb +9 -9
- data/app/controllers/lists_controller.rb +17 -0
- data/app/helpers/admin/tags_helper.rb +1 -1
- data/app/helpers/application_helper.rb +14 -14
- data/app/helpers/crm_tags_helper.rb +1 -1
- data/app/helpers/home_helper.rb +13 -15
- data/app/helpers/lists_helper.rb +17 -0
- data/app/inputs/date_time_input.rb +17 -0
- data/app/inputs/text_input.rb +17 -1
- data/app/models/{base → entities}/account.rb +0 -1
- data/app/models/{base → entities}/account_contact.rb +0 -0
- data/app/models/{base → entities}/account_opportunity.rb +0 -0
- data/app/models/{base → entities}/campaign.rb +0 -1
- data/app/models/{base → entities}/contact.rb +0 -1
- data/app/models/{base → entities}/contact_opportunity.rb +0 -0
- data/app/models/{base → entities}/lead.rb +0 -1
- data/app/models/{base → entities}/opportunity.rb +0 -1
- data/app/models/{base → entities}/task.rb +5 -6
- data/app/models/list.rb +17 -0
- data/app/models/observers/lead_observer.rb +39 -0
- data/app/models/observers/opportunity_observer.rb +54 -0
- data/app/models/observers/task_observer.rb +41 -0
- data/app/models/polymorphic/address.rb +1 -3
- data/app/models/polymorphic/avatar.rb +0 -5
- data/app/models/polymorphic/comment.rb +2 -11
- data/app/models/polymorphic/email.rb +2 -9
- data/app/models/polymorphic/tag.rb +17 -0
- data/app/models/polymorphic/tagging.rb +17 -0
- data/app/models/users/ability.rb +13 -0
- data/app/models/users/user.rb +1 -4
- data/app/views/accounts/_account.html.haml +10 -6
- data/app/views/accounts/index.html.haml +1 -1
- data/app/views/accounts/show.html.haml +6 -24
- data/app/views/admin/fields/_field.html.haml +6 -6
- data/app/views/admin/tags/_tag.html.haml +2 -2
- data/app/views/admin/tags/index.html.haml +1 -1
- data/app/views/admin/users/_user.html.haml +3 -3
- data/app/views/admin/users/index.html.haml +1 -1
- data/app/views/campaigns/_campaign.html.haml +9 -5
- data/app/views/campaigns/index.html.haml +1 -1
- data/app/views/campaigns/show.html.haml +4 -24
- data/app/views/comments/_comment.html.haml +17 -14
- data/app/views/comments/_edit.html.haml +1 -1
- data/app/views/comments/_new.html.haml +3 -3
- data/app/views/contacts/_contact.html.haml +33 -15
- data/app/views/contacts/_contacts.html.haml +6 -0
- data/app/views/contacts/_sidebar_show.html.haml +1 -1
- data/app/views/contacts/index.html.haml +1 -1
- data/app/views/contacts/show.html.haml +3 -19
- data/app/views/emails/_email.html.haml +24 -21
- data/app/views/{base → entities}/_advanced_search.html.haml +0 -0
- data/app/views/{base → entities}/_condition_fields.html.haml +0 -0
- data/app/views/{base → entities}/_grouping_fields.html.haml +0 -0
- data/app/views/{base → entities}/_sort_fields.html.haml +0 -0
- data/app/views/{base → entities}/advanced_search.js.rjs +0 -0
- data/app/views/entities/contacts.js.rjs +3 -0
- data/app/views/entities/leads.js.rjs +3 -0
- data/app/views/entities/opportunities.js.rjs +3 -0
- data/app/views/entities/versions.js.rjs +3 -0
- data/app/views/home/_activity.html.haml +19 -18
- data/app/views/home/_events_menu.html.haml +8 -0
- data/app/views/home/_options.html.haml +2 -3
- data/app/views/home/index.html.haml +1 -1
- data/app/views/leads/_lead.html.haml +42 -23
- data/app/views/leads/_leads.html.haml +6 -0
- data/app/views/leads/_sidebar_show.html.haml +1 -1
- data/app/views/leads/index.html.haml +1 -1
- data/app/views/leads/show.html.haml +3 -13
- data/app/views/opportunities/_opportunities.html.haml +6 -0
- data/app/views/opportunities/_opportunity.html.haml +23 -11
- data/app/views/opportunities/index.html.haml +1 -1
- data/app/views/opportunities/show.html.haml +4 -18
- data/app/views/shared/_comment.html.haml +3 -3
- data/app/views/shared/_edit_comment.html.haml +1 -1
- data/app/views/shared/_recent.html.haml +4 -4
- data/app/views/shared/_recently.html.haml +3 -3
- data/app/views/shared/_timeline.html.haml +2 -3
- data/app/views/tasks/_assigned.html.haml +4 -4
- data/app/views/tasks/_completed.html.haml +2 -2
- data/app/views/tasks/_pending.html.haml +2 -2
- data/app/views/tasks/_related.html.haml +4 -5
- data/app/views/tasks/_tasks.html.haml +3 -0
- data/app/views/tasks/_title.html.haml +1 -1
- data/app/views/tasks/index.html.haml +1 -1
- data/app/views/users/_avatar.html.haml +2 -2
- data/app/views/versions/_version.html.haml +9 -12
- data/app/views/versions/_versions.html.haml +11 -0
- data/config/application.rb +3 -2
- data/config/environments/development.rb +2 -2
- data/config/environments/production.rb +0 -4
- data/config/environments/staging.rb +1 -1
- data/config/initializers/action_mailer.rb +9 -0
- data/config/initializers/paper_trail.rb +80 -0
- data/config/initializers/relative_url_root.rb +23 -0
- data/config/locales/cz_fat_free_crm.yml +1 -1
- data/config/locales/en-US_fat_free_crm.yml +22 -17
- data/config/locales/fr_fat_free_crm.yml +349 -134
- data/config/routes.rb +144 -140
- data/config/settings.default.yml +14 -2
- data/db/demo/addresses.yml +2 -2
- data/db/demo/emails.yml +2 -2
- data/db/migrate/20120216042541_is_paranoid_to_paper_trail.rb +1 -2
- data/db/migrate/20120309070209_add_versions_related.rb +6 -0
- data/db/migrate/20120316045804_activities_to_versions.rb +35 -0
- data/db/schema.rb +79 -53
- data/fat_free_crm.gemspec +8 -4
- data/lib/development_tasks/gem.rake +18 -1
- data/lib/development_tasks/license.rake +2 -4
- data/lib/development_tasks/rdoc.rake +17 -0
- data/lib/development_tasks/rspec.rake +17 -0
- data/lib/fat_free_crm.rb +20 -14
- data/lib/fat_free_crm/core_ext/array.rb +0 -27
- data/lib/fat_free_crm/dropbox.rb +11 -1
- data/lib/fat_free_crm/engine.rb +21 -3
- data/lib/fat_free_crm/gem_dependencies.rb +26 -0
- data/lib/fat_free_crm/gem_ext.rb +18 -1
- data/lib/fat_free_crm/gem_ext/active_record/schema_dumper.rb +18 -1
- data/lib/fat_free_crm/gem_ext/authlogic/session/cookies.rb +17 -0
- data/lib/fat_free_crm/gem_ext/rails/engine.rb +17 -0
- data/lib/fat_free_crm/gem_ext/rails/text_helper.rb +17 -0
- data/lib/fat_free_crm/gem_ext/rake/task.rb +17 -0
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +18 -1
- data/lib/fat_free_crm/plugin_dependencies.rb +23 -5
- data/lib/fat_free_crm/renderers.rb +17 -0
- data/lib/fat_free_crm/syck_yaml.rb +17 -0
- data/lib/fat_free_crm/version.rb +1 -1
- data/lib/{country_select → plugins/country_select}/MIT-LICENSE +0 -0
- data/lib/{country_select → plugins/country_select}/README +0 -0
- data/lib/{country_select → plugins/country_select}/init.rb +0 -0
- data/lib/{country_select → plugins/country_select}/install.rb +0 -0
- data/lib/{country_select → plugins/country_select}/lib/country_select.rb +0 -0
- data/lib/{country_select → plugins/country_select}/uninstall.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/Gemfile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/README.textile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/ROADMAP.textile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/Rakefile +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/VERSION +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/gravatar_image_tag.gemspec +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/init.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/lib/gravatar_image_tag.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/spec/gravatar_image_tag_spec.rb +0 -0
- data/lib/{gravatar_image_tag → plugins/gravatar_image_tag}/spec/test_helper.rb +0 -0
- data/lib/tasks/demo.rake +32 -29
- data/lib/tasks/dropbox.rake +1 -1
- data/lib/tasks/fat_free_crm.rake +3 -2
- data/lib/tasks/plugins.rake +1 -0
- data/spec/controllers/accounts_controller_spec.rb +7 -5
- data/spec/controllers/campaigns_controller_spec.rb +11 -9
- data/spec/controllers/contacts_controller_spec.rb +7 -5
- data/spec/controllers/home_controller_spec.rb +2 -2
- data/spec/controllers/leads_controller_spec.rb +7 -5
- data/spec/controllers/opportunities_controller_spec.rb +7 -5
- data/spec/factories/shared_factories.rb +8 -11
- data/spec/lib/dropbox_spec.rb +1 -0
- data/spec/models/polymorphic/version_spec.rb +247 -0
- data/spec/models/users/user_spec.rb +0 -9
- data/spec/spec_helper.rb +4 -0
- data/spec/views/home/index.haml_spec.rb +1 -1
- data/spec/views/home/index.rjs_spec.rb +4 -4
- data/spec/views/tasks/new.rjs_spec.rb +2 -2
- data/vendor/assets/javascripts/calendar_date_select/format_french.js +24 -0
- metadata +167 -126
- data/app/models/observers/activity_observer.rb +0 -84
- data/app/models/polymorphic/activity.rb +0 -106
- data/app/views/accounts/contacts.js.rjs +0 -3
- data/app/views/accounts/opportunities.js.rjs +0 -3
- data/app/views/campaigns/leads.js.rjs +0 -3
- data/app/views/campaigns/opportunities.js.rjs +0 -3
- data/app/views/contacts/opportunities.js.rjs +0 -3
- data/app/views/home/_actions_menu.html.haml +0 -8
- data/lib/dynamic_form/MIT-LICENSE +0 -20
- data/lib/dynamic_form/README +0 -13
- data/lib/dynamic_form/Rakefile +0 -10
- data/lib/dynamic_form/dynamic_form.gemspec +0 -12
- data/lib/dynamic_form/init.rb +0 -2
- data/lib/dynamic_form/lib/action_view/helpers/dynamic_form.rb +0 -301
- data/lib/dynamic_form/lib/action_view/locale/en-US.yml +0 -8
- data/lib/dynamic_form/lib/dynamic_form.rb +0 -6
- data/lib/dynamic_form/test/dynamic_form_i18n_test.rb +0 -42
- data/lib/dynamic_form/test/dynamic_form_test.rb +0 -370
- data/lib/dynamic_form/test/test_helper.rb +0 -10
- data/lib/responds_to_parent/MIT-LICENSE +0 -20
- data/lib/responds_to_parent/README +0 -47
- data/lib/responds_to_parent/Rakefile +0 -22
- data/lib/responds_to_parent/init.rb +0 -2
- data/lib/responds_to_parent/install.rb +0 -2
- data/lib/responds_to_parent/lib/responds_to_parent.rb +0 -70
- data/lib/responds_to_parent/test/responds_to_parent_test.rb +0 -11
- data/lib/responds_to_parent/test/test_helper.rb +0 -7
- data/lib/responds_to_parent/uninstall.rb +0 -2
- data/spec/models/polymorphic/activity_spec.rb +0 -303
@@ -1,3 +1,20 @@
|
|
1
|
+
# Fat Free CRM
|
2
|
+
# Copyright (C) 2008-2011 by Michael Dvorkin
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU Affero General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU Affero General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#------------------------------------------------------------------------------
|
17
|
+
|
1
18
|
#
|
2
19
|
# Removes simple_form's css class logic.
|
3
20
|
module SimpleForm
|
@@ -10,7 +27,7 @@ module SimpleForm
|
|
10
27
|
options[:html][:novalidate] = !SimpleForm.browser_validations
|
11
28
|
end
|
12
29
|
|
13
|
-
|
30
|
+
with_simple_form_field_error_proc do
|
14
31
|
form_for(record, options, &block)
|
15
32
|
end
|
16
33
|
end
|
@@ -1,6 +1,24 @@
|
|
1
|
+
# Fat Free CRM
|
2
|
+
# Copyright (C) 2008-2011 by Michael Dvorkin
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU Affero General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU Affero General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#------------------------------------------------------------------------------
|
17
|
+
|
1
18
|
# Plugin dependencies
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require File.
|
6
|
-
|
19
|
+
Dir.glob(File.join(File.dirname(__FILE__), '..', 'plugins', '**')).each do |plugin_dir|
|
20
|
+
# Add 'plugin/lib' to $LOAD_PATH
|
21
|
+
$:.unshift File.expand_path(File.join(plugin_dir, 'lib'))
|
22
|
+
require File.basename(plugin_dir) # require 'plugin'
|
23
|
+
require File.join(plugin_dir, 'init') # require 'plugin/init'
|
24
|
+
end
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Fat Free CRM
|
2
|
+
# Copyright (C) 2008-2011 by Michael Dvorkin
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU Affero General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU Affero General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#------------------------------------------------------------------------------
|
17
|
+
|
1
18
|
ActionController::Renderers.add :csv do |obj, options|
|
2
19
|
filename = options[:filename] || 'data'
|
3
20
|
str = obj.respond_to?(:to_csv) ? obj.to_csv : obj.to_s
|
@@ -1,3 +1,20 @@
|
|
1
|
+
# Fat Free CRM
|
2
|
+
# Copyright (C) 2008-2011 by Michael Dvorkin
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU Affero General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU Affero General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Affero General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
#------------------------------------------------------------------------------
|
17
|
+
|
1
18
|
if RUBY_VERSION.to_f >= 1.9
|
2
19
|
require 'yaml'
|
3
20
|
YAML::ENGINE.yamler = 'syck'
|
data/lib/fat_free_crm/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/tasks/demo.rake
CHANGED
@@ -26,39 +26,42 @@ namespace :ffcrm do
|
|
26
26
|
ActiveRecord::Fixtures.create_fixtures(FatFreeCRM.root.join('db/demo'), File.basename(fixture_file, '.*'))
|
27
27
|
end
|
28
28
|
|
29
|
+
def create_version(options)
|
30
|
+
version = Version.new
|
31
|
+
options.each { |k,v| version.send(k.to_s + '=', v) }
|
32
|
+
version.save!
|
33
|
+
end
|
34
|
+
|
29
35
|
# Simulate random user activities.
|
30
36
|
$stdout.sync = true
|
31
37
|
puts "Generating user activities..."
|
32
|
-
%w(Account Campaign Contact Lead Opportunity Task).map do |model|
|
33
|
-
model.constantize.
|
34
|
-
end.flatten.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
received_at = sent_at + rand(600).seconds
|
58
|
-
email.update_attributes(:created_at => time, :sent_at => sent_at, :received_at => received_at)
|
59
|
-
end
|
38
|
+
%w(Account Address Campaign Comment Contact Email Lead Opportunity Task).map do |model|
|
39
|
+
model.constantize.all
|
40
|
+
end.flatten.each do |item|
|
41
|
+
user = if item.respond_to?(:user)
|
42
|
+
item.user
|
43
|
+
elsif item.respond_to?(:addressable)
|
44
|
+
item.addressable.try(:user)
|
45
|
+
end
|
46
|
+
related = if item.respond_to?(:addressable)
|
47
|
+
item.addressable
|
48
|
+
elsif item.respond_to?(:commentable)
|
49
|
+
item.commentable
|
50
|
+
elsif item.respond_to?(:mediator)
|
51
|
+
item.mediator
|
52
|
+
end
|
53
|
+
# Backdate within the last 30 days
|
54
|
+
created_at = item.created_at - (rand(30) + 1).days + rand(12 * 60).minutes
|
55
|
+
updated_at = created_at + rand(12 * 60).minutes
|
56
|
+
|
57
|
+
create_version(:event => "create", :created_at => created_at, :user => user, :item => item, :related => related)
|
58
|
+
create_version(:event => "update", :created_at => updated_at, :user => user, :item => item, :related => related)
|
59
|
+
|
60
|
+
if [Account, Campaign, Contact, Lead, Opportunity].include?(item.class)
|
61
|
+
viewed_at = created_at + rand(12 * 60).minutes
|
62
|
+
version = create_version(:event => "view", :created_at => viewed_at, :user => user, :item => item)
|
60
63
|
end
|
61
|
-
print "." if
|
64
|
+
print "." if item.id % 10 == 0
|
62
65
|
end
|
63
66
|
puts
|
64
67
|
end
|
data/lib/tasks/dropbox.rake
CHANGED
data/lib/tasks/fat_free_crm.rake
CHANGED
@@ -72,7 +72,7 @@ namespace :ffcrm do
|
|
72
72
|
# Migrating plugins is not part of Rails 3 yet, but it is coming. See
|
73
73
|
# https://rails.lighthouseapp.com/projects/8994/tickets/2058 for details.
|
74
74
|
Rake::Task["db:migrate:plugins"].invoke rescue nil
|
75
|
-
Rake::Task["setup:admin"].invoke
|
75
|
+
Rake::Task["ffcrm:setup:admin"].invoke
|
76
76
|
end
|
77
77
|
|
78
78
|
namespace :setup do
|
@@ -124,7 +124,8 @@ namespace :ffcrm do
|
|
124
124
|
user = User.find_by_username(username) || User.new
|
125
125
|
user.update_attributes(:username => username, :password => password, :email => email)
|
126
126
|
user.update_attribute(:admin, true) # Mass assignments don't work for :admin because of the attr_protected
|
127
|
+
user.update_attribute(:suspended_at, nil) # Mass assignments don't work for :suspended_at because of the attr_protected
|
127
128
|
puts "Admin user has been created."
|
128
129
|
end
|
129
130
|
end
|
130
|
-
end
|
131
|
+
end
|
data/lib/tasks/plugins.rake
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
# You should have received a copy of the GNU Affero General Public License
|
15
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
#------------------------------------------------------------------------------
|
17
|
+
|
17
18
|
Rake::Task.remove("db:migrate:status") # (Clears task so that it can be extended)
|
18
19
|
|
19
20
|
namespace :db do
|
@@ -122,15 +122,16 @@ describe AccountsController do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should update an activity when viewing the account" do
|
125
|
-
Activity.should_receive(:log).with(@current_user, @account, :viewed).once
|
126
125
|
get :show, :id => @account.id
|
126
|
+
@account.versions.last.event.should == 'view'
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
describe "with mime type of JSON" do
|
131
131
|
it "should render the requested account as json" do
|
132
|
-
|
133
|
-
|
132
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
133
|
+
Account.stub_chain(:my, :find).and_return(@account)
|
134
|
+
@account.should_receive(:to_json).and_return("generated JSON")
|
134
135
|
|
135
136
|
request.env["HTTP_ACCEPT"] = "application/json"
|
136
137
|
get :show, :id => 42
|
@@ -140,8 +141,9 @@ describe AccountsController do
|
|
140
141
|
|
141
142
|
describe "with mime type of XML" do
|
142
143
|
it "should render the requested account as xml" do
|
143
|
-
|
144
|
-
|
144
|
+
@account = FactoryGirl.create(:account, :user => @current_user)
|
145
|
+
Account.stub_chain(:my, :find).and_return(@account)
|
146
|
+
@account.should_receive(:to_xml).and_return("generated XML")
|
145
147
|
|
146
148
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
147
149
|
get :show, :id => 42
|
@@ -85,8 +85,8 @@ describe CampaignsController do
|
|
85
85
|
|
86
86
|
describe "with mime type of JSON" do
|
87
87
|
it "should render all campaigns as JSON" do
|
88
|
-
@controller.should_receive(:get_list_of_records).and_return(campaigns =
|
89
|
-
campaigns.should_receive(:to_json).and_return("generated JSON")
|
88
|
+
@controller.should_receive(:get_list_of_records).and_return(@campaigns = [])
|
89
|
+
@campaigns.should_receive(:to_json).and_return("generated JSON")
|
90
90
|
|
91
91
|
request.env["HTTP_ACCEPT"] = "application/json"
|
92
92
|
get :index
|
@@ -96,8 +96,8 @@ describe CampaignsController do
|
|
96
96
|
|
97
97
|
describe "with mime type of XML" do
|
98
98
|
it "should render all campaigns as xml" do
|
99
|
-
@controller.should_receive(:get_list_of_records).and_return(campaigns =
|
100
|
-
campaigns.should_receive(:to_xml).and_return("generated XML")
|
99
|
+
@controller.should_receive(:get_list_of_records).and_return(@campaigns = [])
|
100
|
+
@campaigns.should_receive(:to_xml).and_return("generated XML")
|
101
101
|
|
102
102
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
103
103
|
get :index
|
@@ -127,15 +127,16 @@ describe CampaignsController do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should update an activity when viewing the campaign" do
|
130
|
-
Activity.should_receive(:log).with(@current_user, @campaign, :viewed).once
|
131
130
|
get :show, :id => @campaign.id
|
131
|
+
@campaign.versions.last.event.should == 'view'
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
describe "with mime type of JSON" do
|
136
136
|
it "should render the requested campaign as JSON" do
|
137
|
-
|
138
|
-
|
137
|
+
@campaign = FactoryGirl.create(:campaign, :id => 42, :user => @current_user)
|
138
|
+
Campaign.stub_chain(:my, :find).and_return(@campaign)
|
139
|
+
@campaign.should_receive(:to_json).and_return("generated JSON")
|
139
140
|
|
140
141
|
request.env["HTTP_ACCEPT"] = "application/json"
|
141
142
|
get :show, :id => 42
|
@@ -145,8 +146,9 @@ describe CampaignsController do
|
|
145
146
|
|
146
147
|
describe "with mime type of XML" do
|
147
148
|
it "should render the requested campaign as XML" do
|
148
|
-
|
149
|
-
|
149
|
+
@campaign = FactoryGirl.create(:campaign, :id => 42, :user => @current_user)
|
150
|
+
Campaign.stub_chain(:my, :find).and_return(@campaign)
|
151
|
+
@campaign.should_receive(:to_xml).and_return("generated XML")
|
150
152
|
|
151
153
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
152
154
|
get :show, :id => 42
|
@@ -95,15 +95,16 @@ describe ContactsController do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should update an activity when viewing the contact" do
|
98
|
-
Activity.should_receive(:log).with(@current_user, @contact, :viewed).once
|
99
98
|
get :show, :id => @contact.id
|
99
|
+
@contact.versions.last.event.should == 'view'
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
describe "with mime type of JSON" do
|
104
104
|
it "should render the requested contact as JSON" do
|
105
|
-
|
106
|
-
|
105
|
+
@contact = FactoryGirl.create(:contact, :id => 42)
|
106
|
+
Contact.stub_chain(:my, :find).and_return(@contact)
|
107
|
+
@contact.should_receive(:to_json).and_return("generated JSON")
|
107
108
|
|
108
109
|
request.env["HTTP_ACCEPT"] = "application/json"
|
109
110
|
get :show, :id => 42
|
@@ -113,8 +114,9 @@ describe ContactsController do
|
|
113
114
|
|
114
115
|
describe "with mime type of XML" do
|
115
116
|
it "should render the requested contact as xml" do
|
116
|
-
|
117
|
-
|
117
|
+
@contact = FactoryGirl.create(:contact, :id => 42)
|
118
|
+
Contact.stub_chain(:my, :find).and_return(@contact)
|
119
|
+
@contact.should_receive(:to_xml).and_return("generated XML")
|
118
120
|
|
119
121
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
120
122
|
get :show, :id => 42
|
@@ -10,7 +10,7 @@ describe HomeController do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should get a list of activities" do
|
13
|
-
@activity = FactoryGirl.create(:
|
13
|
+
@activity = FactoryGirl.create(:version, :item => FactoryGirl.create(:account, :user => @current_user))
|
14
14
|
controller.should_receive(:get_activities).once.and_return([ @activity ])
|
15
15
|
|
16
16
|
get :index
|
@@ -69,7 +69,7 @@ describe HomeController do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should get a list of activities" do
|
72
|
-
@activity = FactoryGirl.create(:
|
72
|
+
@activity = FactoryGirl.create(:version, :item => FactoryGirl.create(:account, :user => @current_user))
|
73
73
|
controller.should_receive(:get_activities).once.and_return([ @activity ])
|
74
74
|
|
75
75
|
get :index
|
@@ -118,15 +118,16 @@ describe LeadsController do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should update an activity when viewing the lead" do
|
121
|
-
Activity.should_receive(:log).with(@current_user, @lead, :viewed).once
|
122
121
|
get :show, :id => @lead.id
|
122
|
+
@lead.versions.last.event.should == 'view'
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
126
|
describe "with mime type of JSON" do
|
127
127
|
it "should render the requested lead as JSON" do
|
128
|
-
|
129
|
-
|
128
|
+
@lead = FactoryGirl.create(:lead, :id => 42, :user => @current_user)
|
129
|
+
Lead.stub_chain(:my, :find).and_return(@lead)
|
130
|
+
@lead.should_receive(:to_json).and_return("generated JSON")
|
130
131
|
|
131
132
|
request.env["HTTP_ACCEPT"] = "application/json"
|
132
133
|
get :show, :id => 42
|
@@ -136,8 +137,9 @@ describe LeadsController do
|
|
136
137
|
|
137
138
|
describe "with mime type of XML" do
|
138
139
|
it "should render the requested lead as xml" do
|
139
|
-
|
140
|
-
|
140
|
+
@lead = FactoryGirl.create(:lead, :id => 42, :user => @current_user)
|
141
|
+
Lead.stub_chain(:my, :find).and_return(@lead)
|
142
|
+
@lead.should_receive(:to_xml).and_return("generated XML")
|
141
143
|
|
142
144
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
143
145
|
get :show, :id => 42
|
@@ -136,15 +136,16 @@ describe OpportunitiesController do
|
|
136
136
|
end
|
137
137
|
|
138
138
|
it "should update an activity when viewing the opportunity" do
|
139
|
-
Activity.should_receive(:log).with(@current_user, @opportunity, :viewed).once
|
140
139
|
get :show, :id => @opportunity.id
|
140
|
+
@opportunity.versions.last.event.should == 'view'
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
144
|
describe "with mime type of JSON" do
|
145
145
|
it "should render the requested opportunity as JSON" do
|
146
|
-
|
147
|
-
|
146
|
+
@opportunity = FactoryGirl.create(:opportunity, :id => 42)
|
147
|
+
Opportunity.stub_chain(:my, :find).and_return(@opportunity)
|
148
|
+
@opportunity.should_receive(:to_json).and_return("generated JSON")
|
148
149
|
|
149
150
|
request.env["HTTP_ACCEPT"] = "application/json"
|
150
151
|
get :show, :id => 42
|
@@ -154,8 +155,9 @@ describe OpportunitiesController do
|
|
154
155
|
|
155
156
|
describe "with mime type of XML" do
|
156
157
|
it "should render the requested opportunity as xml" do
|
157
|
-
|
158
|
-
|
158
|
+
@opportunity = FactoryGirl.create(:opportunity, :id => 42)
|
159
|
+
Opportunity.stub_chain(:my, :find).and_return(@opportunity)
|
160
|
+
@opportunity.should_receive(:to_xml).and_return("generated XML")
|
159
161
|
|
160
162
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
161
163
|
get :show, :id => 42
|