mail_manager 3.0.0 → 3.2.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.
Files changed (204) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +5 -0
  3. data/.rspec +1 -0
  4. data/.ruby-version +1 -1
  5. data/Gemfile +27 -10
  6. data/LICENSE.txt +2 -2
  7. data/MIT-LICENSE +1 -1
  8. data/README.md +97 -15
  9. data/{features/bounce_management.feature → app/assets/images/mail_manager/.gitkeep} +0 -0
  10. data/app/assets/images/mail_manager/BottomRight.gif +0 -0
  11. data/app/assets/images/mail_manager/MidRight.gif +0 -0
  12. data/app/assets/images/mail_manager/TopCenter.gif +0 -0
  13. data/app/assets/images/mail_manager/TopRight.gif +0 -0
  14. data/app/assets/images/mail_manager/calendar_date_select/calendar.gif +0 -0
  15. data/app/assets/images/mail_manager/iReach_logo.gif +0 -0
  16. data/app/assets/images/mail_manager/spacer.gif +0 -0
  17. data/app/assets/images/mail_manager/topMid.gif +0 -0
  18. data/app/assets/javascripts/mail_manager/application.js +19 -1
  19. data/app/assets/javascripts/mail_manager/jquery-ui-timepicker-addon.js +2134 -0
  20. data/app/assets/stylesheets/mail_manager/admin.css +261 -0
  21. data/app/assets/stylesheets/mail_manager/application.css +3 -1
  22. data/app/assets/stylesheets/mail_manager/nav.css +68 -0
  23. data/app/assets/stylesheets/mail_manager/timepicker.css +11 -0
  24. data/app/controllers/mail_manager/application_controller.rb +7 -2
  25. data/app/controllers/mail_manager/bounces_controller.rb +5 -10
  26. data/app/controllers/mail_manager/contacts_controller.rb +42 -20
  27. data/app/controllers/mail_manager/mailing_lists_controller.rb +5 -12
  28. data/app/controllers/mail_manager/mailings_controller.rb +18 -18
  29. data/app/controllers/mail_manager/messages_controller.rb +3 -10
  30. data/app/controllers/mail_manager/subscriptions_controller.rb +16 -75
  31. data/app/helpers/mail_manager/layout_helper.rb +43 -0
  32. data/app/models/mail_manager/bounce.rb +16 -5
  33. data/app/models/mail_manager/contact.rb +64 -1
  34. data/app/models/mail_manager/mailable.rb +14 -0
  35. data/app/models/mail_manager/mailer.rb +48 -81
  36. data/app/models/mail_manager/mailing.rb +23 -42
  37. data/app/models/mail_manager/message.rb +52 -8
  38. data/app/models/mail_manager/subscription.rb +9 -3
  39. data/app/models/status_history.rb +3 -2
  40. data/app/views/layouts/mail_manager/application.html.erb +33 -5
  41. data/app/views/layouts/mail_manager/layout.html.erb +15 -0
  42. data/app/views/mail_manager/bounces/index.html.erb +6 -4
  43. data/app/views/mail_manager/bounces/show.html.erb +3 -3
  44. data/app/views/mail_manager/contacts/_form.html.erb +7 -23
  45. data/app/views/mail_manager/contacts/edit.html.erb +3 -3
  46. data/app/views/mail_manager/contacts/index.html.erb +14 -28
  47. data/app/views/mail_manager/contacts/new.html.erb +2 -2
  48. data/app/views/mail_manager/contacts/show.html.erb +5 -5
  49. data/app/views/mail_manager/contacts/subscribe.html.erb +1 -1
  50. data/app/views/mail_manager/mailer/double_opt_in.erb +1 -1
  51. data/app/views/mail_manager/mailer/double_opt_in.html.erb +6 -0
  52. data/app/views/mail_manager/mailer/unsubscribed.erb +1 -1
  53. data/app/views/mail_manager/mailer/unsubscribed.html.erb +1 -1
  54. data/app/views/mail_manager/mailing_lists/_form.html.erb +8 -17
  55. data/app/views/mail_manager/mailing_lists/edit.html.erb +4 -4
  56. data/app/views/mail_manager/mailing_lists/index.html.erb +6 -5
  57. data/app/views/mail_manager/mailing_lists/new.html.erb +3 -3
  58. data/app/views/mail_manager/mailings/_form.html.erb +22 -44
  59. data/app/views/mail_manager/mailings/edit.html.erb +3 -3
  60. data/app/views/mail_manager/mailings/index.html.erb +23 -27
  61. data/app/views/mail_manager/mailings/new.html.erb +2 -2
  62. data/app/views/mail_manager/mailings/test.html.erb +3 -3
  63. data/app/views/mail_manager/messages/index.html.erb +2 -2
  64. data/app/views/mail_manager/subscriptions/_form.html.erb +1 -1
  65. data/app/views/mail_manager/subscriptions/_subscriptions.html.erb +2 -2
  66. data/app/views/mail_manager/subscriptions/edit.html.erb +2 -2
  67. data/app/views/mail_manager/subscriptions/index.html.erb +3 -3
  68. data/app/views/mail_manager/subscriptions/new.html.erb +1 -1
  69. data/app/views/mail_manager/subscriptions/unsubscribe.html.erb +1 -1
  70. data/app/views/mail_manager/subscriptions/unsubscribe_by_email_address.html.erb +3 -3
  71. data/config/locales/en.yml +13 -0
  72. data/config/locales/mailings.en.yml +52 -0
  73. data/config/routes.rb +21 -19
  74. data/db/migrate/008_add_bounces_count_to_mailings.rb +14 -0
  75. data/db/migrate/009_add_messages_count_to_mailings.rb +14 -0
  76. data/db/migrate/010_add_login_token_to_contact.rb +11 -0
  77. data/db/migrate/011_add_deleted_at_to_mailing.rb +11 -0
  78. data/lib/delayed/mailer.rb +9 -5
  79. data/lib/delayed/status.rb +6 -2
  80. data/lib/delayed_overrides/worker.rb +21 -0
  81. data/lib/deleteable.rb +13 -14
  82. data/lib/mail_manager/config.rb +3 -3
  83. data/lib/mail_manager/engine.rb +136 -7
  84. data/lib/mail_manager/lock.rb +1 -0
  85. data/lib/mail_manager/version.rb +1 -1
  86. data/lib/tasks/mail_manager.rake +92 -56
  87. data/mail_manager.gemspec +4 -0
  88. data/spec/rails_helper.rb +50 -0
  89. data/spec/spec_helper.rb +87 -48
  90. data/spec/test_app/.env.development +3 -0
  91. data/spec/test_app/.env.test +2 -0
  92. data/spec/test_app/.rspec +1 -0
  93. data/spec/test_app/Procfile +3 -0
  94. data/spec/test_app/app/controllers/application_controller.rb +4 -0
  95. data/spec/test_app/app/models/ability.rb +7 -0
  96. data/spec/test_app/app/models/user.rb +8 -2
  97. data/spec/test_app/app/models/user_with_role.rb +22 -0
  98. data/spec/test_app/config/database.postgres.yml +21 -0
  99. data/spec/test_app/config/database.sqlite.yml +2 -2
  100. data/spec/test_app/config/environment.rb +2 -2
  101. data/spec/test_app/config/environments/test.rb +13 -0
  102. data/spec/test_app/config/mail_manager.yml +66 -2
  103. data/spec/test_app/config/routes.rb +0 -1
  104. data/spec/test_app/db/migrate/20150420163235_add_bounces_count_to_mailings.rb +14 -0
  105. data/spec/test_app/db/migrate/20150420163804_add_messages_count_to_mailings.rb +14 -0
  106. data/spec/test_app/db/migrate/20150421151457_add_login_token_to_contact.rb +11 -0
  107. data/spec/test_app/db/migrate/20150423143754_add_deleted_at_to_mailing.rb +11 -0
  108. data/spec/test_app/db/schema.rb +10 -5
  109. data/spec/test_app/db/structure.sql +150 -15
  110. data/spec/test_app/features/bounce_management.feature +11 -0
  111. data/spec/test_app/features/contact_management.feature +91 -0
  112. data/{features → spec/test_app/features}/mailable.feature +3 -1
  113. data/spec/test_app/features/mailing_list_management.feature +39 -0
  114. data/spec/test_app/features/mailing_management.feature +60 -0
  115. data/{features → spec/test_app/features}/message.feature +4 -4
  116. data/spec/test_app/features/message_management.feature +22 -0
  117. data/spec/test_app/features/step_definitions/bounce_steps.rb +4 -0
  118. data/spec/test_app/features/step_definitions/contact_steps.rb +63 -0
  119. data/spec/test_app/features/step_definitions/debugging_steps.rb +3 -0
  120. data/spec/test_app/features/step_definitions/email_steps.rb +6 -0
  121. data/spec/test_app/features/step_definitions/job_steps.rb +25 -0
  122. data/spec/test_app/features/step_definitions/login_steps.rb +4 -0
  123. data/spec/test_app/features/step_definitions/mailing_list.rb +17 -0
  124. data/spec/test_app/features/step_definitions/mailing_steps.rb +51 -0
  125. data/spec/test_app/features/step_definitions/subscription_steps.rb +26 -0
  126. data/{features → spec/test_app/features}/step_definitions/webrat_steps.rb +10 -6
  127. data/spec/test_app/features/subscription_management.feature +62 -0
  128. data/spec/test_app/features/support/env.rb +37 -0
  129. data/spec/test_app/features/support/paths.rb +36 -0
  130. data/spec/test_app/lib/debugging.rb +61 -0
  131. data/spec/test_app/lib/post_office_manager.rb +71 -0
  132. data/spec/test_app/public/subscribe.html +40 -0
  133. data/spec/test_app/script/full_suite +50 -0
  134. data/spec/test_app/script/post_office +25 -0
  135. data/spec/test_app/script/rails +20 -0
  136. data/spec/test_app/script/rspec_multi_db +34 -0
  137. data/spec/test_app/spec/controllers/mail_manager/bounces_controller_spec.rb +59 -0
  138. data/spec/test_app/spec/controllers/mail_manager/contacts_controller_spec.rb +178 -0
  139. data/spec/test_app/spec/controllers/mail_manager/mailing_lists_controller_spec.rb +164 -0
  140. data/spec/test_app/spec/controllers/mail_manager/mailings_controller_spec.rb +184 -0
  141. data/spec/test_app/spec/controllers/users_controller_spec.rb +47 -46
  142. data/spec/test_app/spec/factories/_functions.rb +27 -0
  143. data/spec/test_app/spec/factories/contacts.rb +7 -0
  144. data/spec/test_app/spec/factories/mail_manager_bounces.rb +13 -0
  145. data/spec/test_app/spec/factories/mailable.rb +8 -0
  146. data/spec/test_app/spec/factories/mailings.rb +7 -1
  147. data/spec/test_app/spec/factories/message.rb +7 -0
  148. data/spec/test_app/spec/factories/users.rb +19 -7
  149. data/spec/test_app/spec/features/mail_manager/bounce_spec.rb +73 -0
  150. data/spec/test_app/spec/features/mail_manager/double_opt_in_spec.rb +62 -0
  151. data/spec/test_app/spec/features/mail_manager/mailing_spec.rb +46 -0
  152. data/spec/test_app/spec/features/navigation_spec.rb +9 -0
  153. data/spec/test_app/spec/helpers/mail_manager/layout_helper_spec.rb +41 -0
  154. data/spec/test_app/spec/helpers/mail_manager/subscriptions_helper_spec.rb +14 -0
  155. data/spec/test_app/spec/models/delayed/mailer_spec.rb +27 -0
  156. data/spec/test_app/spec/models/delayed/status_job_spec.rb +13 -0
  157. data/spec/test_app/spec/models/delayed/status_spec.rb +37 -0
  158. data/spec/test_app/spec/models/mail_manager/bounce_spec.rb +23 -3
  159. data/spec/test_app/spec/models/mail_manager/engine_spec.rb +79 -0
  160. data/spec/test_app/spec/models/mail_manager/mailable_spec.rb +10 -0
  161. data/spec/test_app/spec/models/mail_manager/mailer_spec.rb +35 -3
  162. data/spec/test_app/spec/models/mail_manager/mailing_list_spec.rb +5 -5
  163. data/spec/test_app/spec/models/mail_manager/mailing_spec.rb +58 -0
  164. data/spec/test_app/spec/models/mail_manager/message_spec.rb +112 -0
  165. data/spec/test_app/spec/models/user_spec.rb +10 -8
  166. data/spec/test_app/spec/rails_helper.rb +86 -0
  167. data/spec/test_app/spec/requests/users_spec.rb +3 -3
  168. data/spec/test_app/spec/routing/mail_manager/bounces_routing_spec.rb +27 -0
  169. data/spec/test_app/spec/routing/mail_manager/contacts_routing_spec.rb +36 -0
  170. data/spec/test_app/spec/routing/mail_manager/mailing_lists_routing_spec.rb +36 -0
  171. data/spec/test_app/spec/routing/mail_manager/mailings_routing_spec.rb +36 -0
  172. data/spec/test_app/spec/spec_helper.rb +82 -32
  173. data/spec/test_app/spec/support/continuance.rb +18 -0
  174. data/spec/test_app/spec/support/custom_matchers.rb +17 -0
  175. data/spec/test_app/spec/support/database_cleaner.rb +10 -1
  176. data/spec/test_app/spec/views/mail_manager/bounces/index.html.erb_spec.rb +32 -0
  177. data/spec/test_app/spec/views/mail_manager/bounces/show.html.erb_spec.rb +12 -0
  178. data/spec/test_app/spec/views/users/edit.html.erb_spec.rb +8 -5
  179. data/spec/test_app/spec/views/users/index.html.erb_spec.rb +10 -19
  180. data/spec/test_app/spec/views/users/new.html.erb_spec.rb +9 -6
  181. data/spec/test_app/spec/views/users/show.html.erb_spec.rb +8 -9
  182. metadata +231 -75
  183. data/.DS_Store +0 -0
  184. data/README.rdoc +0 -3
  185. data/app/.DS_Store +0 -0
  186. data/app/controllers/mail_manager/base_controller.rb +0 -22
  187. data/app/models/.DS_Store +0 -0
  188. data/features/contact_management.feature +0 -24
  189. data/features/mailing_management.feature +0 -78
  190. data/features/step_definitions/email_steps.rb +0 -50
  191. data/features/step_definitions/mlm_steps.rb +0 -11
  192. data/features/step_definitions/pickle_steps.rb +0 -41
  193. data/features/subscription_management.feature +0 -17
  194. data/features/support/env.rb +0 -11
  195. data/features/support/paths.rb +0 -44
  196. data/lib/tasks/mail_manager_tasks.rake +0 -4
  197. data/lib/tasks/rspec.rake +0 -165
  198. data/spec/test_app/bin/cucumber +0 -7
  199. data/spec/test_app/bin/rails +0 -10
  200. data/spec/test_app/bin/rake +0 -7
  201. data/spec/test_app/bin/rspec +0 -7
  202. data/spec/test_app/bin/spring +0 -18
  203. data/spec/test_app/spec/routing/users_routing_spec.rb +0 -35
  204. data/spec/test_app/spec/support/post_office.rb +0 -13
