fat_free_crm 0.18.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.

Files changed (251) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +61 -160
  3. data/.travis.yml +27 -11
  4. data/CHANGELOG.md +40 -24
  5. data/CONTRIBUTORS.md +1 -0
  6. data/Dockerfile +45 -14
  7. data/Gemfile +16 -10
  8. data/Gemfile.lock +230 -222
  9. data/Procfile +1 -1
  10. data/README.md +2 -2
  11. data/Rakefile +1 -1
  12. data/app/assets/stylesheets/common.scss +1 -1
  13. data/app/controllers/admin/application_controller.rb +1 -1
  14. data/app/controllers/admin/field_groups_controller.rb +1 -3
  15. data/app/controllers/admin/tags_controller.rb +1 -3
  16. data/app/controllers/admin/users_controller.rb +5 -8
  17. data/app/controllers/application_controller.rb +11 -45
  18. data/app/controllers/comments_controller.rb +2 -5
  19. data/{config/initializers/authlogic.rb → app/controllers/confirmations_controller.rb} +4 -2
  20. data/app/controllers/emails_controller.rb +0 -2
  21. data/app/controllers/entities/accounts_controller.rb +1 -3
  22. data/app/controllers/entities/campaigns_controller.rb +1 -3
  23. data/app/controllers/entities/contacts_controller.rb +4 -24
  24. data/app/controllers/entities/leads_controller.rb +7 -10
  25. data/app/controllers/entities/opportunities_controller.rb +4 -14
  26. data/app/controllers/entities_controller.rb +21 -7
  27. data/app/controllers/home_controller.rb +2 -4
  28. data/app/controllers/passwords_controller.rb +3 -59
  29. data/{spec/features/support/maintain_sessions.rb → app/controllers/registrations_controller.rb} +12 -5
  30. data/{lib/development_tasks/gem.rake → app/controllers/sessions_controller.rb} +6 -6
  31. data/app/controllers/tasks_controller.rb +8 -17
  32. data/app/controllers/users_controller.rb +8 -29
  33. data/app/helpers/admin/users_helper.rb +1 -1
  34. data/app/helpers/application_helper.rb +27 -32
  35. data/app/helpers/campaigns_helper.rb +1 -1
  36. data/app/helpers/contacts_helper.rb +1 -3
  37. data/app/helpers/opportunities_helper.rb +4 -12
  38. data/app/helpers/tasks_helper.rb +1 -1
  39. data/app/helpers/users_helper.rb +1 -3
  40. data/{config/initializers/paper_trail.rb → app/mailers/devise_mailer.rb} +5 -1
  41. data/app/mailers/user_mailer.rb +0 -9
  42. data/app/models/entities/account.rb +10 -10
  43. data/app/models/entities/campaign.rb +4 -6
  44. data/app/models/entities/contact.rb +24 -12
  45. data/app/models/entities/lead.rb +7 -7
  46. data/app/models/entities/opportunity.rb +7 -9
  47. data/app/models/fields/custom_field.rb +1 -0
  48. data/app/models/fields/custom_field_date_pair.rb +2 -0
  49. data/app/models/fields/field.rb +1 -3
  50. data/app/models/list.rb +1 -1
  51. data/app/models/observers/entity_observer.rb +3 -7
  52. data/app/models/observers/lead_observer.rb +2 -4
  53. data/app/models/observers/opportunity_observer.rb +2 -4
  54. data/app/models/observers/task_observer.rb +1 -1
  55. data/app/models/polymorphic/email.rb +2 -2
  56. data/app/models/polymorphic/task.rb +13 -9
  57. data/app/models/polymorphic/version.rb +3 -2
  58. data/app/models/setting.rb +2 -0
  59. data/app/models/users/permission.rb +3 -3
  60. data/app/models/users/preference.rb +2 -1
  61. data/app/models/users/user.rb +67 -42
  62. data/app/views/accounts/_top_section.html.haml +1 -1
  63. data/app/views/accounts/edit.js.haml +1 -1
  64. data/app/views/accounts/update.js.haml +2 -2
  65. data/app/views/admin/users/_user.html.haml +4 -4
  66. data/app/views/contacts/_index_brief.html.haml +1 -1
  67. data/app/views/contacts/_index_full.html.haml +1 -1
  68. data/app/views/contacts/_index_long.html.haml +1 -1
  69. data/app/views/devise/confirmations/new.html.haml +9 -0
  70. data/app/views/devise/mailer/confirmation_instructions.html.haml +4 -0
  71. data/app/views/devise/mailer/password_change.html.haml +3 -0
  72. data/app/views/devise/mailer/reset_password_instructions.html.haml +6 -0
  73. data/app/views/devise/passwords/edit.html.haml +18 -0
  74. data/app/views/devise/passwords/new.html.haml +10 -0
  75. data/app/views/devise/registrations/new.html.haml +21 -0
  76. data/app/views/devise/sessions/new.html.haml +32 -0
  77. data/app/views/layouts/_about.html.haml +5 -5
  78. data/app/views/layouts/_header.html.haml +3 -3
  79. data/app/views/layouts/admin/_header.html.haml +1 -1
  80. data/app/views/shared/_address.html.haml +5 -5
  81. data/app/views/shared/_paginate_with_per_page.html.haml +1 -0
  82. data/app/views/users/_avatar.html.haml +1 -1
  83. data/bin/bundle +1 -1
  84. data/bin/rails +1 -1
  85. data/bin/setup +38 -0
  86. data/bin/update +33 -0
  87. data/bin/yarn +13 -0
  88. data/config/application.rb +8 -6
  89. data/config/boot.rb +1 -1
  90. data/config/brakeman.ignore +2 -2
  91. data/config/database.postgres.docker.yml +5 -5
  92. data/config/environment.rb +1 -1
  93. data/config/environments/development.rb +1 -0
  94. data/config/environments/test.rb +7 -0
  95. data/config/initializers/action_mailer.rb +1 -3
  96. data/config/initializers/application_controller_renderer.rb +9 -0
  97. data/config/initializers/assets.rb +6 -11
  98. data/config/initializers/backtrace_silencers.rb +0 -6
  99. data/config/initializers/content_security_policy.rb +26 -0
  100. data/config/initializers/cookies_serializer.rb +3 -6
  101. data/config/initializers/devise.rb +289 -0
  102. data/config/initializers/filter_parameter_logging.rb +0 -5
  103. data/config/initializers/gravatar.rb +0 -1
  104. data/config/initializers/inflections.rb +0 -6
  105. data/config/initializers/mime_types.rb +1 -9
  106. data/config/initializers/new_framework_defaults_5_2.rb +40 -0
  107. data/config/initializers/relative_url_root.rb +1 -3
  108. data/config/initializers/session_store.rb +1 -3
  109. data/config/initializers/wrap_parameters.rb +4 -9
  110. data/config/locales/fat_free_crm.en-GB.yml +5 -5
  111. data/config/locales/fat_free_crm.en-US.yml +5 -5
  112. data/config/locales/fat_free_crm.fr.yml +1 -1
  113. data/config/locales/fat_free_crm.ru.yml +1 -0
  114. data/config/routes.rb +20 -9
  115. data/db/demo/users.yml +62 -81
  116. data/db/migrate/20100928030620_remove_uuid.rb +1 -2
  117. data/db/migrate/20120316045804_activities_to_versions.rb +1 -0
  118. data/db/migrate/20120510025219_add_not_null_constraints_for_timestamp_columns.rb +1 -0
  119. data/db/migrate/20180107082701_authlogic_to_devise.rb +58 -0
  120. data/db/schema.rb +48 -43
  121. data/docker-compose.yml +10 -0
  122. data/fat_free_crm.gemspec +11 -13
  123. data/lib/development_tasks/license.rake +2 -2
  124. data/lib/fat_free_crm/callback.rb +2 -2
  125. data/lib/fat_free_crm/comment_extensions.rb +2 -4
  126. data/lib/fat_free_crm/core_ext/string.rb +1 -1
  127. data/lib/fat_free_crm/engine.rb +1 -1
  128. data/lib/fat_free_crm/errors.rb +1 -1
  129. data/lib/fat_free_crm/export_csv.rb +1 -0
  130. data/lib/fat_free_crm/exportable.rb +1 -1
  131. data/lib/fat_free_crm/fields.rb +1 -1
  132. data/lib/fat_free_crm/gem_dependencies.rb +1 -1
  133. data/lib/fat_free_crm/gem_ext/simple_form/action_view_extensions/form_helper.rb +1 -3
  134. data/lib/fat_free_crm/i18n.rb +2 -2
  135. data/lib/fat_free_crm/mail_processor/base.rb +4 -10
  136. data/lib/fat_free_crm/mail_processor/dropbox.rb +5 -15
  137. data/lib/fat_free_crm/permissions.rb +7 -4
  138. data/lib/fat_free_crm/sortable.rb +1 -1
  139. data/lib/fat_free_crm/tabs.rb +2 -2
  140. data/lib/fat_free_crm/version.rb +2 -2
  141. data/lib/gravatar_image_tag.rb +7 -8
  142. data/lib/missing_translation_detector.rb +1 -0
  143. data/lib/tasks/ffcrm/missing_translations.rake +1 -0
  144. data/lib/tasks/ffcrm/setup.rake +10 -1
  145. data/lib/tasks/ffcrm/update_data.rake +2 -2
  146. data/script/rails +2 -2
  147. data/spec/controllers/admin/users_controller_spec.rb +0 -56
  148. data/spec/controllers/comments_controller_spec.rb +6 -6
  149. data/spec/controllers/entities/campaigns_controller_spec.rb +1 -1
  150. data/spec/controllers/entities/contacts_controller_spec.rb +2 -1
  151. data/spec/controllers/entities/leads_controller_spec.rb +2 -2
  152. data/spec/controllers/entities/opportunities_controller_spec.rb +1 -1
  153. data/spec/controllers/entities_controller_spec.rb +5 -0
  154. data/spec/controllers/home_controller_spec.rb +5 -5
  155. data/spec/controllers/tasks_controller_spec.rb +6 -4
  156. data/spec/controllers/users_controller_spec.rb +28 -98
  157. data/spec/factories/account_factories.rb +5 -5
  158. data/spec/factories/campaign_factories.rb +3 -3
  159. data/spec/factories/contact_factories.rb +8 -8
  160. data/spec/factories/field_factories.rb +4 -3
  161. data/spec/factories/lead_factories.rb +5 -5
  162. data/spec/factories/list_factories.rb +2 -2
  163. data/spec/factories/opportunity_factories.rb +3 -3
  164. data/spec/factories/setting_factories.rb +2 -2
  165. data/spec/factories/shared_factories.rb +11 -9
  166. data/spec/factories/task_factories.rb +7 -7
  167. data/spec/factories/user_factories.rb +16 -19
  168. data/spec/features/admin/groups_spec.rb +1 -1
  169. data/spec/features/admin/users_spec.rb +3 -1
  170. data/spec/features/campaigns_spec.rb +1 -1
  171. data/spec/features/contacts_spec.rb +1 -1
  172. data/spec/features/dashboard_spec.rb +1 -1
  173. data/spec/features/devise/sign_in_spec.rb +58 -0
  174. data/spec/features/devise/sign_up_spec.rb +36 -0
  175. data/spec/features/leads_spec.rb +1 -1
  176. data/spec/features/opportunities_overview_spec.rb +1 -1
  177. data/spec/features/opportunities_spec.rb +3 -3
  178. data/spec/features/support/browser.rb +2 -1
  179. data/spec/features/tasks_spec.rb +1 -1
  180. data/spec/helpers/admin/field_groups_helper_spec.rb +1 -1
  181. data/spec/helpers/users_helper_spec.rb +4 -4
  182. data/spec/lib/comment_extensions_spec.rb +10 -4
  183. data/spec/lib/errors_spec.rb +2 -2
  184. data/spec/lib/mail_processor/dropbox_spec.rb +1 -1
  185. data/spec/lib/mail_processor/sample_emails/dropbox.rb +8 -8
  186. data/spec/lib/permissions_spec.rb +8 -3
  187. data/spec/mailers/devise_mailer_spec.rb +35 -0
  188. data/spec/mailers/user_mailer_spec.rb +0 -26
  189. data/spec/models/entities/account_spec.rb +27 -0
  190. data/spec/models/entities/contact_spec.rb +96 -1
  191. data/spec/models/fields/custom_field_date_pair_spec.rb +4 -2
  192. data/spec/models/fields/custom_field_spec.rb +4 -2
  193. data/spec/models/observers/entity_observer_spec.rb +1 -1
  194. data/spec/models/polymorphic/version_spec.rb +7 -7
  195. data/spec/models/users/user_spec.rb +22 -26
  196. data/spec/routing/users_routing_spec.rb +30 -8
  197. data/spec/shared/controllers.rb +3 -9
  198. data/spec/spec_helper.rb +10 -2
  199. data/spec/support/assert_select.rb +1 -0
  200. data/spec/support/devise_helpers.rb +28 -0
  201. data/spec/{features/support/helpers.rb → support/feature_helpers.rb} +10 -10
  202. data/spec/support/macros.rb +4 -1
  203. data/spec/views/contacts/update.js.haml_spec.rb +1 -1
  204. data/spec/views/opportunities/update.js.haml_spec.rb +1 -1
  205. data/vendor/gems/ransack_ui-1.3.4/.gitignore +17 -0
  206. data/vendor/gems/ransack_ui-1.3.4/Gemfile +7 -0
  207. data/vendor/gems/ransack_ui-1.3.4/LICENSE.txt +22 -0
  208. data/vendor/gems/ransack_ui-1.3.4/README.md +57 -0
  209. data/vendor/gems/ransack_ui-1.3.4/Rakefile +1 -0
  210. data/vendor/gems/ransack_ui-1.3.4/app/assets/images/ransack_ui/calendar.png +0 -0
  211. data/vendor/gems/ransack_ui-1.3.4/app/assets/images/ransack_ui/delete.png +0 -0
  212. data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack/predicates.js.coffee +41 -0
  213. data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_bootstrap/button_group_select.js.coffee +26 -0
  214. data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_bootstrap/index.js.coffee +2 -0
  215. data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_jquery/index.js +2 -0
  216. data/vendor/gems/ransack_ui-1.3.4/app/assets/javascripts/ransack_ui_jquery/search_form.js.coffee.erb +499 -0
  217. data/vendor/gems/ransack_ui-1.3.4/app/assets/stylesheets/ransack_ui_bootstrap/index.css +3 -0
  218. data/vendor/gems/ransack_ui-1.3.4/app/assets/stylesheets/ransack_ui_bootstrap/search.css.scss +41 -0
  219. data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_condition_fields.html.erb +15 -0
  220. data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_grouping_fields.html.erb +16 -0
  221. data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_search.html.erb +29 -0
  222. data/vendor/gems/ransack_ui-1.3.4/app/views/ransack_ui/_sort_fields.html.erb +4 -0
  223. data/vendor/gems/ransack_ui-1.3.4/config/locales/en.yml +24 -0
  224. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui.rb +9 -0
  225. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/adapters/active_record.rb +6 -0
  226. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/adapters/active_record/base.rb +46 -0
  227. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/controller_helpers.rb +18 -0
  228. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/rails/engine.rb +21 -0
  229. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/adapters/active_record/base.rb +47 -0
  230. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/configuration.rb +15 -0
  231. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/context.rb +9 -0
  232. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/helpers/form_builder.rb +262 -0
  233. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/attribute.rb +13 -0
  234. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/condition.rb +13 -0
  235. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/ransack_overrides/nodes/grouping.rb +20 -0
  236. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/version.rb +3 -0
  237. data/vendor/gems/ransack_ui-1.3.4/lib/ransack_ui/view_helpers.rb +30 -0
  238. data/vendor/gems/ransack_ui-1.3.4/ransack_ui.gemspec +23 -0
  239. metadata +79 -67
  240. data/app/controllers/authentications_controller.rb +0 -53
  241. data/app/models/users/authentication.rb +0 -56
  242. data/app/views/authentications/new.html.haml +0 -19
  243. data/app/views/passwords/edit.html.haml +0 -15
  244. data/app/views/passwords/new.html.haml +0 -10
  245. data/app/views/user_mailer/password_reset_instructions.html.haml +0 -6
  246. data/app/views/users/new.html.haml +0 -19
  247. data/spec/controllers/authentications_controller_spec.rb +0 -150
  248. data/spec/controllers/passwords_controller_spec.rb +0 -32
  249. data/spec/models/users/authentication_spec.rb +0 -19
  250. data/spec/support/auth_macros.rb +0 -49
  251. data/spec/views/authentications/new.haml_spec.rb +0 -31
