fat_free_crm 0.17.2 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fat_free_crm might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +71 -148
- data/.travis.yml +35 -14
- data/CHANGELOG.md +88 -5
- data/CONTRIBUTORS.md +96 -53
- data/Dockerfile +45 -14
- data/Gemfile +23 -13
- data/Gemfile.lock +249 -241
- data/Procfile +1 -1
- data/README.md +9 -6
- data/Rakefile +1 -1
- data/app/assets/javascripts/crm.js.coffee +3 -3
- data/app/assets/javascripts/crm_select2.js.coffee +15 -14
- data/app/assets/stylesheets/common.scss +1 -1
- data/app/controllers/admin/application_controller.rb +1 -1
- data/app/controllers/admin/field_groups_controller.rb +9 -4
- data/app/controllers/admin/fields_controller.rb +4 -4
- data/app/controllers/admin/groups_controller.rb +1 -1
- data/app/controllers/admin/tags_controller.rb +2 -4
- data/app/controllers/admin/users_controller.rb +5 -8
- data/app/controllers/application_controller.rb +22 -45
- data/app/controllers/comments_controller.rb +16 -11
- data/{config/initializers/authlogic.rb → app/controllers/confirmations_controller.rb} +4 -2
- data/app/controllers/emails_controller.rb +0 -2
- data/app/controllers/entities/accounts_controller.rb +1 -3
- data/app/controllers/entities/campaigns_controller.rb +8 -5
- data/app/controllers/entities/contacts_controller.rb +4 -24
- data/app/controllers/entities/leads_controller.rb +16 -12
- data/app/controllers/entities/opportunities_controller.rb +17 -16
- data/app/controllers/entities_controller.rb +31 -12
- data/app/controllers/home_controller.rb +2 -4
- data/app/controllers/lists_controller.rb +5 -1
- data/app/controllers/passwords_controller.rb +3 -59
- data/{spec/features/support/maintain_sessions.rb → app/controllers/registrations_controller.rb} +12 -5
- data/{lib/development_tasks/gem.rake → app/controllers/sessions_controller.rb} +6 -6
- data/app/controllers/tasks_controller.rb +22 -17
- data/app/controllers/users_controller.rb +8 -29
- data/app/helpers/accounts_helper.rb +1 -1
- data/app/helpers/admin/users_helper.rb +1 -1
- data/app/helpers/application_helper.rb +28 -33
- data/app/helpers/campaigns_helper.rb +1 -1
- data/app/helpers/contacts_helper.rb +1 -3
- data/app/helpers/leads_helper.rb +1 -1
- data/app/helpers/opportunities_helper.rb +48 -3
- data/app/helpers/tags_helper.rb +1 -1
- data/app/helpers/tasks_helper.rb +1 -1
- data/app/helpers/users_helper.rb +1 -3
- data/{config/initializers/paper_trail.rb → app/mailers/devise_mailer.rb} +5 -1
- data/app/mailers/user_mailer.rb +0 -9
- data/app/models/entities/account.rb +10 -10
- data/app/models/entities/campaign.rb +4 -6
- data/app/models/entities/contact.rb +24 -12
- data/app/models/entities/lead.rb +7 -14
- data/app/models/entities/opportunity.rb +10 -11
- data/app/models/fields/custom_field.rb +1 -0
- data/app/models/fields/custom_field_date_pair.rb +2 -0
- data/app/models/fields/field.rb +1 -3
- data/app/models/list.rb +1 -1
- data/app/models/observers/entity_observer.rb +3 -7
- data/app/models/observers/lead_observer.rb +2 -4
- data/app/models/observers/opportunity_observer.rb +5 -7
- data/app/models/observers/task_observer.rb +1 -1
- data/app/models/polymorphic/email.rb +2 -2
- data/app/models/polymorphic/task.rb +13 -9
- data/app/models/polymorphic/version.rb +3 -2
- data/app/models/setting.rb +2 -0
- data/app/models/users/ability.rb +3 -4
- data/app/models/users/permission.rb +3 -3
- data/app/models/users/preference.rb +2 -1
- data/app/models/users/user.rb +67 -42
- data/app/views/accounts/_top_section.html.haml +1 -1
- data/app/views/accounts/edit.js.haml +1 -1
- data/app/views/accounts/update.js.haml +2 -2
- data/app/views/admin/users/_user.html.haml +4 -4
- data/app/views/campaigns/_metrics.html.haml +3 -3
- data/app/views/contacts/_index_brief.html.haml +1 -1
- data/app/views/contacts/_index_full.html.haml +1 -1
- data/app/views/contacts/_index_long.html.haml +1 -1
- data/app/views/devise/confirmations/new.html.haml +9 -0
- data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
- data/app/views/devise/mailer/password_change.html.haml +3 -0
- data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
- data/app/views/devise/passwords/edit.html.haml +18 -0
- data/app/views/devise/passwords/new.html.haml +10 -0
- data/app/views/devise/registrations/new.html.haml +21 -0
- data/app/views/devise/sessions/new.html.haml +32 -0
- data/app/views/home/_opportunity.html.haml +4 -19
- data/app/views/layouts/_about.html.haml +5 -5
- data/app/views/layouts/_header.html.haml +3 -3
- data/app/views/layouts/admin/_header.html.haml +1 -1
- data/app/views/opportunities/_index_long.html.haml +1 -24
- data/app/views/opportunities/_sidebar_show.html.haml +3 -3
- data/app/views/opportunities/_top_section.html.haml +1 -1
- data/app/views/shared/_address.html.haml +5 -5
- data/app/views/shared/_paginate_with_per_page.html.haml +1 -0
- data/app/views/users/_avatar.html.haml +1 -1
- data/bin/bundle +1 -1
- data/bin/rails +1 -1
- data/bin/setup +38 -0
- data/bin/update +33 -0
- data/bin/yarn +13 -0
- data/config/application.rb +8 -6
- data/config/boot.rb +1 -1
- data/config/brakeman.ignore +2 -2
- data/config/database.postgres.docker.yml +5 -5
- data/config/environment.rb +1 -1
- data/config/environments/development.rb +1 -0
- data/config/environments/test.rb +7 -0
- data/config/initializers/action_mailer.rb +1 -3
- data/config/initializers/application_controller_renderer.rb +9 -0
- data/config/initializers/assets.rb +6 -11
- data/config/initializers/backtrace_silencers.rb +0 -6
- data/config/initializers/content_security_policy.rb +26 -0
- data/config/initializers/cookies_serializer.rb +3 -6
- data/config/initializers/devise.rb +289 -0
- data/config/initializers/filter_parameter_logging.rb +0 -5
- data/config/initializers/gravatar.rb +0 -1
- data/config/initializers/inflections.rb +0 -6
- data/config/initializers/mime_types.rb +1 -9
- data/config/initializers/new_framework_defaults_5_2.rb +40 -0
- data/config/initializers/relative_url_root.rb +1 -3
- data/config/initializers/session_store.rb +1 -3
- data/config/initializers/wrap_parameters.rb +4 -9
- data/config/locales/fat_free_crm.en-GB.yml +5 -5
- data/config/locales/fat_free_crm.en-US.yml +5 -5
- data/config/locales/fat_free_crm.fr.yml +1 -1
- data/config/locales/fat_free_crm.ru.yml +1 -0
- data/config/routes.rb +20 -9
- data/db/demo/users.yml +62 -81
- data/db/migrate/20100928030620_remove_uuid.rb +1 -2
- data/db/migrate/20120316045804_activities_to_versions.rb +1 -0
- data/db/migrate/20120510025219_add_not_null_constraints_for_timestamp_columns.rb +1 -0
- data/db/migrate/20180107082701_authlogic_to_devise.rb +58 -0
- data/db/schema.rb +48 -46
- data/docker-compose.yml +10 -0
- data/fat_free_crm.gemspec +12 -14
- data/lib/development_tasks/license.rake +2 -2
- data/lib/fat_free_crm/callback.rb +2 -2
- data/lib/fat_free_crm/comment_extensions.rb +2 -4
- data/lib/fat_free_crm/core_ext/string.rb +1 -1
- data/lib/fat_free_crm/engine.rb +2 -2
- data/lib/fat_free_crm/errors.rb +1 -1
- data/lib/fat_free_crm/export_csv.rb +1 -0
- data/lib/fat_free_crm/exportable.rb +1 -1
- data/lib/fat_free_crm/fields.rb +2 -2
- data/lib/fat_free_crm/gem_dependencies.rb +1 -1
- data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +1 -3
- data/lib/fat_free_crm/i18n.rb +2 -2
- data/lib/fat_free_crm/mail_processor/base.rb +4 -10
- data/lib/fat_free_crm/mail_processor/dropbox.rb +5 -15
- data/lib/fat_free_crm/permissions.rb +7 -18
- data/lib/fat_free_crm/sortable.rb +1 -1
- data/lib/fat_free_crm/tabs.rb +2 -2
- data/lib/fat_free_crm/version.rb +2 -2
- data/lib/gravatar_image_tag.rb +7 -8
- data/lib/missing_translation_detector.rb +1 -0
- data/lib/tasks/ffcrm/missing_translations.rake +1 -0
- data/lib/tasks/ffcrm/setup.rake +13 -4
- data/lib/tasks/ffcrm/update_data.rake +2 -2
- data/script/rails +2 -2
- data/spec/controllers/admin/users_controller_spec.rb +25 -81
- data/spec/controllers/comments_controller_spec.rb +19 -19
- data/spec/controllers/emails_controller_spec.rb +2 -2
- data/spec/controllers/entities/accounts_controller_spec.rb +56 -56
- data/spec/controllers/entities/campaigns_controller_spec.rb +66 -66
- data/spec/controllers/entities/contacts_controller_spec.rb +69 -68
- data/spec/controllers/entities/leads_controller_spec.rb +126 -126
- data/spec/controllers/entities/opportunities_controller_spec.rb +101 -101
- data/spec/controllers/entities_controller_spec.rb +5 -0
- data/spec/controllers/home_controller_spec.rb +30 -30
- data/spec/controllers/tasks_controller_spec.rb +42 -40
- data/spec/controllers/users_controller_spec.rb +43 -113
- data/spec/factories/account_factories.rb +13 -13
- data/spec/factories/campaign_factories.rb +8 -8
- data/spec/factories/contact_factories.rb +18 -18
- data/spec/factories/field_factories.rb +11 -10
- data/spec/factories/lead_factories.rb +13 -13
- data/spec/factories/list_factories.rb +3 -3
- data/spec/factories/opportunity_factories.rb +9 -9
- data/spec/factories/sequences.rb +1 -1
- data/spec/factories/setting_factories.rb +5 -5
- data/spec/factories/shared_factories.rb +25 -23
- data/spec/factories/subscription_factories.rb +1 -1
- data/spec/factories/tag_factories.rb +1 -1
- data/spec/factories/task_factories.rb +11 -11
- data/spec/factories/user_factories.rb +27 -30
- data/spec/features/accounts_spec.rb +17 -4
- data/spec/features/admin/groups_spec.rb +2 -2
- data/spec/features/admin/users_spec.rb +4 -2
- data/spec/features/campaigns_spec.rb +5 -5
- data/spec/features/contacts_spec.rb +11 -5
- data/spec/features/dashboard_spec.rb +8 -8
- data/spec/features/devise/sign_in_spec.rb +58 -0
- data/spec/features/devise/sign_up_spec.rb +36 -0
- data/spec/features/leads_spec.rb +5 -5
- data/spec/features/opportunities_overview_spec.rb +16 -16
- data/spec/features/opportunities_spec.rb +35 -9
- data/spec/features/support/autocomlete_helper.rb +17 -0
- data/spec/features/support/browser.rb +5 -9
- data/spec/features/tasks_spec.rb +5 -5
- data/spec/helpers/admin/field_groups_helper_spec.rb +1 -1
- data/spec/helpers/application_helper_spec.rb +1 -1
- data/spec/helpers/tasks_helper_spec.rb +1 -1
- data/spec/helpers/users_helper_spec.rb +7 -7
- data/spec/lib/comment_extensions_spec.rb +11 -5
- data/spec/lib/errors_spec.rb +2 -2
- data/spec/lib/mail_processor/base_spec.rb +3 -3
- data/spec/lib/mail_processor/comment_replies_spec.rb +3 -3
- data/spec/lib/mail_processor/dropbox_spec.rb +17 -17
- data/spec/lib/mail_processor/sample_emails/dropbox.rb +8 -8
- data/spec/lib/permissions_spec.rb +15 -28
- data/spec/mailers/devise_mailer_spec.rb +35 -0
- data/spec/mailers/user_mailer_spec.rb +6 -32
- data/spec/models/entities/account_spec.rb +58 -32
- data/spec/models/entities/campaign_spec.rb +18 -25
- data/spec/models/entities/contact_spec.rb +113 -21
- data/spec/models/entities/lead_spec.rb +9 -11
- data/spec/models/entities/opportunity_spec.rb +45 -45
- data/spec/models/fields/custom_field_date_pair_spec.rb +4 -2
- data/spec/models/fields/custom_field_spec.rb +21 -19
- data/spec/models/list_spec.rb +2 -2
- data/spec/models/observers/entity_observer_spec.rb +7 -7
- data/spec/models/polymorphic/address_spec.rb +1 -1
- data/spec/models/polymorphic/avatar_spec.rb +5 -5
- data/spec/models/polymorphic/comment_spec.rb +5 -5
- data/spec/models/polymorphic/task_spec.rb +65 -58
- data/spec/models/polymorphic/version_spec.rb +31 -31
- data/spec/models/setting_spec.rb +2 -2
- data/spec/models/users/preference_spec.rb +6 -6
- data/spec/models/users/user_spec.rb +46 -50
- data/spec/routing/users_routing_spec.rb +30 -8
- data/spec/shared/controllers.rb +3 -9
- data/spec/shared/models.rb +22 -22
- data/spec/spec_helper.rb +12 -4
- data/spec/support/assert_select.rb +1 -0
- data/spec/support/devise_helpers.rb +28 -0
- data/spec/{features/support/helpers.rb → support/feature_helpers.rb} +11 -11
- data/spec/support/macros.rb +7 -4
- data/spec/views/accounts/_edit.haml_spec.rb +1 -1
- data/spec/views/accounts/create.js.haml_spec.rb +2 -2
- data/spec/views/accounts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/accounts/edit.js.haml_spec.rb +2 -2
- data/spec/views/accounts/index.haml_spec.rb +2 -2
- data/spec/views/accounts/index.js.haml_spec.rb +1 -1
- data/spec/views/accounts/show.haml_spec.rb +4 -4
- data/spec/views/accounts/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/create.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/destroy.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/edit.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/new.js.haml_spec.rb +1 -1
- data/spec/views/admin/field_groups/update.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/create.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/destroy.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/edit.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/index.haml_spec.rb +1 -1
- data/spec/views/admin/users/index.js.haml_spec.rb +2 -2
- data/spec/views/admin/users/reactivate.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/suspend.js.haml_spec.rb +1 -1
- data/spec/views/admin/users/update.js.haml_spec.rb +1 -1
- data/spec/views/application/auto_complete.haml_spec.rb +3 -3
- data/spec/views/campaigns/_edit.haml_spec.rb +1 -1
- data/spec/views/campaigns/create.js.haml_spec.rb +3 -3
- data/spec/views/campaigns/destroy.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/edit.js.haml_spec.rb +2 -2
- data/spec/views/campaigns/index.haml_spec.rb +1 -1
- data/spec/views/campaigns/index.js.haml_spec.rb +1 -1
- data/spec/views/campaigns/show.haml_spec.rb +4 -4
- data/spec/views/campaigns/update.js.haml_spec.rb +1 -1
- data/spec/views/contacts/_edit.haml_spec.rb +7 -7
- data/spec/views/contacts/_new.haml_spec.rb +1 -1
- data/spec/views/contacts/create.js.haml_spec.rb +4 -4
- data/spec/views/contacts/destroy.js.haml_spec.rb +1 -1
- data/spec/views/contacts/edit.js.haml_spec.rb +3 -3
- data/spec/views/contacts/index.haml_spec.rb +1 -1
- data/spec/views/contacts/index.js.html_spec.rb +1 -1
- data/spec/views/contacts/new.js.haml_spec.rb +1 -1
- data/spec/views/contacts/show.haml_spec.rb +3 -3
- data/spec/views/contacts/update.js.haml_spec.rb +3 -3
- data/spec/views/home/index.haml_spec.rb +1 -1
- data/spec/views/home/index.js.haml_spec.rb +1 -1
- data/spec/views/home/options.js.haml_spec.rb +2 -2
- data/spec/views/leads/_convert.haml_spec.rb +3 -3
- data/spec/views/leads/_edit.haml_spec.rb +2 -2
- data/spec/views/leads/_new.haml_spec.rb +2 -2
- data/spec/views/leads/_sidebar_show.haml_spec.rb +5 -5
- data/spec/views/leads/convert.js.haml_spec.rb +4 -4
- data/spec/views/leads/create.js.haml_spec.rb +5 -5
- data/spec/views/leads/destroy.js.haml_spec.rb +2 -2
- data/spec/views/leads/edit.js.haml_spec.rb +4 -4
- data/spec/views/leads/index.haml_spec.rb +1 -1
- data/spec/views/leads/index.js.haml_spec.rb +1 -1
- data/spec/views/leads/new.js.haml_spec.rb +1 -1
- data/spec/views/leads/promote.js.haml_spec.rb +7 -7
- data/spec/views/leads/reject.js.haml_spec.rb +2 -2
- data/spec/views/leads/show.haml_spec.rb +2 -2
- data/spec/views/leads/update.js.haml_spec.rb +4 -4
- data/spec/views/opportunities/_edit.haml_spec.rb +7 -7
- data/spec/views/opportunities/_new.haml_spec.rb +2 -2
- data/spec/views/opportunities/create.js.haml_spec.rb +6 -6
- data/spec/views/opportunities/destroy.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/edit.js.haml_spec.rb +3 -3
- data/spec/views/opportunities/index.haml_spec.rb +1 -1
- data/spec/views/opportunities/index.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/new.js.haml_spec.rb +1 -1
- data/spec/views/opportunities/show.haml_spec.rb +3 -3
- data/spec/views/opportunities/update.js.haml_spec.rb +5 -5
- data/spec/views/tasks/_edit.haml_spec.rb +1 -1
- data/spec/views/tasks/complete.js.haml_spec.rb +4 -4
- data/spec/views/tasks/create.js.haml_spec.rb +6 -6
- data/spec/views/tasks/destroy.js.haml_spec.rb +2 -2
- data/spec/views/tasks/index.haml_spec.rb +4 -4
- data/spec/views/tasks/new.js.haml_spec.rb +1 -1
- data/spec/views/tasks/uncomplete.js.haml_spec.rb +2 -2
- data/spec/views/tasks/update.js.haml_spec.rb +18 -18
- data/spec/views/users/upload_avatar.js.haml_spec.rb +2 -2
- data/vendor/gems/ransack_ui-1.3.4/.gitignore +17 -0
- data/vendor/gems/ransack_ui-1.3.4/Gemfile +7 -0
- data/vendor/gems/ransack_ui-1.3.4/LICENSE.txt +22 -0
- data/vendor/gems/ransack_ui-1.3.4/README.md +57 -0
- data/vendor/gems/ransack_ui-1.3.4/Rakefile +1 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/images/ransack_ui/calendar.png +0 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/images/ransack_ui/delete.png +0 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack/predicates.js.coffee +41 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_bootstrap/button_group_select.js.coffee +26 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_bootstrap/index.js.coffee +2 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_jquery/index.js +2 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_jquery/search_form.js.coffee.erb +499 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/stylesheets/ransack_ui_bootstrap/index.css +3 -0
- data/vendor/gems/ransack_ui-1.3.4/app/assets/stylesheets/ransack_ui_bootstrap/search.css.scss +41 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_condition_fields.html.erb +15 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_grouping_fields.html.erb +16 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_search.html.erb +29 -0
- data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_sort_fields.html.erb +4 -0
- data/vendor/gems/ransack_ui-1.3.4/config/locales/en.yml +24 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui.rb +9 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/adapters/active_record.rb +6 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/adapters/active_record/base.rb +46 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/controller_helpers.rb +18 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/rails/engine.rb +21 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/adapters/active_record/base.rb +47 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/configuration.rb +15 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/context.rb +9 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/helpers/form_builder.rb +262 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/attribute.rb +13 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/condition.rb +13 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/grouping.rb +20 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/version.rb +3 -0
- data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/view_helpers.rb +30 -0
- data/vendor/gems/ransack_ui-1.3.4/ransack_ui.gemspec +23 -0
- metadata +83 -70
- data/app/controllers/authentications_controller.rb +0 -53
- data/app/models/users/authentication.rb +0 -56
- data/app/views/authentications/new.html.haml +0 -19
- data/app/views/passwords/edit.html.haml +0 -15
- data/app/views/passwords/new.html.haml +0 -10
- data/app/views/user_mailer/password_reset_instructions.html.haml +0 -6
- data/app/views/users/new.html.haml +0 -19
- data/spec/controllers/authentications_controller_spec.rb +0 -150
- data/spec/controllers/passwords_controller_spec.rb +0 -32
- data/spec/models/users/authentication_spec.rb +0 -19
- data/spec/support/auth_macros.rb +0 -49
- data/spec/views/authentications/new.haml_spec.rb +0 -31
@@ -19,6 +19,11 @@ describe EntitiesController do
|
|
19
19
|
expect(controller.send(:parse_query_and_tags, str)).to eq(['', 'test'])
|
20
20
|
end
|
21
21
|
|
22
|
+
it 'should parse #multiword tags' do
|
23
|
+
str = "#multiword tag#"
|
24
|
+
expect(controller.send(:parse_query_and_tags, str)).to eq(['', 'multiword tag'])
|
25
|
+
end
|
26
|
+
|
22
27
|
it "should parse no tags" do
|
23
28
|
str = "test query"
|
24
29
|
expect(controller.send(:parse_query_and_tags, str)).to eq(['test query', ''])
|
@@ -16,14 +16,14 @@ describe HomeController do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should get a list of activities" do
|
19
|
-
activity =
|
19
|
+
activity = create(:version, item: create(:account, user: current_user))
|
20
20
|
expect(controller).to receive(:get_activities).once.and_return([activity])
|
21
21
|
get :index
|
22
22
|
expect(assigns[:activities]).to eq([activity])
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should not include views in the list of activities" do
|
26
|
-
|
26
|
+
create(:version, item: create(:account, user: current_user), event: "view")
|
27
27
|
expect(controller).to receive(:get_activities).once.and_return([])
|
28
28
|
|
29
29
|
get :index
|
@@ -31,21 +31,21 @@ describe HomeController do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should get a list of my tasks ordered by due_at" do
|
34
|
-
task_1 =
|
35
|
-
task_2 =
|
36
|
-
task_3 =
|
37
|
-
task_4 =
|
34
|
+
task_1 = create(:task, name: "Your first task", bucket: "due_asap", assigned_to: current_user.id)
|
35
|
+
task_2 = create(:task, name: "Another task for you", bucket: "specific_time", calendar: 5.days.from_now.to_s, assigned_to: current_user.id)
|
36
|
+
task_3 = create(:task, name: "Third Task", bucket: "due_next_week", assigned_to: current_user.id)
|
37
|
+
task_4 = create(:task, name: "i've assigned it to myself", user: current_user, calendar: 20.days.from_now.to_s, assigned_to: nil, bucket: "specific_time")
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
create(:task, name: "Someone else's Task", user_id: current_user.id, bucket: "due_asap", assigned_to: create(:user).id)
|
40
|
+
create(:task, name: "Not my task", bucket: "due_asap", assigned_to: create(:user).id)
|
41
41
|
|
42
42
|
get :index
|
43
43
|
expect(assigns[:my_tasks]).to eq([task_1, task_2, task_3, task_4])
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should not display completed tasks" do
|
47
|
-
my_task =
|
48
|
-
|
47
|
+
my_task = create(:task, user_id: current_user.id, name: "Your first task", bucket: "due_asap", assigned_to: current_user.id)
|
48
|
+
create(:task, user_id: current_user.id, name: "Completed task", bucket: "due_asap", completed_at: 1.days.ago, completed_by: current_user.id, assigned_to: current_user.id)
|
49
49
|
|
50
50
|
get :index
|
51
51
|
|
@@ -53,26 +53,26 @@ describe HomeController do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should get a list of my opportunities ordered by closes_on" do
|
56
|
-
opportunity_1 =
|
57
|
-
opportunity_2 =
|
58
|
-
opportunity_3 =
|
59
|
-
opportunity_4 =
|
56
|
+
opportunity_1 = create(:opportunity, name: "Your first opportunity", closes_on: 15.days.from_now, assigned_to: current_user.id, stage: 'proposal')
|
57
|
+
opportunity_2 = create(:opportunity, name: "Another opportunity for you", closes_on: 10.days.from_now, assigned_to: current_user.id, stage: 'proposal')
|
58
|
+
opportunity_3 = create(:opportunity, name: "Third Opportunity", closes_on: 5.days.from_now, assigned_to: current_user.id, stage: 'proposal')
|
59
|
+
opportunity_4 = create(:opportunity, name: "Fourth Opportunity", closes_on: 50.days.from_now, assigned_to: nil, user_id: current_user.id, stage: 'proposal')
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
create(:opportunity_in_pipeline, name: "Someone else's Opportunity", assigned_to: create(:user).id, stage: 'proposal')
|
62
|
+
create(:opportunity_in_pipeline, name: "Not my opportunity", assigned_to: create(:user).id, stage: 'proposal')
|
63
63
|
|
64
64
|
get :index
|
65
65
|
expect(assigns[:my_opportunities]).to eq([opportunity_3, opportunity_2, opportunity_1, opportunity_4])
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should get a list of my accounts ordered by name" do
|
69
|
-
account_1 =
|
70
|
-
account_2 =
|
71
|
-
account_3 =
|
72
|
-
account_4 =
|
69
|
+
account_1 = create(:account, name: "Anderson", assigned_to: current_user.id)
|
70
|
+
account_2 = create(:account, name: "Wilson", assigned_to: current_user.id)
|
71
|
+
account_3 = create(:account, name: "Triple", assigned_to: current_user.id)
|
72
|
+
account_4 = create(:account, name: "Double", assigned_to: nil, user_id: current_user.id)
|
73
73
|
|
74
|
-
|
75
|
-
|
74
|
+
create(:account, name: "Someone else's Account", assigned_to: create(:user).id)
|
75
|
+
create(:account, name: "Not my account", assigned_to: create(:user).id)
|
76
76
|
|
77
77
|
get :index
|
78
78
|
expect(assigns[:my_accounts]).to eq([account_1, account_4, account_3, account_2])
|
@@ -87,9 +87,9 @@ describe HomeController do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should assign instance variables for user preferences" do
|
90
|
-
@asset =
|
91
|
-
@user =
|
92
|
-
@duration =
|
90
|
+
@asset = create(:preference, user: current_user, name: "activity_asset", value: Base64.encode64(Marshal.dump("tasks")))
|
91
|
+
@user = create(:preference, user: current_user, name: "activity_user", value: Base64.encode64(Marshal.dump("Billy Bones")))
|
92
|
+
@duration = create(:preference, user: current_user, name: "activity_duration", value: Base64.encode64(Marshal.dump("two days")))
|
93
93
|
|
94
94
|
get :options, xhr: true
|
95
95
|
expect(assigns[:asset]).to eq("tasks")
|
@@ -122,7 +122,7 @@ describe HomeController do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should get a list of activities" do
|
125
|
-
@activity =
|
125
|
+
@activity = create(:version, item: create(:account, user: current_user))
|
126
126
|
expect(controller).to receive(:get_activities).once.and_return([@activity])
|
127
127
|
|
128
128
|
get :index
|
@@ -158,14 +158,14 @@ describe HomeController do
|
|
158
158
|
|
159
159
|
it "should find a user by email" do
|
160
160
|
allow(@cur_user).to receive(:pref).and_return(activity_user: 'billy@example.com')
|
161
|
-
controller.
|
161
|
+
allow(controller).to receive(:current_user).and_return(@cur_user)
|
162
162
|
expect(User).to receive(:where).with(email: 'billy@example.com').and_return([@user])
|
163
163
|
expect(controller.send(:activity_user)).to eq(1)
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should find a user by first name or last name" do
|
167
167
|
allow(@cur_user).to receive(:pref).and_return(activity_user: 'Billy')
|
168
|
-
controller.
|
168
|
+
allow(controller).to receive(:current_user).and_return(@cur_user)
|
169
169
|
expect(User).to receive(:where).with(first_name: 'Billy').and_return([@user])
|
170
170
|
expect(User).to receive(:where).with(last_name: 'Billy').and_return([@user])
|
171
171
|
expect(controller.send(:activity_user)).to eq(1)
|
@@ -173,7 +173,7 @@ describe HomeController do
|
|
173
173
|
|
174
174
|
it "should find a user by first name and last name" do
|
175
175
|
allow(@cur_user).to receive(:pref).and_return(activity_user: 'Billy Elliot')
|
176
|
-
controller.
|
176
|
+
allow(controller).to receive(:current_user).and_return(@cur_user)
|
177
177
|
expect(User).to receive(:where).with(first_name: 'Billy', last_name: "Elliot").and_return([@user])
|
178
178
|
expect(User).to receive(:where).with(first_name: 'Elliot', last_name: "Billy").and_return([@user])
|
179
179
|
expect(controller.send(:activity_user)).to eq(1)
|
@@ -181,7 +181,7 @@ describe HomeController do
|
|
181
181
|
|
182
182
|
it "should return nil when 'all_users' is specified" do
|
183
183
|
allow(@cur_user).to receive(:pref).and_return(activity_user: 'all_users')
|
184
|
-
controller.
|
184
|
+
allow(controller).to receive(:current_user).and_return(@cur_user)
|
185
185
|
expect(User).not_to receive(:where)
|
186
186
|
expect(controller.send(:activity_user)).to eq(nil)
|
187
187
|
end
|
@@ -24,9 +24,9 @@ describe TasksController do
|
|
24
24
|
end
|
25
25
|
hash[due] << case view
|
26
26
|
when "pending"
|
27
|
-
|
27
|
+
create(:task, user: user, bucket: due.to_s, name: 'Example task')
|
28
28
|
when "assigned"
|
29
|
-
|
29
|
+
create(:task, user: user, bucket: due.to_s, assigned_to: 1)
|
30
30
|
when "completed"
|
31
31
|
completed_at = case due
|
32
32
|
when :completed_today
|
@@ -40,7 +40,7 @@ describe TasksController do
|
|
40
40
|
when :completed_last_month
|
41
41
|
Date.today.beginning_of_month - 1.day
|
42
42
|
end
|
43
|
-
|
43
|
+
create(:task, user: user, bucket: due.to_s, completed_at: completed_at)
|
44
44
|
end
|
45
45
|
hash
|
46
46
|
end
|
@@ -83,12 +83,14 @@ describe TasksController do
|
|
83
83
|
|
84
84
|
expect(assigns[:tasks].keys.map(&:to_sym) - @tasks.keys).to eq([])
|
85
85
|
expect(assigns[:tasks].values.flatten - @tasks.values.flatten).to eq([])
|
86
|
-
hash = ActiveSupport::JSON.decode(response.body)
|
87
86
|
|
87
|
+
# TODO: This used to return "task" => {...} mappings, now just returns mappings
|
88
|
+
hash = ActiveSupport::JSON.decode(response.body)
|
88
89
|
hash.each_key do |key|
|
89
|
-
hash[key].each do |
|
90
|
-
task = Task.new(
|
90
|
+
hash[key].each do |data|
|
91
|
+
task = Task.new(data)
|
91
92
|
expect(task).to be_instance_of(Task)
|
93
|
+
puts task.errors.inspect unless task.valid?
|
92
94
|
expect(task.valid?).to eq(true)
|
93
95
|
end
|
94
96
|
end
|
@@ -142,8 +144,8 @@ describe TasksController do
|
|
142
144
|
#----------------------------------------------------------------------------
|
143
145
|
describe "responding to GET new" do
|
144
146
|
it "should expose a new task as @task and render [new] template" do
|
145
|
-
account =
|
146
|
-
@task =
|
147
|
+
account = create(:account, user: current_user)
|
148
|
+
@task = build(:task, user: current_user, asset: account)
|
147
149
|
allow(Task).to receive(:new).and_return(@task)
|
148
150
|
@bucket = Setting.unroll(:task_bucket)[1..-1] << ["On Specific Date...", :specific_time]
|
149
151
|
@category = Setting.unroll(:task_category)
|
@@ -156,7 +158,7 @@ describe TasksController do
|
|
156
158
|
end
|
157
159
|
|
158
160
|
it "should find related asset when necessary" do
|
159
|
-
@asset =
|
161
|
+
@asset = create(:account, id: 42)
|
160
162
|
|
161
163
|
get :new, params: { related: "account_42" }, xhr: true
|
162
164
|
expect(assigns[:asset]).to eq(@asset)
|
@@ -165,7 +167,7 @@ describe TasksController do
|
|
165
167
|
|
166
168
|
describe "(when creating related task)" do
|
167
169
|
it "should redirect to parent asset's index page with the message if parent asset got deleted" do
|
168
|
-
@account =
|
170
|
+
@account = create(:account)
|
169
171
|
@account.destroy
|
170
172
|
|
171
173
|
get :new, params: { related: "account_#{@account.id}" }, xhr: true
|
@@ -174,7 +176,7 @@ describe TasksController do
|
|
174
176
|
end
|
175
177
|
|
176
178
|
it "should redirect to parent asset's index page with the message if parent asset got protected" do
|
177
|
-
@account =
|
179
|
+
@account = create(:account, access: "Private")
|
178
180
|
|
179
181
|
get :new, params: { related: "account_#{@account.id}" }, xhr: true
|
180
182
|
expect(flash[:warning]).not_to eq(nil)
|
@@ -187,8 +189,8 @@ describe TasksController do
|
|
187
189
|
#----------------------------------------------------------------------------
|
188
190
|
describe "responding to GET edit" do
|
189
191
|
it "should expose the requested task as @task and render [edit] template" do
|
190
|
-
@asset =
|
191
|
-
@task =
|
192
|
+
@asset = create(:account, user: current_user)
|
193
|
+
@task = create(:task, user: current_user, asset: @asset)
|
192
194
|
@bucket = Setting.unroll(:task_bucket)[1..-1] << ["On Specific Date...", :specific_time]
|
193
195
|
@category = Setting.unroll(:task_category)
|
194
196
|
|
@@ -201,8 +203,8 @@ describe TasksController do
|
|
201
203
|
end
|
202
204
|
|
203
205
|
it "should find previously open task when necessary" do
|
204
|
-
@task =
|
205
|
-
@previous =
|
206
|
+
@task = create(:task, user: current_user)
|
207
|
+
@previous = create(:task, id: 999, user: current_user)
|
206
208
|
|
207
209
|
get :edit, params: { id: @task.id, previous: 999 }, xhr: true
|
208
210
|
expect(assigns[:task]).to eq(@task)
|
@@ -212,7 +214,7 @@ describe TasksController do
|
|
212
214
|
|
213
215
|
describe "(task got deleted or reassigned)" do
|
214
216
|
it "should reload current page with the flash message if the task got deleted" do
|
215
|
-
@task =
|
217
|
+
@task = create(:task, user: create(:user), assignee: current_user)
|
216
218
|
@task.destroy
|
217
219
|
|
218
220
|
get :edit, params: { id: @task.id }, xhr: true
|
@@ -221,7 +223,7 @@ describe TasksController do
|
|
221
223
|
end
|
222
224
|
|
223
225
|
it "should reload current page with the flash message if the task got reassigned" do
|
224
|
-
@task =
|
226
|
+
@task = create(:task, user: create(:user), assignee: create(:user))
|
225
227
|
|
226
228
|
get :edit, params: { id: @task.id }, xhr: true
|
227
229
|
expect(flash[:warning]).not_to eq(nil)
|
@@ -231,8 +233,8 @@ describe TasksController do
|
|
231
233
|
|
232
234
|
describe "(previous task got deleted or reassigned)" do
|
233
235
|
before(:each) do
|
234
|
-
@task =
|
235
|
-
@previous =
|
236
|
+
@task = create(:task, user: current_user)
|
237
|
+
@previous = create(:task, user: create(:user), assignee: current_user)
|
236
238
|
end
|
237
239
|
|
238
240
|
it "should notify the view if previous task got deleted" do
|
@@ -245,7 +247,7 @@ describe TasksController do
|
|
245
247
|
end
|
246
248
|
|
247
249
|
it "should notify the view if previous task got reassigned" do
|
248
|
-
@previous.update_attribute(:assignee,
|
250
|
+
@previous.update_attribute(:assignee, create(:user))
|
249
251
|
|
250
252
|
get :edit, params: { id: @task.id, previous: @previous.id }, xhr: true
|
251
253
|
expect(flash[:warning]).to eq(nil)
|
@@ -261,7 +263,7 @@ describe TasksController do
|
|
261
263
|
describe "responding to POST create" do
|
262
264
|
describe "with valid params" do
|
263
265
|
it "should expose a newly created task as @task and render [create] template" do
|
264
|
-
@task =
|
266
|
+
@task = build(:task, user: current_user)
|
265
267
|
allow(Task).to receive(:new).and_return(@task)
|
266
268
|
|
267
269
|
post :create, params: { task: { name: "Hello world" } }, xhr: true
|
@@ -273,7 +275,7 @@ describe TasksController do
|
|
273
275
|
|
274
276
|
["", "?view=pending", "?view=assigned", "?view=completed"].each do |view|
|
275
277
|
it "should update tasks sidebar when [create] is being called from [/tasks#{view}] page" do
|
276
|
-
@task =
|
278
|
+
@task = build(:task, user: current_user)
|
277
279
|
allow(Task).to receive(:new).and_return(@task)
|
278
280
|
|
279
281
|
request.env["HTTP_REFERER"] = "http://localhost/tasks#{view}"
|
@@ -285,7 +287,7 @@ describe TasksController do
|
|
285
287
|
|
286
288
|
describe "with invalid params" do
|
287
289
|
it "should expose a newly created but unsaved task as @lead and still render [create] template" do
|
288
|
-
@task =
|
290
|
+
@task = build(:task, name: nil, user: current_user)
|
289
291
|
allow(Task).to receive(:new).and_return(@task)
|
290
292
|
|
291
293
|
post :create, params: { task: {} }, xhr: true
|
@@ -303,7 +305,7 @@ describe TasksController do
|
|
303
305
|
describe "responding to PUT update" do
|
304
306
|
describe "with valid params" do
|
305
307
|
it "should update the requested task, expose it as @task, and render [update] template" do
|
306
|
-
@task =
|
308
|
+
@task = create(:task, name: "Hi", user: current_user)
|
307
309
|
|
308
310
|
put :update, params: { id: @task.id, task: { name: "Hello" } }, xhr: true
|
309
311
|
expect(@task.reload.name).to eq("Hello")
|
@@ -315,7 +317,7 @@ describe TasksController do
|
|
315
317
|
|
316
318
|
["", "?view=pending", "?view=assigned", "?view=completed"].each do |view|
|
317
319
|
it "should update tasks sidebar when [update] is being called from [/tasks#{view}] page" do
|
318
|
-
@task =
|
320
|
+
@task = create(:task, name: "Hi", user: current_user)
|
319
321
|
|
320
322
|
request.env["HTTP_REFERER"] = "http://localhost/tasks#{view}"
|
321
323
|
put :update, params: { id: @task.id, task: { name: "Hello" } }, xhr: true
|
@@ -326,7 +328,7 @@ describe TasksController do
|
|
326
328
|
|
327
329
|
describe "with invalid params" do
|
328
330
|
it "should not update the task, but still expose it as @task and render [update] template" do
|
329
|
-
@task =
|
331
|
+
@task = create(:task, name: "Hi", user: current_user)
|
330
332
|
|
331
333
|
put :update, params: { id: @task.id, task: { name: nil } }, xhr: true
|
332
334
|
expect(@task.reload.name).to eq("Hi")
|
@@ -339,7 +341,7 @@ describe TasksController do
|
|
339
341
|
|
340
342
|
describe "task got deleted or reassigned" do
|
341
343
|
it "should reload current page with the flash message if the task got deleted" do
|
342
|
-
@task =
|
344
|
+
@task = create(:task, user: create(:user), assignee: current_user)
|
343
345
|
@task.destroy
|
344
346
|
|
345
347
|
put :update, params: { id: @task.id, task: { name: "Hello" } }, xhr: true
|
@@ -348,7 +350,7 @@ describe TasksController do
|
|
348
350
|
end
|
349
351
|
|
350
352
|
it "should reload current page with the flash message if the task got reassigned" do
|
351
|
-
@task =
|
353
|
+
@task = create(:task, user: create(:user), assignee: create(:user))
|
352
354
|
|
353
355
|
put :update, params: { id: @task.id, task: { name: "Hello" } }, xhr: true
|
354
356
|
expect(flash[:warning]).not_to eq(nil)
|
@@ -362,7 +364,7 @@ describe TasksController do
|
|
362
364
|
#----------------------------------------------------------------------------
|
363
365
|
describe "responding to DELETE destroy" do
|
364
366
|
it "should destroy the requested task and render [destroy] template" do
|
365
|
-
@task =
|
367
|
+
@task = create(:task, user: current_user)
|
366
368
|
|
367
369
|
delete :destroy, params: { id: @task.id, bucket: "due_asap" }, xhr: true
|
368
370
|
expect(assigns(:task)).to eq(@task)
|
@@ -373,7 +375,7 @@ describe TasksController do
|
|
373
375
|
|
374
376
|
["", "?view=pending", "?view=assigned", "?view=completed"].each do |view|
|
375
377
|
it "should update sidebar when [destroy] is being called from [/tasks#{view}]" do
|
376
|
-
@task =
|
378
|
+
@task = create(:task, user: current_user)
|
377
379
|
|
378
380
|
request.env["HTTP_REFERER"] = "http://localhost/tasks#{view}"
|
379
381
|
delete :destroy, params: { id: @task.id, bucket: "due_asap" }, xhr: true
|
@@ -382,7 +384,7 @@ describe TasksController do
|
|
382
384
|
end
|
383
385
|
|
384
386
|
it "should not update sidebar when [destroy] is being called from asset page" do
|
385
|
-
@task =
|
387
|
+
@task = create(:task, user: current_user)
|
386
388
|
|
387
389
|
delete :destroy, params: { id: @task.id }, xhr: true
|
388
390
|
expect(assigns[:task_total]).to eq(nil)
|
@@ -390,7 +392,7 @@ describe TasksController do
|
|
390
392
|
|
391
393
|
describe "task got deleted or reassigned" do
|
392
394
|
it "should reload current page with the flash message if the task got deleted" do
|
393
|
-
@task =
|
395
|
+
@task = create(:task, user: create(:user), assignee: current_user)
|
394
396
|
@task.destroy
|
395
397
|
|
396
398
|
delete :destroy, params: { id: @task.id }, xhr: true
|
@@ -399,7 +401,7 @@ describe TasksController do
|
|
399
401
|
end
|
400
402
|
|
401
403
|
it "should reload current page with the flash message if the task got reassigned" do
|
402
|
-
@task =
|
404
|
+
@task = create(:task, user: create(:user), assignee: create(:user))
|
403
405
|
|
404
406
|
delete :destroy, params: { id: @task.id }, xhr: true
|
405
407
|
expect(flash[:warning]).not_to eq(nil)
|
@@ -413,7 +415,7 @@ describe TasksController do
|
|
413
415
|
#----------------------------------------------------------------------------
|
414
416
|
describe "responding to PUT complete" do
|
415
417
|
it "should change task status, expose task as @task, and render [complete] template" do
|
416
|
-
@task =
|
418
|
+
@task = create(:task, completed_at: nil, user: current_user)
|
417
419
|
|
418
420
|
put :complete, params: { id: @task.id }, xhr: true
|
419
421
|
expect(@task.reload.completed_at).not_to eq(nil)
|
@@ -423,7 +425,7 @@ describe TasksController do
|
|
423
425
|
end
|
424
426
|
|
425
427
|
it "should change task status, expose task as @task, and render [complete] template where task.bucket = 'specific_time'" do
|
426
|
-
@task =
|
428
|
+
@task = create(:task, completed_at: nil, user: current_user, bucket: "specific_time", calendar: "01/01/2010 1:00 AM")
|
427
429
|
|
428
430
|
put :complete, params: { id: @task.id }, xhr: true
|
429
431
|
expect(@task.reload.completed_at).not_to eq(nil)
|
@@ -433,7 +435,7 @@ describe TasksController do
|
|
433
435
|
end
|
434
436
|
|
435
437
|
it "should change update tasks sidebar if bucket is not empty" do
|
436
|
-
@task =
|
438
|
+
@task = create(:task, completed_at: nil, user: current_user)
|
437
439
|
|
438
440
|
put :complete, params: { id: @task.id, bucket: "due_asap" }, xhr: true
|
439
441
|
expect(assigns[:task_total]).to be_an_instance_of(HashWithIndifferentAccess)
|
@@ -441,7 +443,7 @@ describe TasksController do
|
|
441
443
|
|
442
444
|
describe "task got deleted or reassigned" do
|
443
445
|
it "should reload current page with the flash message if the task got deleted" do
|
444
|
-
@task =
|
446
|
+
@task = create(:task, user: create(:user), assignee: current_user)
|
445
447
|
@task.destroy
|
446
448
|
|
447
449
|
put :complete, params: { id: @task.id }, xhr: true
|
@@ -450,7 +452,7 @@ describe TasksController do
|
|
450
452
|
end
|
451
453
|
|
452
454
|
it "should reload current page with the flash message if the task got reassigned" do
|
453
|
-
@task =
|
455
|
+
@task = create(:task, user: create(:user), assignee: create(:user))
|
454
456
|
|
455
457
|
put :complete, params: { id: @task.id }, xhr: true
|
456
458
|
expect(flash[:warning]).not_to eq(nil)
|
@@ -464,7 +466,7 @@ describe TasksController do
|
|
464
466
|
#----------------------------------------------------------------------------
|
465
467
|
describe "responding to PUT uncomplete" do
|
466
468
|
it "should change task status, expose task as @task, and render template" do
|
467
|
-
@task =
|
469
|
+
@task = create(:task, completed_at: Time.now, user: current_user)
|
468
470
|
|
469
471
|
put :uncomplete, params: { id: @task.id }, xhr: true
|
470
472
|
expect(@task.reload.completed_at).to eq(nil)
|
@@ -475,7 +477,7 @@ describe TasksController do
|
|
475
477
|
|
476
478
|
describe "task got deleted" do
|
477
479
|
it "should reload current page with the flash message if the task got deleted" do
|
478
|
-
@task =
|
480
|
+
@task = create(:task, user: create(:user), assignee: current_user, completed_at: Time.now)
|
479
481
|
@task.destroy
|
480
482
|
|
481
483
|
put :uncomplete, params: { id: @task.id }, xhr: true
|