@@ -0,0 +1,21 @@
1
+ credentials: &credentials
2
+ encoding: utf8
3
+ adapter: postgresql
4
+ username: mail_manager
5
+ password: mail_manager_pass
6
+ host: localhost
7
+ reconnect: true
8
+ pool: 5
9
+ timeout: 5000
10
+
11
+ development:
12
+ <<: *credentials
13
+ database: mail_manager_development
14
+
15
+ test:
16
+ <<: *credentials
17
+ database: mail_manager_test
18
+
19
+ production:
20
+ <<: *credentials
21
+ database: mail_manager
@@ -14,7 +14,7 @@ development:
14
14
  # Do not set this db to the same as development or production.
15
15
  test: &test
16
16
  adapter: sqlite3
17
- database: db/test.sqlite3
17
+ database: tmp/test.sqlite3
18
18
  pool: 5
19
19
  timeout: 5000
20
20
 
@@ -25,4 +25,4 @@ test: &test
25
25
  # timeout: 5000
26
26
 
27
27
  cucumber:
28
- <<: *test
28
+ <<: *test
@@ -6,9 +6,9 @@ TestApp::Application.initialize!
6
6
 
7
7
  ActionMailer::Base.smtp_settings = {
8
8
  :address => "mail.lvh.me",
9
- :port => 25000,
9
+ :port => ENV['POST_OFFICE_SMTP_PORT'],
10
10
  :domain => "mail.lvh.me",
11
11
  :enable_starttls_auto => false,
12
12
  :ssl => false,
13
13
  :tls => false
14
- }
14
+ }
@@ -34,4 +34,17 @@ TestApp::Application.configure do
34
34
 