@@ -23,17 +23,18 @@ FactoryBot.define do
23
23
  end
24
24
 
25
25
  factory :field do
26
- type "Field"
26
+ type { "Field" }
27
27
  field_group
28
28
  position { FactoryBot.generate(:field_position) }
29
29
  label { FactoryBot.generate(:field_label) }
30
30
  name { |f| f.label.downcase.gsub(/[^a-z0-9]+/, '_') }
31
- as "string"
31
+ as { "string" }
32
+ minlength { rand(100) }
32
33
  updated_at { FactoryBot.generate(:time) }
33
34
  created_at { FactoryBot.generate(:time) }
34
35
  end
35
36
 
36
37
  factory :custom_field do
37
- type "CustomField"
38
+ type { "CustomField" }
38
39
  end
39
40
  end
@@ -9,17 +9,17 @@ FactoryBot.define do
9
9
  factory :lead do
10
10
  user
11
11
  campaign
12
- assigned_to nil
12
+ assigned_to { nil }
13
13
  first_name { FFaker::Name.first_name }
14
14
  last_name { FFaker::Name.last_name }
15
- access "Public"
15
+ access { "Public" }
16
16
  company { FFaker::Company.name }
17
17
  title { FactoryBot.generate(:title) }
18
18
  source { %w[campaign cold_call conference online referral self web word_of_mouth other].sample }
