fat_free_crm 0.12.3 → 0.13.0
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 +5 -13
- data/.travis.yml +1 -11
- data/Gemfile +7 -19
- data/Gemfile.lock +166 -166
- data/Procfile +1 -1
- data/README.md +20 -20
- data/app/assets/javascripts/admin/fields.js.coffee +3 -3
- data/app/assets/javascripts/application.js.erb +3 -0
- data/app/assets/javascripts/crm.js +1 -0
- data/app/assets/javascripts/crm_comments.js.coffee +66 -0
- data/app/assets/javascripts/lists.js.coffee +45 -2
- data/app/assets/javascripts/search.js.coffee +2 -0
- data/app/assets/javascripts/timeago.js +17 -0
- data/app/assets/stylesheets/advanced_search.css.scss +49 -25
- data/app/assets/stylesheets/application.css.erb +3 -0
- data/app/assets/stylesheets/common.scss +13 -0
- data/app/assets/stylesheets/format_buttons.css.scss +15 -10
- data/app/assets/stylesheets/header.scss +3 -0
- data/app/assets/stylesheets/lists.css.scss +4 -0
- data/app/controllers/admin/fields_controller.rb +5 -5
- data/app/controllers/admin/users_controller.rb +1 -3
- data/app/controllers/application_controller.rb +23 -23
- data/app/controllers/comments_controller.rb +3 -31
- data/app/controllers/entities/accounts_controller.rb +3 -3
- data/app/controllers/entities/campaigns_controller.rb +4 -4
- data/app/controllers/entities/contacts_controller.rb +2 -2
- data/app/controllers/entities/leads_controller.rb +3 -3
- data/app/controllers/entities/opportunities_controller.rb +4 -3
- data/app/controllers/entities_controller.rb +6 -6
- data/app/controllers/home_controller.rb +1 -1
- data/app/controllers/lists_controller.rb +8 -1
- data/app/controllers/tasks_controller.rb +1 -1
- data/app/controllers/users_controller.rb +46 -23
- data/app/helpers/admin/application_helper.rb +1 -3
- data/app/helpers/admin/field_groups_helper.rb +2 -1
- data/app/helpers/application_helper.rb +37 -16
- data/app/helpers/home_helper.rb +1 -2
- data/app/helpers/leads_helper.rb +5 -6
- data/app/helpers/tasks_helper.rb +36 -50
- data/app/models/entities/account.rb +10 -7
- data/app/models/entities/campaign.rb +4 -4
- data/app/models/entities/contact.rb +8 -5
- data/app/models/entities/lead.rb +8 -8
- data/app/models/entities/opportunity.rb +13 -18
- data/app/models/fields/custom_field.rb +10 -0
- data/app/models/fields/field.rb +3 -3
- data/app/models/fields/field_group.rb +1 -1
- data/app/models/list.rb +1 -0
- data/app/models/polymorphic/address.rb +3 -3
- data/app/models/polymorphic/comment.rb +2 -4
- data/app/models/polymorphic/task.rb +32 -27
- data/app/models/setting.rb +3 -9
- data/app/models/users/ability.rb +2 -13
- data/app/models/users/user.rb +12 -15
- data/app/views/accounts/_edit.html.haml +1 -1
- data/app/views/accounts/_index_brief.html.haml +3 -3
- data/app/views/accounts/_index_long.html.haml +3 -3
- data/app/views/accounts/_new.html.haml +1 -1
- data/app/views/accounts/create.js.haml +17 -0
- data/app/views/accounts/destroy.js.haml +6 -0
- data/app/views/accounts/edit.js.haml +32 -0
- data/app/views/accounts/index.js.haml +11 -0
- data/app/views/accounts/index.xls.builder +9 -7
- data/app/views/accounts/new.js.haml +11 -0
- data/app/views/accounts/show.js.haml +5 -0
- data/app/views/accounts/update.js.haml +17 -0
- data/app/views/admin/field_groups/_edit.html.haml +1 -1
- data/app/views/admin/field_groups/_new.html.haml +1 -1
- data/app/views/admin/field_groups/confirm.js.haml +7 -0
- data/app/views/admin/field_groups/create.js.haml +20 -0
- data/app/views/admin/field_groups/destroy.js.haml +9 -0
- data/app/views/admin/field_groups/edit.js.haml +12 -0
- data/app/views/admin/field_groups/new.js.haml +8 -0
- data/app/views/admin/field_groups/update.js.haml +8 -0
- data/app/views/admin/fields/_field.html.haml +2 -2
- data/app/views/admin/fields/_form.html.haml +2 -2
- data/app/views/admin/fields/create.js.haml +17 -0
- data/app/views/admin/fields/destroy.js.haml +8 -0
- data/app/views/admin/fields/edit.js.haml +3 -0
- data/app/views/admin/fields/update.js.haml +13 -0
- data/app/views/admin/groups/_edit.html.haml +1 -1
- data/app/views/admin/groups/_new.html.haml +1 -1
- data/app/views/admin/groups/create.js.haml +10 -0
- data/app/views/admin/groups/destroy.js.haml +9 -0
- data/app/views/admin/groups/edit.js.haml +14 -0
- data/app/views/admin/groups/index.html.haml +1 -1
- data/app/views/admin/groups/index.js.haml +2 -0
- data/app/views/admin/groups/new.js.haml +9 -0
- data/app/views/admin/groups/update.js.haml +9 -0
- data/app/views/admin/tags/_edit.html.haml +1 -1
- data/app/views/admin/tags/_new.html.haml +1 -1
- data/app/views/admin/tags/confirm.js.haml +7 -0
- data/app/views/admin/tags/create.js.haml +11 -0
- data/app/views/admin/tags/destroy.js.haml +10 -0
- data/app/views/admin/tags/edit.js.haml +20 -0
- data/app/views/admin/tags/new.js.haml +7 -0
- data/app/views/admin/tags/update.js.haml +9 -0
- data/app/views/admin/users/_edit.html.haml +1 -1
- data/app/views/admin/users/_new.html.haml +1 -1
- data/app/views/admin/users/_user.html.haml +1 -1
- data/app/views/admin/users/confirm.js.haml +7 -0
- data/app/views/admin/users/create.js.haml +10 -0
- data/app/views/admin/users/destroy.js.haml +10 -0
- data/app/views/admin/users/edit.js.haml +20 -0
- data/app/views/admin/users/index.js.haml +2 -0
- data/app/views/admin/users/new.js.haml +9 -0
- data/app/views/admin/users/reactivate.js.haml +3 -0
- data/app/views/admin/users/suspend.js.haml +3 -0
- data/app/views/admin/users/update.js.haml +9 -0
- data/app/views/authentications/new.html.haml +1 -1
- data/app/views/campaigns/_edit.html.haml +1 -1
- data/app/views/campaigns/_new.html.haml +1 -1
- data/app/views/campaigns/create.js.haml +20 -0
- data/app/views/campaigns/destroy.js.haml +6 -0
- data/app/views/campaigns/edit.js.haml +33 -0
- data/app/views/campaigns/index.js.haml +11 -0
- data/app/views/campaigns/index.xls.builder +9 -7
- data/app/views/campaigns/new.js.haml +11 -0
- data/app/views/campaigns/show.js.haml +5 -0
- data/app/views/campaigns/update.js.haml +20 -0
- data/app/views/comments/_comment.html.haml +1 -1
- data/app/views/comments/_edit.html.haml +1 -1
- data/app/views/comments/_new.html.haml +3 -2
- data/app/views/comments/create.js.haml +14 -0
- data/app/views/comments/destroy.js.haml +5 -0
- data/app/views/comments/edit.js.haml +11 -0
- data/app/views/comments/update.js.haml +9 -0
- data/app/views/contacts/_edit.html.haml +1 -1
- data/app/views/contacts/_index_full.html.haml +1 -1
- data/app/views/contacts/_index_long.html.haml +2 -1
- data/app/views/contacts/_new.html.haml +1 -1
- data/app/views/contacts/_section_general.html.haml +3 -3
- data/app/views/contacts/create.js.haml +23 -0
- data/app/views/contacts/destroy.js.haml +9 -0
- data/app/views/contacts/edit.js.haml +35 -0
- data/app/views/contacts/index.js.haml +11 -0
- data/app/views/contacts/index.xls.builder +9 -7
- data/app/views/contacts/new.js.haml +13 -0
- data/app/views/contacts/show.js.haml +5 -0
- data/app/views/contacts/update.js.haml +22 -0
- data/app/views/emails/destroy.js.haml +5 -0
- data/app/views/entities/_permissions.html.haml +1 -1
- data/app/views/entities/attach.js.haml +21 -0
- data/app/views/entities/contacts.js.haml +3 -0
- data/app/views/entities/discard.js.haml +6 -0
- data/app/views/entities/leads.js.haml +3 -0
- data/app/views/entities/opportunities.js.haml +3 -0
- data/app/views/entities/subscription_update.js.haml +4 -0
- data/app/views/entities/versions.js.haml +3 -0
- data/app/views/fields/group.js.erb +3 -0
- data/app/views/home/_account.html.haml +3 -3
- data/app/views/home/_opportunity.html.haml +3 -3
- data/app/views/home/index.atom.builder +3 -3
- data/app/views/home/index.js.haml +7 -0
- data/app/views/home/index.rss.builder +2 -2
- data/app/views/home/options.js.haml +7 -0
- data/app/views/layouts/_footer.html.haml +0 -4
- data/app/views/layouts/_sidebar.html.haml +1 -0
- data/app/views/layouts/_tabbed.html.haml +1 -4
- data/app/views/layouts/admin/application.html.haml +0 -1
- data/app/views/layouts/application.html.haml +5 -7
- data/app/views/leads/_convert.html.haml +1 -1
- data/app/views/leads/_edit.html.haml +1 -1
- data/app/views/leads/_index_long.html.haml +2 -2
- data/app/views/leads/_new.html.haml +1 -1
- data/app/views/leads/convert.js.haml +35 -0
- data/app/views/leads/create.js.haml +21 -0
- data/app/views/leads/destroy.js.haml +9 -0
- data/app/views/leads/edit.js.haml +35 -0
- data/app/views/leads/index.js.haml +11 -0
- data/app/views/leads/index.xls.builder +9 -7
- data/app/views/leads/new.js.haml +11 -0
- data/app/views/leads/promote.js.haml +26 -0
- data/app/views/leads/reject.js.haml +12 -0
- data/app/views/leads/show.js.haml +5 -0
- data/app/views/leads/update.js.haml +26 -0
- data/app/views/lists/_personal_sidebar.html.haml +28 -0
- data/app/views/lists/_sidebar.html.haml +10 -7
- data/app/views/lists/create.js.haml +10 -0
- data/app/views/lists/destroy.js.haml +1 -0
- data/app/views/opportunities/_edit.html.haml +1 -1
- data/app/views/opportunities/_index_brief.html.haml +3 -3
- data/app/views/opportunities/_index_long.html.haml +3 -3
- data/app/views/opportunities/_new.html.haml +1 -2
- data/app/views/opportunities/_top_section.html.haml +4 -0
- data/app/views/opportunities/contacts.js.haml +3 -0
- data/app/views/opportunities/create.js.haml +29 -0
- data/app/views/opportunities/destroy.js.haml +13 -0
- data/app/views/opportunities/edit.js.haml +35 -0
- data/app/views/opportunities/index.js.haml +11 -0
- data/app/views/opportunities/index.xls.builder +9 -7
- data/app/views/opportunities/new.js.haml +13 -0
- data/app/views/opportunities/show.js.haml +5 -0
- data/app/views/opportunities/update.js.haml +25 -0
- data/app/views/passwords/edit.html.haml +1 -1
- data/app/views/passwords/new.html.haml +1 -1
- data/app/views/shared/_comment.html.haml +1 -1
- data/app/views/shared/_inline_styles.html.haml +1 -1
- data/app/views/tasks/_edit.html.haml +1 -1
- data/app/views/tasks/_new.html.haml +1 -1
- data/app/views/tasks/complete.js.haml +14 -0
- data/app/views/tasks/create.js.haml +39 -0
- data/app/views/tasks/destroy.js.haml +7 -0
- data/app/views/tasks/discard.js.haml +1 -0
- data/app/views/tasks/edit.js.haml +26 -0
- data/app/views/tasks/filter.js.haml +4 -0
- data/app/views/tasks/index.xls.builder +7 -5
- data/app/views/tasks/new.js.haml +8 -0
- data/app/views/tasks/update.js.haml +19 -0
- data/app/views/users/_password.html.haml +1 -1
- data/app/views/users/_profile.html.haml +1 -1
- data/app/views/users/avatar.js.haml +9 -0
- data/app/views/users/change_password.js.haml +13 -0
- data/app/views/users/edit.js.haml +9 -0
- data/app/views/users/new.html.haml +1 -1
- data/app/views/users/password.js.haml +10 -0
- data/app/views/users/update.js.haml +9 -0
- data/app/views/users/upload_avatar.js.haml +7 -0
- data/app/views/versions/_version.html.haml +1 -1
- data/config/application.rb +1 -4
- data/config/environments/production.rb +3 -2
- data/config/initializers/custom_field_ransack_translations.rb +15 -0
- data/config/initializers/locale.rb +9 -1
- data/config/initializers/secret_token.rb +1 -25
- data/config/initializers/views.rb +20 -20
- data/config/locales/cz.yml +245 -211
- data/config/locales/cz_fat_free_crm.yml +105 -181
- data/config/locales/de.yml +162 -118
- data/config/locales/de_fat_free_crm.yml +760 -731
- data/config/locales/de_ransack.yml +91 -0
- data/config/locales/en-GB.yml +158 -119
- data/config/locales/en-GB_fat_free_crm.yml +161 -279
- data/config/locales/en-US.yml +158 -121
- data/config/locales/en-US_fat_free_crm.yml +185 -179
- data/config/locales/en-US_ransack.yml +81 -82
- data/config/locales/es.yml +164 -123
- data/config/locales/es_fat_free_crm.yml +151 -209
- data/config/locales/fr-CA.yml +167 -130
- data/config/locales/fr-CA_fat_free_crm.yml +142 -202
- data/config/locales/fr.yml +170 -125
- data/config/locales/fr_fat_free_crm.yml +199 -302
- data/config/locales/it.yml +158 -122
- data/config/locales/it_fat_free_crm.yml +105 -168
- data/config/locales/ja.yml +162 -131
- data/config/locales/ja_fat_free_crm.yml +118 -188
- data/config/locales/pl.yml +168 -132
- data/config/locales/pl_fat_free_crm.yml +115 -186
- data/config/locales/pt-BR.yml +160 -127
- data/config/locales/pt-BR_fat_free_crm.yml +125 -182
- data/config/locales/ru.yml +256 -233
- data/config/locales/ru_fat_free_crm.yml +136 -193
- data/config/locales/sv-SE.yml +164 -181
- data/config/locales/sv-SE_fat_free_crm.yml +129 -193
- data/config/locales/th_fat_free_crm.yml +114 -194
- data/config/locales/zh-CN.yml +176 -149
- data/config/locales/zh-CN_fat_free_crm.yml +78 -167
- data/config/routes.rb +1 -1
- data/config/settings.default.yml +74 -23
- data/custom_plan.rb +11 -0
- data/db/migrate/20131207033244_add_user_id_to_lists.rb +6 -0
- data/db/schema.rb +4 -1
- data/fat_free_crm.gemspec +3 -3
- data/lib/fat_free_crm.rb +1 -11
- data/lib/fat_free_crm/export_csv.rb +3 -3
- data/lib/fat_free_crm/fields.rb +10 -0
- data/lib/fat_free_crm/gem_dependencies.rb +1 -2
- data/lib/fat_free_crm/i18n.rb +9 -5
- data/lib/fat_free_crm/version.rb +2 -2
- data/lib/fat_free_crm/view_factory.rb +8 -5
- data/lib/tasks/ffcrm/config.rake +9 -12
- data/lib/tasks/ffcrm/missing_translations.rake +2 -1
- data/spec/controllers/admin/users_controller_spec.rb +6 -4
- data/spec/controllers/applications_controller_spec.rb +4 -4
- data/spec/controllers/authentications_controller_spec.rb +15 -15
- data/spec/controllers/comments_controller_spec.rb +9 -87
- data/spec/controllers/emails_controller_spec.rb +1 -1
- data/spec/controllers/entities/accounts_controller_spec.rb +7 -7
- data/spec/controllers/entities/campaigns_controller_spec.rb +5 -5
- data/spec/controllers/entities/contacts_controller_spec.rb +7 -7
- data/spec/controllers/entities/leads_controller_spec.rb +14 -14
- data/spec/controllers/entities/opportunities_controller_spec.rb +8 -8
- data/spec/controllers/home_controller_spec.rb +6 -6
- data/spec/controllers/tasks_controller_spec.rb +7 -7
- data/spec/controllers/users_controller_spec.rb +22 -50
- data/spec/features/support/selector_helpers.rb +1 -6
- data/spec/features/tasks_spec.rb +2 -2
- data/spec/helpers/application_helper_spec.rb +15 -15
- data/spec/lib/fields_spec.rb +29 -29
- data/spec/lib/mail_processor/base_spec.rb +7 -7
- data/spec/lib/mail_processor/dropbox_spec.rb +3 -3
- data/spec/lib/view_factory_spec.rb +14 -14
- data/spec/models/entities/opportunity_spec.rb +1 -1
- data/spec/models/fields/custom_field_date_pair_spec.rb +14 -14
- data/spec/models/fields/custom_field_pair_spec.rb +13 -13
- data/spec/models/fields/custom_field_spec.rb +5 -5
- data/spec/models/fields/field_spec.rb +2 -2
- data/spec/models/observers/entity_observer_spec.rb +2 -2
- data/spec/models/users/user_spec.rb +7 -7
- data/spec/routing/comments_routing_spec.rb +0 -9
- data/spec/shared/controllers.rb +75 -77
- data/spec/shared/models.rb +1 -1
- data/spec/spec_helper.rb +1 -2
- data/spec/support/auth_macros.rb +3 -3
- data/spec/support/mail_processor_mocks.rb +13 -13
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/{create.rjs_spec.rb → create.js.haml_spec.rb} +9 -14
- data/spec/views/accounts/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -8
- data/spec/views/accounts/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +10 -18
- data/spec/views/accounts/{index.rjs_spec.rb → index.js.haml_spec.rb} +7 -11
- data/spec/views/accounts/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/accounts/show.haml_spec.rb +1 -1
- data/spec/views/accounts/{update.rjs_spec.rb → update.js.haml_spec.rb} +16 -25
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +31 -0
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +31 -0
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +24 -0
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +25 -0
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +30 -0
- data/spec/views/admin/users/_create.haml_spec.rb +1 -1
- data/spec/views/admin/users/{create.rjs_spec.rb → create.js.haml_spec.rb} +6 -9
- data/spec/views/admin/users/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -7
- data/spec/views/admin/users/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +6 -12
- data/spec/views/admin/users/index.haml_spec.rb +0 -0
- data/spec/views/admin/users/{index.rjs_spec.rb → index.js.haml_spec.rb} +3 -5
- data/spec/views/admin/users/{new.rjs_spec.rb → new.js.haml_spec.rb} +4 -6
- data/spec/views/admin/users/{reactivate.rjs_spec.rb → reactivate.js.haml_spec.rb} +2 -4
- data/spec/views/admin/users/show.haml_spec.rb +0 -0
- data/spec/views/admin/users/{suspend.rjs_spec.rb → suspend.js.haml_spec.rb} +2 -4
- data/spec/views/admin/users/{update.rjs_spec.rb → update.js.haml_spec.rb} +6 -10
- data/spec/views/campaigns/{create.rjs_spec.rb → create.js.haml_spec.rb} +9 -14
- data/spec/views/campaigns/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -7
- data/spec/views/campaigns/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +11 -19
- data/spec/views/campaigns/{index.rjs_spec.rb → index.js.haml_spec.rb} +5 -9
- data/spec/views/campaigns/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/campaigns/{update.rjs_spec.rb → update.js.haml_spec.rb} +14 -21
- data/spec/views/comments/{new.rjs_spec.rb → edit.js.haml_spec.rb} +12 -9
- data/spec/views/contacts/{create.rjs_spec.rb → create.js.haml_spec.rb} +9 -16
- data/spec/views/contacts/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +6 -8
- data/spec/views/contacts/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +12 -19
- data/spec/views/contacts/index.haml_spec.rb +1 -1
- data/spec/views/contacts/{index.rjs_spec.rb → index.js.html_spec.rb} +7 -11
- data/spec/views/contacts/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -7
- data/spec/views/contacts/{update.rjs_spec.rb → update.js.haml_spec.rb} +20 -35
- data/spec/views/home/{index.rjs_spec.rb → index.js.haml_spec.rb} +2 -4
- data/spec/views/home/{options.rjs_spec.rb → options.js.haml_spec.rb} +7 -12
- data/spec/views/leads/{convert.rjs_spec.rb → convert.js.haml_spec.rb} +12 -20
- data/spec/views/leads/{create.rjs_spec.rb → create.js.haml_spec.rb} +13 -19
- data/spec/views/leads/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +9 -12
- data/spec/views/leads/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +12 -20
- data/spec/views/leads/{index.rjs_spec.rb → index.js.haml_spec.rb} +5 -9
- data/spec/views/leads/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/leads/{promote.rjs_spec.rb → promote.js.haml_spec.rb} +28 -43
- data/spec/views/leads/{reject.rjs_spec.rb → reject.js.haml_spec.rb} +10 -17
- data/spec/views/leads/{update.rjs_spec.rb → update.js.haml_spec.rb} +25 -38
- data/spec/views/opportunities/{create.rjs_spec.rb → create.js.haml_spec.rb} +16 -26
- data/spec/views/opportunities/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +13 -16
- data/spec/views/opportunities/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +10 -18
- data/spec/views/opportunities/{index.rjs_spec.rb → index.js.haml_spec.rb} +7 -12
- data/spec/views/opportunities/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/opportunities/{update.rjs_spec.rb → update.js.haml_spec.rb} +29 -46
- data/spec/views/tasks/_edit.haml_spec.rb +1 -1
- data/spec/views/tasks/{complete.rjs_spec.rb → complete.js.haml_spec.rb} +9 -14
- data/spec/views/tasks/{create.rjs_spec.rb → create.js.haml_spec.rb} +25 -33
- data/spec/views/tasks/{destroy.rjs_spec.rb → destroy.js.haml_spec.rb} +9 -11
- data/spec/views/tasks/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +9 -14
- data/spec/views/tasks/index.haml_spec.rb +1 -2
- data/spec/views/tasks/{new.rjs_spec.rb → new.js.haml_spec.rb} +6 -8
- data/spec/views/tasks/{update.rjs_spec.rb → update.js.haml_spec.rb} +28 -41
- data/spec/views/users/{avatar.rjs_spec.rb → avatar.js.haml_spec.rb} +7 -9
- data/spec/views/users/{change_password.rjs_spec.rb → change_password.js.haml_spec.rb} +10 -12
- data/spec/views/users/{edit.rjs_spec.rb → edit.js.haml_spec.rb} +8 -10
- data/spec/views/users/{password.rjs_spec.rb → password.js.haml_spec.rb} +9 -11
- data/spec/views/users/{update.rjs_spec.rb → update.js.haml_spec.rb} +7 -15
- data/spec/views/users/{upload_avatar.rjs_spec.rb → upload_avatar.js.haml_spec.rb} +8 -10
- data/vendor/assets/javascripts/ajax-chosen-jquery.js +2 -0
- data/vendor/assets/javascripts/ajax-chosen-prototype.js +2 -0
- data/vendor/assets/javascripts/ajax-chosen.jquery.coffee +81 -0
- data/vendor/assets/javascripts/ajax-chosen.proto.coffee +98 -0
- data/vendor/assets/javascripts/jquery_timeago/index.js +17 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.cz.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.de.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.en-GB.js +20 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.en-US.js +20 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.es.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.fr-CA.js +17 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.fr.js +17 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.it.js +16 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.ja.js +19 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.js +194 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.pl.js +31 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.pt-BR.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.ru.js +34 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.sv-SE.js +18 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.th.js +20 -0
- data/vendor/assets/javascripts/jquery_timeago/jquery.timeago.zh-CN.js +20 -0
- data/zeus.json +2 -1
- metadata +240 -245
- data/app/assets/images/delete.png +0 -0
- data/app/assets/images/iconset_attribution.png +0 -0
- data/app/views/accounts/create.js.rjs +0 -14
- data/app/views/accounts/destroy.js.rjs +0 -3
- data/app/views/accounts/edit.js.rjs +0 -33
- data/app/views/accounts/index.js.rjs +0 -8
- data/app/views/accounts/new.js.rjs +0 -9
- data/app/views/accounts/show.js.erb +0 -2
- data/app/views/accounts/update.js.rjs +0 -17
- data/app/views/admin/field_groups/confirm.js.rjs +0 -6
- data/app/views/admin/field_groups/create.js.rjs +0 -20
- data/app/views/admin/field_groups/destroy.js.rjs +0 -11
- data/app/views/admin/field_groups/edit.js.rjs +0 -14
- data/app/views/admin/field_groups/new.js.rjs +0 -9
- data/app/views/admin/field_groups/update.js.rjs +0 -9
- data/app/views/admin/fields/create.js.erb +0 -19
- data/app/views/admin/fields/destroy.js.erb +0 -9
- data/app/views/admin/fields/edit.js.erb +0 -1
- data/app/views/admin/fields/update.js.erb +0 -13
- data/app/views/admin/groups/create.js.rjs +0 -11
- data/app/views/admin/groups/destroy.js.rjs +0 -11
- data/app/views/admin/groups/edit.js.rjs +0 -21
- data/app/views/admin/groups/index.js.rjs +0 -2
- data/app/views/admin/groups/new.js.rjs +0 -9
- data/app/views/admin/groups/update.js.rjs +0 -10
- data/app/views/admin/tags/confirm.js.rjs +0 -6
- data/app/views/admin/tags/create.js.rjs +0 -12
- data/app/views/admin/tags/destroy.js.rjs +0 -11
- data/app/views/admin/tags/edit.js.rjs +0 -21
- data/app/views/admin/tags/new.js.rjs +0 -8
- data/app/views/admin/tags/update.js.rjs +0 -10
- data/app/views/admin/users/confirm.js.rjs +0 -6
- data/app/views/admin/users/create.js.rjs +0 -11
- data/app/views/admin/users/destroy.js.rjs +0 -11
- data/app/views/admin/users/edit.js.rjs +0 -21
- data/app/views/admin/users/index.js.rjs +0 -3
- data/app/views/admin/users/new.js.rjs +0 -8
- data/app/views/admin/users/reactivate.js.rjs +0 -3
- data/app/views/admin/users/suspend.js.rjs +0 -3
- data/app/views/admin/users/update.js.rjs +0 -10
- data/app/views/campaigns/create.js.rjs +0 -18
- data/app/views/campaigns/destroy.js.rjs +0 -3
- data/app/views/campaigns/edit.js.rjs +0 -34
- data/app/views/campaigns/index.js.rjs +0 -8
- data/app/views/campaigns/new.js.rjs +0 -9
- data/app/views/campaigns/show.js.erb +0 -2
- data/app/views/campaigns/update.js.rjs +0 -21
- data/app/views/comments/create.js.rjs +0 -11
- data/app/views/comments/destroy.js.rjs +0 -6
- data/app/views/comments/edit.js.rjs +0 -11
- data/app/views/comments/new.js.rjs +0 -14
- data/app/views/comments/update.js.rjs +0 -11
- data/app/views/contacts/create.js.rjs +0 -19
- data/app/views/contacts/destroy.js.rjs +0 -7
- data/app/views/contacts/edit.js.rjs +0 -36
- data/app/views/contacts/index.js.rjs +0 -8
- data/app/views/contacts/new.js.rjs +0 -11
- data/app/views/contacts/show.js.erb +0 -2
- data/app/views/contacts/update.js.rjs +0 -22
- data/app/views/emails/destroy.js.rjs +0 -6
- data/app/views/entities/attach.js.rjs +0 -24
- data/app/views/entities/contacts.js.rjs +0 -3
- data/app/views/entities/discard.js.rjs +0 -7
- data/app/views/entities/leads.js.rjs +0 -3
- data/app/views/entities/opportunities.js.rjs +0 -3
- data/app/views/entities/subscription_update.js.rjs +0 -4
- data/app/views/entities/versions.js.erb +0 -3
- data/app/views/fields/group.js.rjs +0 -7
- data/app/views/home/index.js.rjs +0 -7
- data/app/views/home/options.js.rjs +0 -8
- data/app/views/leads/convert.js.rjs +0 -37
- data/app/views/leads/create.js.rjs +0 -19
- data/app/views/leads/destroy.js.rjs +0 -7
- data/app/views/leads/edit.js.rjs +0 -36
- data/app/views/leads/index.js.rjs +0 -8
- data/app/views/leads/new.js.rjs +0 -9
- data/app/views/leads/promote.js.rjs +0 -27
- data/app/views/leads/reject.js.rjs +0 -10
- data/app/views/leads/show.js.erb +0 -2
- data/app/views/leads/update.js.rjs +0 -27
- data/app/views/lists/create.js.rjs +0 -9
- data/app/views/lists/destroy.js.rjs +0 -1
- data/app/views/opportunities/contacts.js.rjs +0 -3
- data/app/views/opportunities/create.js.rjs +0 -29
- data/app/views/opportunities/destroy.js.rjs +0 -11
- data/app/views/opportunities/edit.js.rjs +0 -36
- data/app/views/opportunities/index.js.rjs +0 -8
- data/app/views/opportunities/new.js.rjs +0 -12
- data/app/views/opportunities/show.js.erb +0 -2
- data/app/views/opportunities/update.js.rjs +0 -26
- data/app/views/tasks/complete.js.rjs +0 -17
- data/app/views/tasks/create.js.rjs +0 -41
- data/app/views/tasks/destroy.js.rjs +0 -7
- data/app/views/tasks/discard.rjs +0 -1
- data/app/views/tasks/edit.js.rjs +0 -23
- data/app/views/tasks/filter.js.rjs +0 -1
- data/app/views/tasks/new.js.rjs +0 -9
- data/app/views/tasks/update.js.rjs +0 -21
- data/app/views/users/avatar.js.rjs +0 -10
- data/app/views/users/change_password.js.rjs +0 -15
- data/app/views/users/edit.js.rjs +0 -10
- data/app/views/users/password.js.rjs +0 -11
- data/app/views/users/update.js.rjs +0 -10
- data/app/views/users/upload_avatar.js.rjs +0 -8
- data/lib/fat_free_crm/secret_token_generator.rb +0 -65
- data/spec/lib/secret_token_generator_spec.rb +0 -79
- data/spec/models/users/abilities/user_ability_spec.rb +0 -58
- data/spec/support/rjs_support.rb +0 -14
- data/vendor/assets/images/brief.png +0 -0
- data/vendor/assets/images/full.png +0 -0
- data/vendor/assets/images/long.png +0 -0
- data/vendor/assets/images/tab_icons/accounts.png +0 -0
- data/vendor/assets/images/tab_icons/accounts_active.png +0 -0
- data/vendor/assets/images/tab_icons/campaigns.png +0 -0
- data/vendor/assets/images/tab_icons/campaigns_active.png +0 -0
- data/vendor/assets/images/tab_icons/contacts.png +0 -0
- data/vendor/assets/images/tab_icons/contacts_active.png +0 -0
- data/vendor/assets/images/tab_icons/dashboard.png +0 -0
- data/vendor/assets/images/tab_icons/dashboard_active.png +0 -0
- data/vendor/assets/images/tab_icons/leads.png +0 -0
- data/vendor/assets/images/tab_icons/leads_active.png +0 -0
- data/vendor/assets/images/tab_icons/opportunities.png +0 -0
- data/vendor/assets/images/tab_icons/opportunities_active.png +0 -0
- data/vendor/assets/images/tab_icons/tasks.png +0 -0
- data/vendor/assets/images/tab_icons/tasks_active.png +0 -0
@@ -22,8 +22,8 @@ describe ApplicationController do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should return [6, 9] when related is 'campaigns/7'" do
|
25
|
-
controller.stub
|
26
|
-
campaign =
|
25
|
+
controller.stub(:controller_name).and_return('opportunities')
|
26
|
+
campaign = double(Campaign, :opportunities => [double(:id => 6), double(:id => 9)])
|
27
27
|
Campaign.should_receive(:find_by_id).with('7').and_return(campaign)
|
28
28
|
controller.send(:auto_complete_ids_to_exclude, 'campaigns/7').sort.should == [6, 9]
|
29
29
|
end
|
@@ -34,8 +34,8 @@ describe ApplicationController do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should return [] when related object association is not found" do
|
37
|
-
controller.stub
|
38
|
-
campaign =
|
37
|
+
controller.stub(:controller_name).and_return('not_a_method_that_exists')
|
38
|
+
campaign = double(Campaign)
|
39
39
|
Campaign.should_receive(:find_by_id).with('7').and_return(campaign)
|
40
40
|
controller.send(:auto_complete_ids_to_exclude, 'campaigns/7').should == []
|
41
41
|
end
|
@@ -34,7 +34,7 @@ describe AuthenticationsController do
|
|
34
34
|
describe "user must not be logged in" do
|
35
35
|
before(:each) do
|
36
36
|
@user = FactoryGirl.create(:user, :username => "user", :password => "pass", :password_confirmation => "pass")
|
37
|
-
@controller.stub
|
37
|
+
@controller.stub(:current_user).and_return(@user)
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "GET authentication (login form)" do
|
@@ -63,18 +63,18 @@ describe AuthenticationsController do
|
|
63
63
|
describe "POST authentications" do
|
64
64
|
before(:each) do
|
65
65
|
@login = { :username => "user", :password => "pass", :remember_me => "0" }
|
66
|
-
@authentication =
|
66
|
+
@authentication = double(Authentication, @login)
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "successful authentication " do
|
70
70
|
before(:each) do
|
71
|
-
@authentication.stub
|
72
|
-
Authentication.stub
|
71
|
+
@authentication.stub(:save).and_return(true)
|
72
|
+
Authentication.stub(:new).and_return(@authentication)
|
73
73
|
end
|
74
74
|
|
75
75
|
it "displays welcome message and redirects to the home page" do
|
76
76
|
@user = FactoryGirl.create(:user, :username => "user", :password => "pass", :password_confirmation => "pass", :login_count => 0)
|
77
|
-
@authentication.stub
|
77
|
+
@authentication.stub(:user).and_return(@user)
|
78
78
|
|
79
79
|
post :create, :authentication => @login
|
80
80
|
flash[:notice].should_not == nil
|
@@ -84,7 +84,7 @@ describe AuthenticationsController do
|
|
84
84
|
|
85
85
|
it "displays last login time if it's not the first login" do
|
86
86
|
@user = FactoryGirl.create(:user, :username => "user", :password => "pass", :password_confirmation => "pass", :login_count => 42)
|
87
|
-
@authentication.stub
|
87
|
+
@authentication.stub(:user).and_return(@user)
|
88
88
|
|
89
89
|
post :create, :authentication => @login
|
90
90
|
flash[:notice].should =~ /last login/
|
@@ -96,9 +96,9 @@ describe AuthenticationsController do
|
|
96
96
|
describe "user is not suspended" do
|
97
97
|
it "redirects to login page if username or password are invalid" do
|
98
98
|
@user = FactoryGirl.create(:user, :username => "user", :password => "pass", :password_confirmation => "pass")
|
99
|
-
@authentication.stub
|
100
|
-
@authentication.stub
|
101
|
-
Authentication.stub
|
99
|
+
@authentication.stub(:user).and_return(@user)
|
100
|
+
@authentication.stub(:save).and_return(false) # <--- Authentication failure.
|
101
|
+
Authentication.stub(:new).and_return(@authentication)
|
102
102
|
|
103
103
|
post :create, :authentication => @login
|
104
104
|
flash[:warning].should_not == nil
|
@@ -108,14 +108,14 @@ describe AuthenticationsController do
|
|
108
108
|
|
109
109
|
describe "user has been suspended" do
|
110
110
|
before(:each) do
|
111
|
-
@authentication.stub
|
112
|
-
Authentication.stub
|
111
|
+
@authentication.stub(:save).and_return(true)
|
112
|
+
Authentication.stub(:new).and_return(@authentication)
|
113
113
|
end
|
114
114
|
|
115
115
|
# This tests :before_save update_info callback in Authentication model.
|
116
116
|
it "keeps user login attributes intact" do
|
117
117
|
@user = FactoryGirl.create(:user, :username => "user", :password => "pass", :password_confirmation => "pass", :suspended_at => Date.yesterday, :login_count => 0, :last_login_at => nil, :last_login_ip => nil)
|
118
|
-
@authentication.stub
|
118
|
+
@authentication.stub(:user).and_return(@user)
|
119
119
|
|
120
120
|
post :create, :authentication => @login
|
121
121
|
@authentication.user.login_count.should == 0
|
@@ -125,7 +125,7 @@ describe AuthenticationsController do
|
|
125
125
|
|
126
126
|
it "redirects to login page if user is suspended" do
|
127
127
|
@user = FactoryGirl.create(:user, :username => "user", :password => "pass", :password_confirmation => "pass", :suspended_at => Date.yesterday)
|
128
|
-
@authentication.stub
|
128
|
+
@authentication.stub(:user).and_return(@user)
|
129
129
|
|
130
130
|
post :create, :authentication => @login
|
131
131
|
flash[:warning].should_not == nil # Invalid username/password.
|
@@ -134,9 +134,9 @@ describe AuthenticationsController do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
it "redirects to login page with the message if signup needs approval and user hasn't been activated yet" do
|
137
|
-
Setting.stub
|
137
|
+
Setting.stub(:user_signup).and_return(:needs_approval)
|
138
138
|
@user = FactoryGirl.create(:user, :username => "user", :password => "pass", :password_confirmation => "pass", :suspended_at => Date.yesterday, :login_count => 0)
|
139
|
-
@authentication.stub
|
139
|
+
@authentication.stub(:user).and_return(@user)
|
140
140
|
|
141
141
|
post :create, :authentication => @login
|
142
142
|
flash[:warning].should == nil # Invalid username/password.
|
@@ -3,7 +3,7 @@
|
|
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 CommentsController do
|
9
9
|
|
@@ -76,84 +76,6 @@ describe CommentsController do
|
|
76
76
|
|
77
77
|
end
|
78
78
|
|
79
|
-
# GET /comments/1
|
80
|
-
# GET /comments/1.xml not implemented
|
81
|
-
#----------------------------------------------------------------------------
|
82
|
-
# describe "responding to GET show" do
|
83
|
-
#
|
84
|
-
# it "should expose the requested comment as @comment" do
|
85
|
-
# Comment.should_receive(:find).with("37").and_return(mock_comment)
|
86
|
-
# get :show, :id => "37"
|
87
|
-
# assigns[:comment].should equal(mock_comment)
|
88
|
-
# end
|
89
|
-
#
|
90
|
-
# describe "with mime type of xml" do
|
91
|
-
# it "should render the requested comment as xml" do
|
92
|
-
# request.env["HTTP_ACCEPT"] = "application/xml"
|
93
|
-
# Comment.should_receive(:find).with("37").and_return(mock_comment)
|
94
|
-
# mock_comment.should_receive(:to_xml).and_return("generated XML")
|
95
|
-
# get :show, :id => "37"
|
96
|
-
# response.body.should == "generated XML"
|
97
|
-
# end
|
98
|
-
# end
|
99
|
-
#
|
100
|
-
# end
|
101
|
-
|
102
|
-
# GET /comments/new
|
103
|
-
# GET /comments/new.xml AJAX
|
104
|
-
#----------------------------------------------------------------------------
|
105
|
-
describe "responding to GET new" do
|
106
|
-
|
107
|
-
COMMENTABLE.each do |asset|
|
108
|
-
it "should expose a new comment as @comment for #{asset}" do
|
109
|
-
@asset = FactoryGirl.create(asset)
|
110
|
-
@comment = Comment.new
|
111
|
-
|
112
|
-
xhr :get, :new, "#{asset}_id".to_sym => @asset.id
|
113
|
-
assigns[:comment].attributes.should == @comment.attributes
|
114
|
-
assigns[:commentable].should == asset.to_s
|
115
|
-
response.should render_template("comments/new")
|
116
|
-
end
|
117
|
-
|
118
|
-
it "should save the fact that a comment gets added to #{asset}" do
|
119
|
-
@asset = FactoryGirl.create(asset)
|
120
|
-
@comment = Comment.new
|
121
|
-
|
122
|
-
xhr :get, :new, "#{asset}_id".to_sym => @asset.id
|
123
|
-
session["#{asset}_new_comment"].should == true
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should clear the session if user cancels a comment for #{asset}" do
|
127
|
-
@asset = FactoryGirl.create(asset)
|
128
|
-
@comment = Comment.new
|
129
|
-
|
130
|
-
xhr :get, :new, "#{asset}_id".to_sym => @asset.id, :cancel => "true"
|
131
|
-
session["#{asset}_new_comment"].should == nil
|
132
|
-
end
|
133
|
-
|
134
|
-
it "should redirect to #{asset}'s index page with the message if the #{asset} got deleted" do
|
135
|
-
@asset = FactoryGirl.create(asset)
|
136
|
-
@asset.destroy
|
137
|
-
@comment = Comment.new
|
138
|
-
|
139
|
-
xhr :get, :new, "#{asset}_id".to_sym => @asset.id
|
140
|
-
flash[:warning].should_not == nil
|
141
|
-
response.body.should =~ %r(window.location.href)m
|
142
|
-
response.body.should =~ %r(#{asset.to_s.pluralize})m
|
143
|
-
end
|
144
|
-
|
145
|
-
it "should redirect to #{asset}'s index page with the message if the #{asset} got protected" do
|
146
|
-
@asset = FactoryGirl.create(asset, :access => "Private")
|
147
|
-
@comment = Comment.new
|
148
|
-
|
149
|
-
xhr :get, :new, "#{asset}_id".to_sym => @asset.id
|
150
|
-
flash[:warning].should_not == nil
|
151
|
-
response.body.should =~ %r(window.location.href)m
|
152
|
-
response.body.should =~ %r(#{asset.to_s.pluralize})m
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
79
|
# GET /comments/1/edit AJAX
|
158
80
|
#----------------------------------------------------------------------------
|
159
81
|
describe "responding to GET edit" do
|
@@ -162,7 +84,7 @@ describe CommentsController do
|
|
162
84
|
it "should expose the requested comment as @commment and render [edit] template" do
|
163
85
|
@asset = FactoryGirl.create(asset)
|
164
86
|
@comment = FactoryGirl.create(:comment, :id => 42, :commentable => @asset, :user => current_user)
|
165
|
-
Comment.stub
|
87
|
+
Comment.stub(:new).and_return(@comment)
|
166
88
|
|
167
89
|
xhr :get, :edit, :id => 42
|
168
90
|
assigns[:comment].should == @comment
|
@@ -182,7 +104,7 @@ describe CommentsController do
|
|
182
104
|
it "should expose a newly created comment as @comment for the #{asset}" do
|
183
105
|
@asset = FactoryGirl.create(asset)
|
184
106
|
@comment = FactoryGirl.build(:comment, :commentable => @asset, :user => current_user)
|
185
|
-
Comment.stub
|
107
|
+
Comment.stub(:new).and_return(@comment)
|
186
108
|
|
187
109
|
xhr :post, :create, :comment => { :commentable_type => asset.to_s.classify, :commentable_id => @asset.id, :user_id => current_user.id, :comment => "Hello" }
|
188
110
|
assigns[:comment].should == @comment
|
@@ -196,7 +118,7 @@ describe CommentsController do
|
|
196
118
|
it "should expose a newly created but unsaved comment as @comment for #{asset}" do
|
197
119
|
@asset = FactoryGirl.create(asset)
|
198
120
|
@comment = FactoryGirl.build(:comment, :commentable => @asset, :user => current_user)
|
199
|
-
Comment.stub
|
121
|
+
Comment.stub(:new).and_return(@comment)
|
200
122
|
|
201
123
|
xhr :post, :create, :comment => {}
|
202
124
|
assigns[:comment].should == @comment
|
@@ -220,13 +142,13 @@ describe CommentsController do
|
|
220
142
|
# end
|
221
143
|
#
|
222
144
|
# it "should expose the requested comment as @comment" do
|
223
|
-
# Comment.stub
|
145
|
+
# Comment.stub(:find).and_return(mock_comment(:update_attributes => true))
|
224
146
|
# put :update, :id => "1"
|
225
147
|
# assigns(:comment).should equal(mock_comment)
|
226
148
|
# end
|
227
149
|
#
|
228
150
|
# it "should redirect to the comment" do
|
229
|
-
# Comment.stub
|
151
|
+
# Comment.stub(:find).and_return(mock_comment(:update_attributes => true))
|
230
152
|
# put :update, :id => "1"
|
231
153
|
# response.should redirect_to(comment_path(mock_comment))
|
232
154
|
# end
|
@@ -240,13 +162,13 @@ describe CommentsController do
|
|
240
162
|
# end
|
241
163
|
#
|
242
164
|
# it "should expose the comment as @comment" do
|
243
|
-
# Comment.stub
|
165
|
+
# Comment.stub(:find).and_return(mock_comment(:update_attributes => false))
|
244
166
|
# put :update, :id => "1"
|
245
167
|
# assigns(:comment).should equal(mock_comment)
|
246
168
|
# end
|
247
169
|
#
|
248
170
|
# it "should re-render the 'edit' template" do
|
249
|
-
# Comment.stub
|
171
|
+
# Comment.stub(:find).and_return(mock_comment(:update_attributes => false))
|
250
172
|
# put :update, :id => "1"
|
251
173
|
# response.should render_template('edit')
|
252
174
|
# end
|
@@ -264,7 +186,7 @@ describe CommentsController do
|
|
264
186
|
it "should destroy the requested comment and render [destroy] template" do
|
265
187
|
@asset = FactoryGirl.create(asset)
|
266
188
|
@comment = FactoryGirl.create(:comment, :commentable => @asset, :user => current_user)
|
267
|
-
Comment.stub
|
189
|
+
Comment.stub(:new).and_return(@comment)
|
268
190
|
|
269
191
|
xhr :delete, :destroy, :id => @comment.id
|
270
192
|
lambda { Comment.find(@comment) }.should raise_error(ActiveRecord::RecordNotFound)
|
@@ -22,7 +22,7 @@ describe EmailsController, "handling GET /emails" do
|
|
22
22
|
it "should destroy the requested email and render [destroy] template" do
|
23
23
|
@asset = FactoryGirl.create(asset)
|
24
24
|
@email = FactoryGirl.create(:email, :mediator => @asset, :user => current_user)
|
25
|
-
Email.stub
|
25
|
+
Email.stub(:new).and_return(@email)
|
26
26
|
|
27
27
|
xhr :delete, :destroy, :id => @email.id
|
28
28
|
lambda { Email.find(@email) }.should raise_error(ActiveRecord::RecordNotFound)
|
@@ -96,7 +96,7 @@ describe AccountsController do
|
|
96
96
|
|
97
97
|
describe "with mime type of JSON" do
|
98
98
|
it "should render all accounts as json" do
|
99
|
-
@controller.should_receive(:get_accounts).and_return(accounts =
|
99
|
+
@controller.should_receive(:get_accounts).and_return(accounts = double("Array of Accounts"))
|
100
100
|
accounts.should_receive(:to_json).and_return("generated JSON")
|
101
101
|
|
102
102
|
request.env["HTTP_ACCEPT"] = "application/json"
|
@@ -107,7 +107,7 @@ describe AccountsController do
|
|
107
107
|
|
108
108
|
describe "with mime type of XML" do
|
109
109
|
it "should render all accounts as xml" do
|
110
|
-
@controller.should_receive(:get_accounts).and_return(accounts =
|
110
|
+
@controller.should_receive(:get_accounts).and_return(accounts = double("Array of Accounts"))
|
111
111
|
accounts.should_receive(:to_xml).and_return("generated XML")
|
112
112
|
|
113
113
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
@@ -304,7 +304,7 @@ describe AccountsController do
|
|
304
304
|
|
305
305
|
it "should expose a newly created account as @account and render [create] template" do
|
306
306
|
@account = FactoryGirl.build(:account, :name => "Hello world", :user => current_user)
|
307
|
-
Account.stub
|
307
|
+
Account.stub(:new).and_return(@account)
|
308
308
|
|
309
309
|
xhr :post, :create, :account => { :name => "Hello world" }
|
310
310
|
assigns(:account).should == @account
|
@@ -314,7 +314,7 @@ describe AccountsController do
|
|
314
314
|
# Note: [Create Account] is shown only on Accounts index page.
|
315
315
|
it "should reload accounts to update pagination" do
|
316
316
|
@account = FactoryGirl.build(:account, :user => current_user)
|
317
|
-
Account.stub
|
317
|
+
Account.stub(:new).and_return(@account)
|
318
318
|
|
319
319
|
xhr :post, :create, :account => { :name => "Hello" }
|
320
320
|
assigns[:accounts].should == [ @account ]
|
@@ -322,7 +322,7 @@ describe AccountsController do
|
|
322
322
|
|
323
323
|
it "should get data to update account sidebar" do
|
324
324
|
@account = FactoryGirl.build(:account, :name => "Hello", :user => current_user)
|
325
|
-
Campaign.stub
|
325
|
+
Campaign.stub(:new).and_return(@account)
|
326
326
|
|
327
327
|
xhr :post, :create, :account => { :name => "Hello" }
|
328
328
|
assigns[:account_category_total].should be_instance_of(HashWithIndifferentAccess)
|
@@ -330,7 +330,7 @@ describe AccountsController do
|
|
330
330
|
|
331
331
|
it "should add a new comment to the newly created account when specified" do
|
332
332
|
@account = FactoryGirl.build(:account, :name => "Hello world", :user => current_user)
|
333
|
-
Account.stub
|
333
|
+
Account.stub(:new).and_return(@account)
|
334
334
|
|
335
335
|
xhr :post, :create, :account => { :name => "Hello world" }, :comment_body => "Awesome comment is awesome"
|
336
336
|
assigns[:account].comments.map(&:comment).should include("Awesome comment is awesome")
|
@@ -340,7 +340,7 @@ describe AccountsController do
|
|
340
340
|
describe "with invalid params" do
|
341
341
|
it "should expose a newly created but unsaved account as @account and still render [create] template" do
|
342
342
|
@account = FactoryGirl.build(:account, :name => nil, :user => nil)
|
343
|
-
Account.stub
|
343
|
+
Account.stub(:new).and_return(@account)
|
344
344
|
|
345
345
|
xhr :post, :create, :account => {}
|
346
346
|
assigns(:account).should == @account
|
@@ -306,7 +306,7 @@ describe CampaignsController do
|
|
306
306
|
|
307
307
|
it "should expose a newly created campaign as @campaign and render [create] template" do
|
308
308
|
@campaign = FactoryGirl.build(:campaign, :name => "Hello", :user => current_user)
|
309
|
-
Campaign.stub
|
309
|
+
Campaign.stub(:new).and_return(@campaign)
|
310
310
|
|
311
311
|
xhr :post, :create, :campaign => { :name => "Hello" }
|
312
312
|
assigns(:campaign).should == @campaign
|
@@ -315,7 +315,7 @@ describe CampaignsController do
|
|
315
315
|
|
316
316
|
it "should get data to update campaign sidebar" do
|
317
317
|
@campaign = FactoryGirl.build(:campaign, :name => "Hello", :user => current_user)
|
318
|
-
Campaign.stub
|
318
|
+
Campaign.stub(:new).and_return(@campaign)
|
319
319
|
|
320
320
|
xhr :post, :create, :campaign => { :name => "Hello" }
|
321
321
|
assigns[:campaign_status_total].should be_instance_of(HashWithIndifferentAccess)
|
@@ -323,7 +323,7 @@ describe CampaignsController do
|
|
323
323
|
|
324
324
|
it "should reload campaigns to update pagination" do
|
325
325
|
@campaign = FactoryGirl.build(:campaign, :user => current_user)
|
326
|
-
Campaign.stub
|
326
|
+
Campaign.stub(:new).and_return(@campaign)
|
327
327
|
|
328
328
|
xhr :post, :create, :campaign => { :name => "Hello" }
|
329
329
|
assigns[:campaigns].should == [ @campaign ]
|
@@ -331,7 +331,7 @@ describe CampaignsController do
|
|
331
331
|
|
332
332
|
it "should add a new comment to the newly created campaign when specified" do
|
333
333
|
@campaign = FactoryGirl.build(:campaign, :name => "Hello world", :user => current_user)
|
334
|
-
Campaign.stub
|
334
|
+
Campaign.stub(:new).and_return(@campaign)
|
335
335
|
|
336
336
|
xhr :post, :create, :campaign => { :name => "Hello world" }, :comment_body => "Awesome comment is awesome"
|
337
337
|
@campaign.reload.comments.map(&:comment).should include("Awesome comment is awesome")
|
@@ -342,7 +342,7 @@ describe CampaignsController do
|
|
342
342
|
|
343
343
|
it "should expose a newly created but unsaved campaign as @campaign and still render [create] template" do
|
344
344
|
@campaign = FactoryGirl.build(:campaign, :id => nil, :name => nil, :user => current_user)
|
345
|
-
Campaign.stub
|
345
|
+
Campaign.stub(:new).and_return(@campaign)
|
346
346
|
|
347
347
|
xhr :post, :create, :campaign => nil
|
348
348
|
assigns(:campaign).should == @campaign
|
@@ -70,7 +70,7 @@ describe ContactsController do
|
|
70
70
|
|
71
71
|
describe "with mime type of JSON" do
|
72
72
|
it "should render all contacts as JSON" do
|
73
|
-
@controller.should_receive(:get_contacts).and_return(contacts =
|
73
|
+
@controller.should_receive(:get_contacts).and_return(contacts = double("Array of Contacts"))
|
74
74
|
contacts.should_receive(:to_json).and_return("generated JSON")
|
75
75
|
|
76
76
|
request.env["HTTP_ACCEPT"] = "application/json"
|
@@ -81,7 +81,7 @@ describe ContactsController do
|
|
81
81
|
|
82
82
|
describe "with mime type of XML" do
|
83
83
|
it "should render all contacts as xml" do
|
84
|
-
@controller.should_receive(:get_contacts).and_return(contacts =
|
84
|
+
@controller.should_receive(:get_contacts).and_return(contacts = double("Array of Contacts"))
|
85
85
|
contacts.should_receive(:to_xml).and_return("generated XML")
|
86
86
|
|
87
87
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
@@ -303,7 +303,7 @@ describe ContactsController do
|
|
303
303
|
|
304
304
|
it "should expose a newly created contact as @contact and render [create] template" do
|
305
305
|
@contact = FactoryGirl.build(:contact, :first_name => "Billy", :last_name => "Bones")
|
306
|
-
Contact.stub
|
306
|
+
Contact.stub(:new).and_return(@contact)
|
307
307
|
|
308
308
|
xhr :post, :create, :contact => { :first_name => "Billy", :last_name => "Bones" }, :account => { :name => "Hello world" }
|
309
309
|
assigns(:contact).should == @contact
|
@@ -314,7 +314,7 @@ describe ContactsController do
|
|
314
314
|
it "should be able to associate newly created contact with the opportunity" do
|
315
315
|
@opportunity = FactoryGirl.create(:opportunity, :id => 987);
|
316
316
|
@contact = FactoryGirl.build(:contact)
|
317
|
-
Contact.stub
|
317
|
+
Contact.stub(:new).and_return(@contact)
|
318
318
|
|
319
319
|
xhr :post, :create, :contact => { :first_name => "Billy"}, :account => {}, :opportunity => 987
|
320
320
|
assigns(:contact).opportunities.should include(@opportunity)
|
@@ -323,7 +323,7 @@ describe ContactsController do
|
|
323
323
|
|
324
324
|
it "should reload contacts to update pagination if called from contacts index" do
|
325
325
|
@contact = FactoryGirl.build(:contact, :user => current_user)
|
326
|
-
Contact.stub
|
326
|
+
Contact.stub(:new).and_return(@contact)
|
327
327
|
|
328
328
|
request.env["HTTP_REFERER"] = "http://localhost/contacts"
|
329
329
|
xhr :post, :create, :contact => { :first_name => "Billy", :last_name => "Bones" }, :account => {}
|
@@ -332,7 +332,7 @@ describe ContactsController do
|
|
332
332
|
|
333
333
|
it "should add a new comment to the newly created contact when specified" do
|
334
334
|
@contact = FactoryGirl.build(:contact, :user => current_user)
|
335
|
-
Contact.stub
|
335
|
+
Contact.stub(:new).and_return(@contact)
|
336
336
|
|
337
337
|
xhr :post, :create, :contact => { :first_name => "Testy", :last_name => "McTest" }, :account => { :name => "Hello world" }, :comment_body => "Awesome comment is awesome"
|
338
338
|
assigns[:contact].comments.map(&:comment).should include("Awesome comment is awesome")
|
@@ -343,7 +343,7 @@ describe ContactsController do
|
|
343
343
|
|
344
344
|
before(:each) do
|
345
345
|
@contact = FactoryGirl.build(:contact, :first_name => nil, :user => current_user, :lead => nil)
|
346
|
-
Contact.stub
|
346
|
+
Contact.stub(:new).and_return(@contact)
|
347
347
|
end
|
348
348
|
|
349
349
|
# Redraw [create] form with selected account.
|
@@ -95,7 +95,7 @@ describe LeadsController do
|
|
95
95
|
|
96
96
|
describe "with mime type of JSON" do
|
97
97
|
it "should render all leads as JSON" do
|
98
|
-
@controller.should_receive(:get_leads).and_return(leads =
|
98
|
+
@controller.should_receive(:get_leads).and_return(leads = double("Array of Leads"))
|
99
99
|
leads.should_receive(:to_json).and_return("generated JSON")
|
100
100
|
|
101
101
|
request.env["HTTP_ACCEPT"] = "application/json"
|
@@ -106,7 +106,7 @@ describe LeadsController do
|
|
106
106
|
|
107
107
|
describe "with mime type of XML" do
|
108
108
|
it "should render all leads as xml" do
|
109
|
-
@controller.should_receive(:get_leads).and_return(leads =
|
109
|
+
@controller.should_receive(:get_leads).and_return(leads = double("Array of Leads"))
|
110
110
|
leads.should_receive(:to_xml).and_return("generated XML")
|
111
111
|
|
112
112
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
@@ -210,7 +210,7 @@ describe LeadsController do
|
|
210
210
|
|
211
211
|
it "should expose a new lead as @lead and render [new] template" do
|
212
212
|
@lead = FactoryGirl.build(:lead, :user => current_user, :campaign => nil)
|
213
|
-
Lead.stub
|
213
|
+
Lead.stub(:new).and_return(@lead)
|
214
214
|
@campaigns = [ FactoryGirl.create(:campaign, :user => current_user) ]
|
215
215
|
|
216
216
|
xhr :get, :new
|
@@ -322,7 +322,7 @@ describe LeadsController do
|
|
322
322
|
|
323
323
|
it "should expose a newly created lead as @lead and render [create] template" do
|
324
324
|
@lead = FactoryGirl.build(:lead, :user => current_user, :campaign => nil)
|
325
|
-
Lead.stub
|
325
|
+
Lead.stub(:new).and_return(@lead)
|
326
326
|
@campaigns = [ FactoryGirl.create(:campaign, :user => current_user) ]
|
327
327
|
|
328
328
|
xhr :post, :create, :lead => { :first_name => "Billy", :last_name => "Bones" }
|
@@ -341,7 +341,7 @@ describe LeadsController do
|
|
341
341
|
@campaign.save
|
342
342
|
|
343
343
|
@lead = FactoryGirl.build(:lead, :campaign => @campaign, :user => current_user, :access => "Shared")
|
344
|
-
Lead.stub
|
344
|
+
Lead.stub(:new).and_return(@lead)
|
345
345
|
|
346
346
|
xhr :post, :create, :lead => { :first_name => "Billy", :last_name => "Bones", :access => "Campaign", :user_ids => %w(7 8) }, :campaign => @campaign.id
|
347
347
|
assigns(:lead).should == @lead
|
@@ -353,7 +353,7 @@ describe LeadsController do
|
|
353
353
|
|
354
354
|
it "should get the data to update leads sidebar if called from leads index" do
|
355
355
|
@lead = FactoryGirl.build(:lead, :user => current_user, :campaign => nil)
|
356
|
-
Lead.stub
|
356
|
+
Lead.stub(:new).and_return(@lead)
|
357
357
|
|
358
358
|
request.env["HTTP_REFERER"] = "http://localhost/leads"
|
359
359
|
xhr :post, :create, :lead => { :first_name => "Billy", :last_name => "Bones" }
|
@@ -362,7 +362,7 @@ describe LeadsController do
|
|
362
362
|
|
363
363
|
it "should reload leads to update pagination if called from leads index" do
|
364
364
|
@lead = FactoryGirl.build(:lead, :user => current_user, :campaign => nil)
|
365
|
-
Lead.stub
|
365
|
+
Lead.stub(:new).and_return(@lead)
|
366
366
|
|
367
367
|
request.env["HTTP_REFERER"] = "http://localhost/leads"
|
368
368
|
xhr :post, :create, :lead => { :first_name => "Billy", :last_name => "Bones" }
|
@@ -380,7 +380,7 @@ describe LeadsController do
|
|
380
380
|
|
381
381
|
it "should add a new comment to the newly created lead when specified" do
|
382
382
|
@lead = FactoryGirl.create(:lead)
|
383
|
-
Lead.stub
|
383
|
+
Lead.stub(:new).and_return(@lead)
|
384
384
|
xhr :post, :create, :lead => { :first_name => "Test", :last_name => "Lead" }, :comment_body => "This is an important lead."
|
385
385
|
@lead.reload.comments.map(&:comment).should include("This is an important lead.")
|
386
386
|
end
|
@@ -390,7 +390,7 @@ describe LeadsController do
|
|
390
390
|
|
391
391
|
it "should expose a newly created but unsaved lead as @lead and still render [create] template" do
|
392
392
|
@lead = FactoryGirl.build(:lead, :user => current_user, :first_name => nil, :campaign => nil)
|
393
|
-
Lead.stub
|
393
|
+
Lead.stub(:new).and_return(@lead)
|
394
394
|
@campaigns = [ FactoryGirl.create(:campaign, :user => current_user) ]
|
395
395
|
|
396
396
|
xhr :post, :create, :lead => { :first_name => nil }
|
@@ -730,9 +730,9 @@ describe LeadsController do
|
|
730
730
|
@account = FactoryGirl.create(:account, :id => 123, :user => current_user)
|
731
731
|
@opportunity = FactoryGirl.build(:opportunity, :user => current_user, :campaign => @lead.campaign,
|
732
732
|
:account => @account)
|
733
|
-
Opportunity.stub
|
733
|
+
Opportunity.stub(:new).and_return(@opportunity)
|
734
734
|
@contact = FactoryGirl.build(:contact, :user => current_user, :lead => @lead)
|
735
|
-
Contact.stub
|
735
|
+
Contact.stub(:new).and_return(@contact)
|
736
736
|
|
737
737
|
xhr :put, :promote, :id => 42, :account => { :id => 123 }, :opportunity => { :name => "Hello" }
|
738
738
|
@lead.reload.status.should == "converted"
|
@@ -755,11 +755,11 @@ describe LeadsController do
|
|
755
755
|
@account = FactoryGirl.build(:account, :user => current_user, :access => "Shared")
|
756
756
|
@account.permissions << FactoryGirl.create(:permission, :user => he, :asset => @account)
|
757
757
|
@account.permissions << FactoryGirl.create(:permission, :user => she, :asset => @account)
|
758
|
-
@account.stub
|
758
|
+
@account.stub(:new).and_return(@account)
|
759
759
|
@opportunity = FactoryGirl.build(:opportunity, :user => current_user, :access => "Shared")
|
760
760
|
@opportunity.permissions << FactoryGirl.create(:permission, :user => he, :asset => @opportunity)
|
761
761
|
@opportunity.permissions << FactoryGirl.create(:permission, :user => she, :asset => @opportunity)
|
762
|
-
@opportunity.stub
|
762
|
+
@opportunity.stub(:new).and_return(@opportunity)
|
763
763
|
|
764
764
|
xhr :put, :promote, :id => @lead.id, :access => "Lead", :account => { :name => "Hello", :access => "Lead", :user_id => current_user.id }, :opportunity => { :name => "World", :access => "Lead", :user_id => current_user.id }
|
765
765
|
@account.access.should == "Shared"
|
@@ -809,7 +809,7 @@ describe LeadsController do
|
|
809
809
|
@lead = FactoryGirl.create(:lead, :id => 42, :user => current_user, :status => "new")
|
810
810
|
@account = FactoryGirl.create(:account, :id => 123, :user => current_user)
|
811
811
|
@contact = FactoryGirl.build(:contact, :first_name => nil) # make it fail
|
812
|
-
Contact.stub
|
812
|
+
Contact.stub(:new).and_return(@contact)
|
813
813
|
|
814
814
|
xhr :put, :promote, :id => 42, :account => { :id => 123 }
|
815
815
|
@lead.reload.status.should == "new"
|