35
35
  # Print deprecation notices to the stderr
36
36
  config.active_support.deprecation = :stderr
37
+
38
+ config.action_mailer.smtp_settings = {
39
+ :address=>"mail.lvh.me",
40
+ :port=>25000,
41
+ :domain=>"mail.lvh.me",
42
+ :user_name=>'bobo',
43
+ :password=>'Secret1!',
44
+ :authentication=>nil,
45
+ :enable_starttls_auto=>false,
46
+ :openssl_verify_mode=>nil,
47
+ :ssl=>false,
48
+ :tls=>false
49
+ }
37
50
  end
@@ -1,12 +1,68 @@
1
+ # this file is used to configure the mail_manager gem
2
+ # it works like an older gem called AppConfig
3
+ # all environments start with settings from the 'common' section
4
+ # and are overridden by the section that matches the environment's name
5
+ # also .. if you create a 'config/mail_manager.local.yml' it will override
6
+ # what is in 'config/mail_manager.yml' such that you can keep a version
7
+ # for local settings and not overwrite one that you include in your source control
8
+ # also ... these files allow the use of erb syntax to set variables with ruby thus
9
+ # allowing ENV variables and such to be used
10
+ # here are the valid settings and what they are for:
11
+ # site_url: used in various places to get the url of the site (such as in mailings templates)
12
+ # public_layout: layout used for public facing pages like unsubscribing and opt-in pages
13
+ # layout: layout used for mail manager administratin pages
14
+ # site_path: used in case your rails site is at a sub-path of the site url
15
+ # exception_notification: (grouping for who gets notified of exceptions)
16
+ # to_addresses: an array of recipients for exceptions
17
+ # from_address: who the exception appears to be from
18
+ # requires_authentication: whether the mail manager app requires login
19
+ # authorized_roles: array of role names that can administer the mail manager
20
+ # roles_method: the method that your "current_user" object defines its role names(returns a list of strings)
21
+ # unsubscribe_path: public url for unsubscribing ... this is a prefix and is followed by a message 'guid', defaults to '/listmgr' and routes as '/listmgr/:guid'
22
+ # dont_include_images_domains: a list of domains that won't include images in the email, whether or not the mailing is set to include them
23
+ # sleep_time_between_messages: a timeout between messages to slow the output of emails to your email server; you should probably limit with your mail server itself if possible
24
+ # path_prefix: a prefix to the mail manager routes(defaults to /admin)
25
+ # table_prefix: prefixes all mail manager tables with a string to avoid collisions with your app - should be set BEFORE running migrations
26
+ # default_from_email_address: where any public messages from the app default to for the "FROM:" header
27
+ # secret: a secret for encrypting tokens and guids
28
+ # bounce: (a grouping for 'POP' settings for bounce messages and the RETURN_PATH: header)
29
+ # email_address: the account for POPing bounces and RETURN_PATH
30
+ # login: login for account for POPing
31
+ # password: password for account for POPing
32
+ # pop_server: POP server
33
+ # port: PORT of pop server
34
+ # ssl: true/false whether you want to enable ssl for pop
35
+ # subscribe_path: public path for double-opt-in 'subscribe' step which sends the email
36
+ # honey_pot_field: used to set a field name which will ignore submissions to the subscribe action if filled
37
+ # double_opt_in_path: path to route the double-opt-in confirmation action to
38
+ # signup_email_address: email address for the FROM: of a double opt in/subscribe email
39
+ #
1
40
  ---