19
19
  status { %w[new contacted converted rejected].sample }
20
- rating 1
20
+ rating { 1 }
21
21
  referred_by { FFaker::Name.name }
22
- do_not_call false
22
+ do_not_call { false }
23
23
  blog { FactoryBot.generate(:website) }
24
24
  linkedin { FactoryBot.generate(:website) }
25
25
  facebook { FactoryBot.generate(:website) }
@@ -29,7 +29,7 @@ FactoryBot.define do
29
29
  phone { FFaker::PhoneNumber.phone_number }
30
30
  mobile { FFaker::PhoneNumber.phone_number }
31
31
  background_info { FFaker::Lorem.paragraph[0, 255] }
32
- deleted_at nil
32
+ deleted_at { nil }
33
33
  updated_at { FactoryBot.generate(:time) }
34
34
  created_at { FactoryBot.generate(:time) }
35
35
  end
@@ -7,7 +7,7 @@
7
7
  #------------------------------------------------------------------------------
8
8
  FactoryBot.define do
9
9
  factory :list do
10
- name "Foo List"
11
- url "/controller/action"
10
+ name { "Foo List" }
11
+ url { "/controller/action" }
12
12
  end
13
13
  end
@@ -18,9 +18,9 @@ FactoryBot.define do
18
18
  user
19
19
  campaign
20
20
  account
21
- assigned_to nil
21
+ assigned_to { nil }
22
22
  name { FFaker::Lorem.sentence[0, 64] }
23
- access "Public"
23
+ access { "Public" }
24
24
  source { %w[campaign cold_call conference online referral self web word_of_mouth other].sample }
25
25
  stage { FactoryBot.generate(:opportunity_status) }
26
26
  probability { rand(50) }
@@ -28,7 +28,7 @@ FactoryBot.define do
28
28
  discount { rand(100) }
29
29
  closes_on { FactoryBot.generate(:date) }
30
30
  background_info { FFaker::Lorem.paragraph[0, 255] }
31
- deleted_at nil
31
+ deleted_at { nil }
32
32
  updated_at { FactoryBot.generate(:time) }
33
33
  created_at { FactoryBot.generate(:time) }
34
34
  end
@@ -7,8 +7,8 @@
7
7
  #------------------------------------------------------------------------------
8
8
  FactoryBot.define do
9
9
  factory :setting do
10
- name "foo"
11
- value nil
10
+ name { "foo" }
11
+ value { nil }
12
12
  updated_at { FactoryBot.generate(:time) }
13
13
  created_at { FactoryBot.generate(:time) }
14
14
  end
@@ -7,9 +7,9 @@
7
7
  #------------------------------------------------------------------------------