2
41
  common:
3
- site_url: http://mail_manager.lvh.me
42
+ site_url: http://mail-manager.dev
43
+ public_layout: mail_manager/layout
44
+ site_path: /
45
+ use_show_for_resources: false
46
+ exception_notification:
47
+ to_addresses:
48
+ - chauboldt@lone-star.net
49
+ - chauboldt@lnstar.com
50
+ from_address: errors@example.net
51
+ requires_authentication: false
52
+ roles_method:
53
+ authorized_roles: []
4
54
  unsubscribe_path: /listmgr
55
+ subscribe_path: /subscribe
56
+ subscribe_thank_you_path: /listmgr/subscribe_thank_you
57
+ double_opt_in_path: /listmgr/confirm
58
+ honey_pot_field: company_name
59
+ signup_email_address: chrisboy <chrisboy@lvh.me>
5
60
  dont_include_images_domains:
6
61
  - yahoo.com
7
62
  - google.com
8
63
  - hotmail.com
9
64
  sleep_time_between_messages: 0.3
65
+ path_prefix: /admin
10
66
  table_prefix: mail_manager_
11
67
  default_from_email_address: chrisboy <chrisboy@lvh.me>
12
68
  secret: 7a3906324erwr6254e85e4bdb80592001a
@@ -15,7 +71,15 @@ common:
15
71
  login: bounce