8
8
  FactoryBot.define do
9
9
  factory :version do
10
- whodunnit ""
10
+ whodunnit { "" }
11
11
  item { raise "Please specify :item for the version" }
12
- event "create"
12
+ event { "create" }
13
13
  created_at { FactoryBot.generate(:time) }
14
14
  end
15
15
 
@@ -17,9 +17,11 @@ FactoryBot.define do
17
17
  user
18
18
  commentable { raise "Please specify :commentable for the comment" }
19
19
  title { FactoryBot.generate(:title) }
20
- private false
20
+
21
+ private { false }
22
+
21
23
  comment { FFaker::Lorem.paragraph }
22
- state "Expanded"
24
+ state { "Expanded" }
23
25
  updated_at { FactoryBot.generate(:time) }
24
26
  created_at { FactoryBot.generate(:time) }
25
27
  end
@@ -31,14 +33,14 @@ FactoryBot.define do
31
33
  sent_from { FFaker::Internet.email }
32
34
  sent_to { FFaker::Internet.email }
33
35
  cc { FFaker::Internet.email }
34
- bcc nil
36
+ bcc { nil }
35
37
  subject { FFaker::Lorem.sentence }
36
38
  body { FFaker::Lorem.paragraph[0, 255] }
37
- header nil
39
+ header { nil }
38
40
  sent_at { FactoryBot.generate(:time) }
39
41
  received_at { FactoryBot.generate(:time) }
40
- deleted_at nil
41
- state "Expanded"
42
+ deleted_at { nil }
43
+ state { "Expanded" }
42
44
  updated_at { FactoryBot.generate(:time) }
43
45
  created_at { FactoryBot.generate(:time) }
44
46
  end
@@ -55,7 +57,7 @@ FactoryBot.define do
55
57
  address_type { %w[Business Billing Shipping].sample }
56
58
  updated_at { FactoryBot.generate(:time) }
57
59
  created_at { FactoryBot.generate(:time) }
58
- deleted_at nil
60
+ deleted_at { nil }
59
61
  end
60
62
 
61
63
  factory :avatar do
@@ -8,17 +8,17 @@
8
8
  FactoryBot.define do
9
9
  factory :task do
10
10
  user
11
- asset nil
12
- assigned_to nil
13
- completed_by nil
11
+ asset { nil }
12
+ assigned_to { nil }
13
+ completed_by { nil }
14
14
  name { FFaker::Lorem.sentence[0, 64] }
15
- priority nil
15
+ priority { nil }
16
16
  category { %w[call email follow_up lunch meeting money presentation trip].sample }
17
- bucket "due_asap"
17
+ bucket { "due_asap" }
18
18
  due_at { FactoryBot.generate(:time) }
19
19
  background_info { FFaker::Lorem.paragraph[0, 255] }
20
- completed_at nil
21
- deleted_at nil
20
+ completed_at { nil }
21
+ deleted_at { nil }
22
22
  updated_at { FactoryBot.generate(:time) }
23
23
  created_at { FactoryBot.generate(:time) }
24
24
  end
@@ -16,31 +16,28 @@ FactoryBot.define do
16
16
  alt_email { FFaker::Internet.email }
17
17
  phone { FFaker::PhoneNumber.phone_number }