16
72
  password: secret
17
73
  pop_server: mail.lvh.me
18
- port: 11000
74
+ port: <%= ENV['POST_OFFICE_POP_PORT'] %>
19
75
  ssl: false
20
76
  tls: false
21
77
  enable_starttls_auto: false
78
+ development:
79
+ site_url: http://example.dev
80
+ secret: !binary |-
81
+ ZDgxNDViNzJhOWExMDI1NmU1OTkwZDEzYTgyODcy
82
+ test:
83
+ site_url: http://mail-manager.lvh.me:4460
84
+ secret: !binary |-
85
+ ZjU0MDU2YWU4M2Q0MjU4MTM2ZWIwYzM2ZTNjMDRj
@@ -2,6 +2,5 @@ Rails.application.routes.draw do
2
2
 
3
3
  resources :users
4
4
 
5
-
6
5
  mount MailManager::Engine => "/mail_manager"
7
6
  end
@@ -0,0 +1,14 @@
1
+ class AddBouncesCountToMailings < ActiveRecord::Migration
2
+ def table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+ def change
8
+ add_column :"#{table_prefix}mailings", :bounces_count, :integer, default: 0
9
+ MailManager::Mailing.reset_column_information
10
+ MailManager::Mailing.find_each do |m|
11
+ MailManager::Mailing.reset_counters m.id, :bounces
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ class AddMessagesCountToMailings < ActiveRecord::Migration
2
+ def table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+ def change
8
+ add_column :"#{table_prefix}mailings", :messages_count, :integer, default: 0
9
+ MailManager::Mailing.reset_column_information
10
+ MailManager::Mailing.find_each do |m|
11
+ MailManager::Mailing.reset_counters m.id, :messages
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ class AddLoginTokenToContact < ActiveRecord::Migration
2
+ def table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+ def change
8
+ add_column :"#{table_prefix}contacts", :login_token, :string
9
+ add_column :"#{table_prefix}contacts", :login_token_created_at, :datetime
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class AddDeletedAtToMailing < ActiveRecord::Migration
2
+ def table_prefix
3
+ MailManager.table_prefix
4
+ rescue
5
+ 'mail_manager_'
6
+ end
7
+
8
+ def change
9
+ add_column :"#{table_prefix}mailings", :deleted_at, :datetime
10
+ end
11
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20131221072600) do
14
+ ActiveRecord::Schema.define(:version => 20150423143754) do
15
15
 
16
16
  create_table "delayed_jobs", :force => true do |t|
17
17
  t.integer "priority", :default => 0, :null => false
@@ -48,9 +48,11 @@ ActiveRecord::Schema.define(:version => 20131221072600) do
48
48
  t.string "last_name"
49
49
  t.integer "upated_by"
50
50
  t.integer "created_by"
51
- t.datetime "created_at", :null => false
52
- t.datetime "updated_at", :null => false
51
+ t.datetime "created_at", :null => false
52
+ t.datetime "updated_at", :null => false
53
53
  t.datetime "deleted_at"
54
+ t.string "login_token"
55
+ t.datetime "login_token_created_at"
54
56
  end
55
57
 
56
58
  create_table "mail_manager_mailables", :force => true do |t|
@@ -88,8 +90,11 @@ ActiveRecord::Schema.define(:version => 20131221072600) do
88
90
  t.datetime "status_changed_at"
89
91
  t.datetime "scheduled_at"
90
92
  t.boolean "include_images"