18
18
  mobile { FFaker::PhoneNumber.phone_number }
19
- aim nil
20
- yahoo nil
21
- google nil
22
- skype nil
23
- admin false
24
- password_hash { SecureRandom.hex(64) }
19
+ aim { nil }
20
+ yahoo { nil }
21
+ google { nil }
22
+ skype { nil }
23
+ admin { false }
24
+ encrypted_password { SecureRandom.hex(64) }
25
25
  password_salt { SecureRandom.hex(64) }
26
- persistence_token { SecureRandom.hex(64) }
27
- perishable_token { SecureRandom.hex(10) }
28
- single_access_token nil
29
- current_login_at { FactoryBot.generate(:time) }
30
- last_login_at { FactoryBot.generate(:time) }
31
- last_login_ip "127.0.0.1"
32
- current_login_ip "127.0.0.1"
33
- login_count { rand(1..100) }
34
- deleted_at nil
26
+ last_sign_in_at { FactoryBot.generate(:time) }
27
+ current_sign_in_at { FactoryBot.generate(:time) }
28
+ last_sign_in_ip { "127.0.0.1" }
29
+ current_sign_in_ip { "127.0.0.1" }
30
+ sign_in_count { rand(1..100) }
31
+ deleted_at { nil }
35
32
  updated_at { FactoryBot.generate(:time) }
36
33
  created_at { FactoryBot.generate(:time) }
37
- suspended_at nil
38
- password "password"
39
- password_confirmation "password"
34
+ suspended_at { nil }
35
+ password { "password" }
36
+ password_confirmation { "password" }
40
37
  end
41
38
 
42
39
  factory :admin do
43
- admin true
40
+ admin { true }
44
41
  end
45
42
 
46
43
  factory :permission do
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('../acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Groups tab', '
11
11
  In order to increase customer satisfaction
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('../acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Users tab', '
11
11
  In order to increase customer satisfaction
@@ -25,6 +25,8 @@ feature 'Users tab', '
25
25
  fill_in 'user_email', with: 'lightning@example.com'
26
26
  fill_in 'user_first_name', with: 'Captain'
27
27
  fill_in 'user_last_name', with: 'Thunder'
28
+ fill_in 'user_password', with: 'password'
29
+ fill_in 'user_password_confirmation', with: 'password'
28
30
  fill_in 'user_title', with: 'Chief'
29
31
  fill_in 'user_company', with: 'Weather Inc.'
30
32
  select 'Superheroes', from: 'user_group_ids'
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Campaigns', '
11
11
  In order to increase customer satisfaction
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Contacts', '
11
11
  In order to increase customer satisfaction
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Dashboard', '
11
11
  In order to monitor activity
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2008-2013 Michael Dvorkin and contributors.
4
+ #
5
+ # Fat Free CRM is freely distributable under the terms of MIT license.
6
+ # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
+ #------------------------------------------------------------------------------
8
+ require 'features/acceptance_helper'
9
+
10
+ feature 'Devise Sign-in' do
11
+ background do
12
+ Setting.user_signup = :needs_approval
13
+ @user = create :user,
14
+ username: 'john',
15
+ password: 'password',
16
+ password_confirmation: 'password',
17
+ email: 'john@example.com',
18
+ sign_in_count: 0
19
+ end
20
+
21
+ scenario 'without confirmation' do
22
+ login_process('john', 'password')
23
+ expect(page).to have_content("You have to confirm your email address before continuing.")
24
+ end
25
+
26
+ scenario 'without approval' do
27
+ @user.confirm
28
+ login_process('john', 'password')
29
+ expect(page).to have_content("Your account has not been approved yet.")
30
+ end
31
+
32
+ scenario 'with approved and confirmed account' do
33
+ @user.confirm
34
+ @user.update_attribute(:suspended_at, nil)
35
+ login_process('john', 'password')
36
+ expect(page).to have_content("Signed in successfully.")
37
+ end
38
+
39
+ scenario 'invalid credentials' do
40
+ login_process('jo', 'pass')
41
+ expect(current_path).to eq "/users/sign_in"
42
+ expect(page).to have_content("Invalid Email or password")
43
+ end
44
+
45
+ scenario 'login with email' do
46
+ @user.confirm
47
+ @user.update_attribute(:suspended_at, nil)
48
+ login_process('john@example.com', 'password')
49
+ expect(page).to have_content("Signed in successfully")
50
+ end
51
+
52
+ def login_process(username, password)
53
+ visit '/users/sign_in'
54
+ fill_in 'user[email]', with: username
55
+ fill_in 'user[password]', with: password
56
+ click_button 'Login'
57
+ end
58
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2008-2013 Michael Dvorkin and contributors.
4
+ #
5
+ # Fat Free CRM is freely distributable under the terms of MIT license.
6
+ # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
+ #------------------------------------------------------------------------------
8
+ require 'features/acceptance_helper'
9
+
10
+ feature 'Devise Sign-up' do
11
+ scenario 'with valid credentials' do
12
+ visit "/users/sign_up"
13
+
14
+ fill_in "user[email]", with: "john@example.com"
15
+ fill_in "user[username]", with: "john"
16
+ fill_in "user[password]", with: "password"
17
+ fill_in "user[password_confirmation]", with: "password"
18
+ click_button("Sign Up")
19
+
20
+ expect(current_path).to eq "/users/sign_in"
21
+ expect(page).to have_content("A message with a confirmation link has been sent to your email address. Please follow the link to activate your account.")
22
+ end
23
+
24
+ scenario 'without credentials' do
25
+ visit "/users/sign_up"
26
+ click_button("Sign Up")
27
+
28
+ expect(page).to have_content("6 errors prohibited this User from being saved")
29
+ expect(page).to have_content("Please specify email address")
30
+ expect(page).to have_content("Email is too short (minimum is 3 characters)")
31
+ expect(page).to have_content("Email is invalid")
32
+ expect(page).to have_content("Please specify username")
33
+ expect(page).to have_content("Username is invalid")
34
+ expect(page).to have_content("Password can't be blank")
35
+ end
36
+ end
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Leads', '
11
11
  In order to increase sales
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Opportunities Overview', "
11
11
  In order to keep track of my team's responsibilities
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Opportunities', '
11
11
  In order to increase sales
@@ -120,13 +120,13 @@ feature 'Opportunities', '
120
120
  expect(find('#opportunities')).not_to have_content("Opportunity 1")
121
121
  end
122
122
 
123
- scenario 'should add note to opportunity', js: true do
123
+ scenario 'should add comment to opportunity', js: true do
124
124
  opportunity = create(:opportunity, name: 'Awesome Opportunity')
125
125
  visit opportunities_page
126
126
  click_link 'Awesome Opportunity'
127
127
  find("#opportunity_#{opportunity.id}_post_new_note").click
128
128
  fill_in 'comment[comment]', with: 'Most awesome opportunity'
129
- click_button 'Add Note'
129
+ click_button 'Add Comment'
130
130
  expect(page).to have_content('Most awesome opportunity')
131
131
  end
132
132
  end
@@ -7,10 +7,11 @@
7
7
  #------------------------------------------------------------------------------
8
8
  Capaybara.app_host = ENV['APP_URL'] if ENV['APP_URL']
9
9
  Capybara.default_max_wait_time = 7
10
+ Capybara.server = :webrick
10
11
 
11
12
  if ENV['BROWSER'] == 'chrome'
12
13
  Capybara.register_driver :selenium do |app|
13
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: ['no-sandbox', 'headless', 'disable-gpu'] })
14
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w[no-sandbox headless disable-gpu] })
14
15
  Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
15
16
  end
16
17
  else
@@ -5,7 +5,7 @@
5
5
  # Fat Free CRM is freely distributable under the terms of MIT license.
6
6
  # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
7
7
  #------------------------------------------------------------------------------
8
- require File.expand_path("../acceptance_helper.rb", __FILE__)
8
+ require File.expand_path('acceptance_helper.rb', __dir__)
9
9
 
10
10
  feature 'Tasks', '
11
11
  In order to increase keep track of things