91
- t.datetime "created_at", :null => false
92
- t.datetime "updated_at", :null => false
93
+ t.datetime "created_at", :null => false
94
+ t.datetime "updated_at", :null => false
95
+ t.integer "bounces_count", :default => 0
96
+ t.integer "messages_count", :default => 0
97
+ t.datetime "deleted_at"
93
98
  end
94
99
 
95
100
  create_table "mail_manager_messages", :force => true do |t|
@@ -1,17 +1,144 @@
1
- CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL);
2
- CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version");
3
- CREATE TABLE "delayed_jobs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "priority" integer DEFAULT 0 NOT NULL, "attempts" integer DEFAULT 0 NOT NULL, "handler" text NOT NULL, "last_error" text, "run_at" datetime, "locked_at" datetime, "failed_at" datetime, "locked_by" varchar(255), "queue" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
4
- CREATE INDEX "delayed_jobs_priority" ON "delayed_jobs" ("priority", "run_at");
5
- CREATE TABLE "mail_manager_bounces" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message_id" integer, "mailing_id" integer, "status" varchar(255), "status_changed_at" datetime, "bounce_message" text, "comments" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
6
- CREATE TABLE "mail_manager_contacts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "contactable_id" integer, "contactable_type" varchar(255), "email_address" varchar(255), "first_name" varchar(255), "last_name" varchar(255), "upated_by" integer, "created_by" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "deleted_at" datetime);
7
- CREATE TABLE "mail_manager_mailables" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "email_html" text, "email_text" text, "reusable" boolean, "updated_by" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
8
- CREATE TABLE "mail_manager_mailing_lists" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "description" text, "status" varchar(255), "status_changed_at" datetime, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "deleted_at" datetime, "defaults_to_active" boolean);
9
- CREATE TABLE "mail_manager_mailing_lists_mail_manager_mailings" ("mailing_id" integer, "mailing_list_id" integer);
10
- CREATE TABLE "mail_manager_mailings" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "subject" varchar(255), "from_email_address" varchar(255), "mailable_type" varchar(255), "mailable_id" integer, "status" varchar(255), "status_changed_at" datetime, "scheduled_at" datetime, "include_images" boolean, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
11
- CREATE TABLE "mail_manager_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "test_email_address" varchar(255), "subscription_id" integer, "mailing_id" integer, "guid" varchar(255), "status" varchar(255), "status_changed_at" datetime, "result" text, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "contact_id" integer, "from_email_address" varchar(255));
12
- CREATE TABLE "mail_manager_subscriptions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "mailing_list_id" integer, "status" varchar(255), "status_changed_at" datetime, "updated_by" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "contact_id" integer);
13
- CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar(255), "last_name" varchar(255), "email" varchar(255), "phone" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
14
- CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email");
1
+ CREATE TABLE `delayed_jobs` (
2
+ `id` int(11) NOT NULL AUTO_INCREMENT,
3
+ `priority` int(11) NOT NULL DEFAULT '0',
4
+ `attempts` int(11) NOT NULL DEFAULT '0',
5
+ `handler` text NOT NULL,
6
+ `last_error` text,
7
+ `run_at` datetime DEFAULT NULL,
8
+ `locked_at` datetime DEFAULT NULL,
9
+ `failed_at` datetime DEFAULT NULL,
10
+ `locked_by` varchar(255) DEFAULT NULL,
11
+ `queue` varchar(255) DEFAULT NULL,
12
+ `created_at` datetime NOT NULL,
13
+ `updated_at` datetime NOT NULL,
14
+ PRIMARY KEY (`id`),
15
+ KEY `delayed_jobs_priority` (`priority`,`run_at`)
16
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
17
+
18
+ CREATE TABLE `mail_manager_bounces` (
19
+ `id` int(11) NOT NULL AUTO_INCREMENT,
20
+ `message_id` int(11) DEFAULT NULL,
21
+ `mailing_id` int(11) DEFAULT NULL,
22
+ `status` varchar(255) DEFAULT NULL,
23
+ `status_changed_at` datetime DEFAULT NULL,
24
+ `bounce_message` text,
25
+ `comments` text,
26
+ `created_at` datetime NOT NULL,
27
+ `updated_at` datetime NOT NULL,
28
+ PRIMARY KEY (`id`)
29
+ ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
30
+
31
+ CREATE TABLE `mail_manager_contacts` (
32
+ `id` int(11) NOT NULL AUTO_INCREMENT,
33
+ `contactable_id` int(11) DEFAULT NULL,
34
+ `contactable_type` varchar(255) DEFAULT NULL,
35
+ `email_address` varchar(255) DEFAULT NULL,
36
+ `first_name` varchar(255) DEFAULT NULL,
37
+ `last_name` varchar(255) DEFAULT NULL,
38
+ `upated_by` int(11) DEFAULT NULL,
39
+ `created_by` int(11) DEFAULT NULL,
40
+ `created_at` datetime NOT NULL,
41
+ `updated_at` datetime NOT NULL,
42
+ `deleted_at` datetime DEFAULT NULL,
43
+ `login_token` varchar(255) DEFAULT NULL,
44
+ `login_token_created_at` datetime DEFAULT NULL,
45
+ PRIMARY KEY (`id`)
46
+ ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
47
+
48
+ CREATE TABLE `mail_manager_mailables` (
49
+ `id` int(11) NOT NULL AUTO_INCREMENT,
50
+ `name` varchar(255) NOT NULL,
51
+ `email_html` text,
52
+ `email_text` text,
53
+ `reusable` tinyint(1) DEFAULT NULL,
54
+ `updated_by` int(11) DEFAULT NULL,
55
+ `created_at` datetime NOT NULL,
56
+ `updated_at` datetime NOT NULL,
57
+ PRIMARY KEY (`id`)
58
+ ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
59
+
60
+ CREATE TABLE `mail_manager_mailing_lists` (
61
+ `id` int(11) NOT NULL AUTO_INCREMENT,
62
+ `name` varchar(255) DEFAULT NULL,
63
+ `description` text,
64
+ `status` varchar(255) DEFAULT NULL,
65
+ `status_changed_at` datetime DEFAULT NULL,
66
+ `created_at` datetime NOT NULL,
67
+ `updated_at` datetime NOT NULL,
68
+ `deleted_at` datetime DEFAULT NULL,
69
+ `defaults_to_active` tinyint(1) DEFAULT NULL,
70
+ PRIMARY KEY (`id`)
71
+ ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
72
+
73
+ CREATE TABLE `mail_manager_mailing_lists_mail_manager_mailings` (
74
+ `mailing_id` int(11) DEFAULT NULL,
75
+ `mailing_list_id` int(11) DEFAULT NULL
76
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
77
+
78
+ CREATE TABLE `mail_manager_mailings` (
79
+ `id` int(11) NOT NULL AUTO_INCREMENT,
80
+ `subject` varchar(255) DEFAULT NULL,
81
+ `from_email_address` varchar(255) DEFAULT NULL,
82
+ `mailable_type` varchar(255) DEFAULT NULL,
83
+ `mailable_id` int(11) DEFAULT NULL,
84
+ `status` varchar(255) DEFAULT NULL,
85
+ `status_changed_at` datetime DEFAULT NULL,
86
+ `scheduled_at` datetime DEFAULT NULL,
87
+ `include_images` tinyint(1) DEFAULT NULL,
88
+ `created_at` datetime NOT NULL,
89
+ `updated_at` datetime NOT NULL,
90
+ `bounces_count` int(11) DEFAULT '0',
91
+ `messages_count` int(11) DEFAULT '0',
92
+ `deleted_at` datetime DEFAULT NULL,
93
+ PRIMARY KEY (`id`)
94
+ ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
95
+
96
+ CREATE TABLE `mail_manager_messages` (
97
+ `id` int(11) NOT NULL AUTO_INCREMENT,
98
+ `type` varchar(255) DEFAULT NULL,
99
+ `test_email_address` varchar(255) DEFAULT NULL,
100
+ `subscription_id` int(11) DEFAULT NULL,
101
+ `mailing_id` int(11) DEFAULT NULL,
102
+ `guid` varchar(255) DEFAULT NULL,
103
+ `status` varchar(255) DEFAULT NULL,
104
+ `status_changed_at` datetime DEFAULT NULL,
105
+ `result` text,
106
+ `created_at` datetime NOT NULL,
107
+ `updated_at` datetime NOT NULL,
108
+ `contact_id` int(11) DEFAULT NULL,
109
+ `from_email_address` varchar(255) DEFAULT NULL,
110
+ PRIMARY KEY (`id`)
111
+ ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
112
+
113
+ CREATE TABLE `mail_manager_subscriptions` (
114
+ `id` int(11) NOT NULL AUTO_INCREMENT,
115
+ `mailing_list_id` int(11) DEFAULT NULL,
116
+ `status` varchar(255) DEFAULT NULL,
117
+ `status_changed_at` datetime DEFAULT NULL,
118
+ `updated_by` int(11) DEFAULT NULL,
119
+ `created_at` datetime NOT NULL,
120
+ `updated_at` datetime NOT NULL,
121
+ `contact_id` int(11) DEFAULT NULL,
122
+ PRIMARY KEY (`id`)
123
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
124
+
125
+ CREATE TABLE `schema_migrations` (
126
+ `version` varchar(255) NOT NULL,
127
+ UNIQUE KEY `unique_schema_migrations` (`version`)
128
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
129
+
130
+ CREATE TABLE `users` (
131
+ `id` int(11) NOT NULL AUTO_INCREMENT,
132
+ `first_name` varchar(255) DEFAULT NULL,
133
+ `last_name` varchar(255) DEFAULT NULL,
134
+ `email` varchar(255) DEFAULT NULL,
135
+ `phone` varchar(255) DEFAULT NULL,
136
+ `created_at` datetime NOT NULL,
137
+ `updated_at` datetime NOT NULL,
138
+ PRIMARY KEY (`id`),
139
+ UNIQUE KEY `index_users_on_email` (`email`)
140
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
141
+
15
142
  INSERT INTO schema_migrations (version) VALUES ('20131217101010');
16
143
 
17
144
  INSERT INTO schema_migrations (version) VALUES ('20131221064151');
@@ -28,4 +155,12 @@ INSERT INTO schema_migrations (version) VALUES ('20131221064156');
28
155
 
29
156
  INSERT INTO schema_migrations (version) VALUES ('20131221064157');
30
157
 
31
- INSERT INTO schema_migrations (version) VALUES ('20131221072600');
158
+ INSERT INTO schema_migrations (version) VALUES ('20131221072600');
159
+
160
+ INSERT INTO schema_migrations (version) VALUES ('20150420163235');
161
+
162
+ INSERT INTO schema_migrations (version) VALUES ('20150420163804');
163
+
164
+ INSERT INTO schema_migrations (version) VALUES ('20150421151457');
165
+
166
+ INSERT INTO schema_migrations (version) VALUES ('20150423143754');
@@ -0,0 +1,11 @@
1
+ Feature: Bounce Management
2
+ In order track mail bounces
3
+ As a valid user
4
+ I want to list, dismiss and fail bounces
5
+
6
+ Scenario: Paginate bounces
7
+ Given 50 bounces exist
8
+ When I go to the bounces page
9
+ Then I should see "Previous"
10
+ And I should see "Next"
11
+ When I follow "Next"
@@ -0,0 +1,91 @@
1
+ Feature: Manage Contacts
2
+ In order to value
3
+ As a role
4
+ I want feature
5
+
6
+ Background:
7
+ Given a contact named "Bob Dole" exists with email_address "bob@example.com"
8
+ And I am logged in and authorized for everything
9
+
10
+ Scenario: Search Contacts that exist
11
+ When I go to the contacts page
12
+ And I fill in "term" with "bob"
13
+ And I press "Search"
14
+ Then I should be on the contacts page
15
+ And I should see "bob@example.com"
16
+
17
+ Scenario: Search Contacts that don't exist
18
+ When I go to the contacts page
19
+ And I fill in "term" with "sam"
20
+ And I press "Search"
21
+ Then I should be on the contacts page
22
+ And I should not see "bob@example.com"
23
+
24
+ @javascript
25
+ Scenario: Search for contacts by mailing list and status
26
+ Given a contact named "Babs Dole" exists with email_address "babs@example.com"
27
+ And a mailing list named "Peeps" exists
28
+ And the contact named "Babs Dole" is subscribed to "Peeps"
29
+ When I go to the contacts page
30
+ Then I should see "bob@example.com"
31
+ And I should see "babs@example.com"
32
+ When I select "Peeps" from "Mailing List"
33
+ And I select "Any" from "Status"
34
+ And I press "Search"
35
+ Then I should see "babs@example.com"
36
+ And I should not see "bob@example.com"
37
+ When I select "Pending" from "Status"
38
+ And I press "Search"
39
+ Then I should not see "babs@example.com"
40
+ And I should not see "bob@example.com"
41
+
42
+ Scenario: New contact
43
+ Given a mailing list named "Peeps" exists
44
+ And a mailing list named "Others" exists
45
+ When I go to the new contact page
46
+ And I fill in "First name" with "Bobo"
47
+ And I fill in "Last name" with "Clown"
48
+ And I fill in "Email address" with "bobo@example.com"
49
+ And I check "Peeps"
50
+ And I press "Submit"
51
+ Then contact "Bobo Clown" should exist with email_address "bobo@example.com"
52
+ And contact "Bobo Clown" should be subscribed to "Peeps" with the "active" status
53
+
54
+ Scenario: Soft Delete a contact
55
+ When I go to the contacts page
56
+ And I follow "Delete"
57
+ Then I should be on the contacts page
58
+ And the contact "Bob Dole" should be soft deleted
59
+ And I should not see "Bob Dole"
60
+ When I undelete contact "Bob Dole"
61
+ And I go to the contacts page
62
+ Then I should see "Bob Dole"
63
+
64
+
65
+ Scenario: Edit contact
66
+ Given a mailing list named "Peeps" exists
67
+ And a mailing list named "Others" exists
68
+ When I go to the contacts page
69
+ And I follow "Edit"
70
+ And I fill in "First name" with "Bobo"
71
+ And I fill in "Last name" with "Clown"
72
+ And I fill in "Email address" with "bobo@example.com"
73
+ And I check "Peeps"
74
+ And I press "Submit"
75
+ Then contact "Bobo Clown" should exist with email_address "bobo@example.com"
76
+ And contact "Bobo Clown" should be subscribed to "Peeps" with the "active" status
77
+
78
+ Scenario: Many contacts existing will show pagination
79
+ Given 50 contacts exist
80
+ When I go to the contacts page
81
+ Then I should see "Previous"
82
+ And I should see "Next"
83
+ When I follow "Next"
84
+
85
+ # need to reincorproate double-opt-in subscribe
86
+ @wip
87
+ Scenario: Subscribe to a list by email address(site form) with no redirect defined
88
+ Given a mailing list named "Peeps" exists
89
+ When I submit a static subscribe form for "Bobo Clown" with email address "bobo@example.com" and the mailing list named "Peeps"
90
+ Then I should be on the mail manager thank you page
91
+ And contact "Bobo Clown" should be subscribed to "Peeps" with the "pending" status