maily 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/app/assets/stylesheets/maily/application.scss +5 -0
  4. data/app/controllers/maily/emails_controller.rb +5 -2
  5. data/app/views/maily/emails/index.html.erb +5 -1
  6. data/app/views/maily/emails/show.html.erb +1 -1
  7. data/lib/maily.rb +1 -1
  8. data/lib/maily/version.rb +1 -1
  9. metadata +3 -118
  10. data/.gitignore +0 -7
  11. data/.travis.yml +0 -16
  12. data/Appraisals +0 -15
  13. data/Gemfile +0 -3
  14. data/Rakefile +0 -6
  15. data/gemfiles/rails_4.2.gemfile +0 -7
  16. data/gemfiles/rails_5.0.gemfile +0 -7
  17. data/gemfiles/rails_5.1.gemfile +0 -7
  18. data/gemfiles/rails_5.2.gemfile +0 -7
  19. data/maily.gemspec +0 -24
  20. data/screenshot.png +0 -0
  21. data/spec/controllers_spec.rb +0 -71
  22. data/spec/dummy/README.md +0 -9
  23. data/spec/dummy/Rakefile +0 -6
  24. data/spec/dummy/app/assets/images/.keep +0 -0
  25. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  26. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  27. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  28. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  30. data/spec/dummy/app/mailers/application_mailer.rb +0 -7
  31. data/spec/dummy/app/mailers/notifier.rb +0 -29
  32. data/spec/dummy/app/models/.keep +0 -0
  33. data/spec/dummy/app/models/concerns/.keep +0 -0
  34. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  35. data/spec/dummy/app/views/notifications/recommendation.html.erb +0 -1
  36. data/spec/dummy/app/views/notifier/generic_welcome.html.erb +0 -1
  37. data/spec/dummy/app/views/notifier/invitation.html.erb +0 -1
  38. data/spec/dummy/app/views/notifier/multipart.html.erb +0 -1
  39. data/spec/dummy/app/views/notifier/multipart.text.erb +0 -1
  40. data/spec/dummy/app/views/notifier/welcome.html.erb +0 -1
  41. data/spec/dummy/app/views/notifier/with_slim_template.html.slim +0 -1
  42. data/spec/dummy/bin/bundle +0 -3
  43. data/spec/dummy/bin/rails +0 -4
  44. data/spec/dummy/bin/rake +0 -4
  45. data/spec/dummy/config.ru +0 -4
  46. data/spec/dummy/config/application.rb +0 -28
  47. data/spec/dummy/config/boot.rb +0 -5
  48. data/spec/dummy/config/environment.rb +0 -5
  49. data/spec/dummy/config/environments/development.rb +0 -29
  50. data/spec/dummy/config/environments/production.rb +0 -80
  51. data/spec/dummy/config/environments/test.rb +0 -36
  52. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  53. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  54. data/spec/dummy/config/initializers/inflections.rb +0 -16
  55. data/spec/dummy/config/initializers/maily.rb +0 -5
  56. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  57. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  58. data/spec/dummy/config/initializers/session_store.rb +0 -3
  59. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  60. data/spec/dummy/config/locales/en.yml +0 -23
  61. data/spec/dummy/config/routes.rb +0 -56
  62. data/spec/dummy/lib/maily_hooks.rb +0 -10
  63. data/spec/dummy/log/.keep +0 -0
  64. data/spec/dummy/public/404.html +0 -58
  65. data/spec/dummy/public/422.html +0 -58
  66. data/spec/dummy/public/500.html +0 -57
  67. data/spec/dummy/public/favicon.ico +0 -0
  68. data/spec/email_spec.rb +0 -95
  69. data/spec/generator_spec.rb +0 -14
  70. data/spec/mailer_spec.rb +0 -41
  71. data/spec/maily_spec.rb +0 -42
  72. data/spec/spec_helper.rb +0 -24
@@ -1,56 +0,0 @@
1
- Dummy::Application.routes.draw do
2
- # The priority is based upon order of creation: first created -> highest priority.
3
- # See how all your routes lay out with "rake routes".
4
-
5
- # You can have the root of your site routed with "root"
6
- # root 'welcome#index'
7
-
8
- # Example of regular route:
9
- # get 'products/:id' => 'catalog#view'
10
-
11
- # Example of named route that can be invoked with purchase_url(id: product.id)
12
- # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
-
14
- # Example resource route (maps HTTP verbs to controller actions automatically):
15
- # resources :products
16
-
17
- # Example resource route with options:
18
- # resources :products do
19
- # member do
20
- # get 'short'
21
- # post 'toggle'
22
- # end
23
- #
24
- # collection do
25
- # get 'sold'
26
- # end
27
- # end
28
-
29
- # Example resource route with sub-resources:
30
- # resources :products do
31
- # resources :comments, :sales
32
- # resource :seller
33
- # end
34
-
35
- # Example resource route with more complex sub-resources:
36
- # resources :products do
37
- # resources :comments
38
- # resources :sales do
39
- # get 'recent', on: :collection
40
- # end
41
- # end
42
-
43
- # Example resource route with concerns:
44
- # concern :toggleable do
45
- # post 'toggle'
46
- # end
47
- # resources :posts, concerns: :toggleable
48
- # resources :photos, concerns: :toggleable
49
-
50
- # Example resource route within a namespace:
51
- # namespace :admin do
52
- # # Directs /admin/products/* to Admin::ProductsController
53
- # # (app/controllers/admin/products_controller.rb)
54
- # resources :products
55
- # end
56
- end
@@ -1,10 +0,0 @@
1
- email = -> { 'foo@foo.com' }
2
-
3
- Maily.hooks_for('Notifier') do |mailer|
4
- mailer.register_hook(:invitation, email)
5
- mailer.register_hook(:recommendation, template_path: 'notifications', description: 'description')
6
- mailer.register_hook(:custom_template_name, template_name: 'invitation')
7
- mailer.register_hook(:generic_welcome)
8
-
9
- mailer.hide_email(:hidden)
10
- end
File without changes
@@ -1,58 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/404.html -->
52
- <div class="dialog">
53
- <h1>The page you were looking for doesn't exist.</h1>
54
- <p>You may have mistyped the address or the page may have moved.</p>
55
- </div>
56
- <p>If you are the application owner check the logs for more information.</p>
57
- </body>
58
- </html>
@@ -1,58 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/422.html -->
52
- <div class="dialog">
53
- <h1>The change you wanted was rejected.</h1>
54
- <p>Maybe you tried to change something you didn't have access to.</p>
55
- </div>
56
- <p>If you are the application owner check the logs for more information.</p>
57
- </body>
58
- </html>
@@ -1,57 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style>
6
- body {
7
- background-color: #EFEFEF;
8
- color: #2E2F30;
9
- text-align: center;
10
- font-family: arial, sans-serif;
11
- }
12
-
13
- div.dialog {
14
- width: 25em;
15
- margin: 4em auto 0 auto;
16
- border: 1px solid #CCC;
17
- border-right-color: #999;
18
- border-left-color: #999;
19
- border-bottom-color: #BBB;
20
- border-top: #B00100 solid 4px;
21
- border-top-left-radius: 9px;
22
- border-top-right-radius: 9px;
23
- background-color: white;
24
- padding: 7px 4em 0 4em;
25
- }
26
-
27
- h1 {
28
- font-size: 100%;
29
- color: #730E15;
30
- line-height: 1.5em;
31
- }
32
-
33
- body > p {
34
- width: 33em;
35
- margin: 0 auto 1em;
36
- padding: 1em 0;
37
- background-color: #F7F7F7;
38
- border: 1px solid #CCC;
39
- border-right-color: #999;
40
- border-bottom-color: #999;
41
- border-bottom-left-radius: 4px;
42
- border-bottom-right-radius: 4px;
43
- border-top-color: #DADADA;
44
- color: #666;
45
- box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
- }
47
- </style>
48
- </head>
49
-
50
- <body>
51
- <!-- This file lives in public/500.html -->
52
- <div class="dialog">
53
- <h1>We're sorry, but something went wrong.</h1>
54
- </div>
55
- <p>If you are the application owner check the logs for more information.</p>
56
- </body>
57
- </html>
File without changes
@@ -1,95 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Maily::Email do
4
- let(:mailer) { Maily::Mailer.find('notifier') }
5
-
6
- context "with no arguments" do
7
- let (:email) { mailer.find_email('welcome') }
8
-
9
- it "should not require hook" do
10
- expect(email.required_arguments).to be_blank
11
- expect(email.require_hook?).to be false
12
- end
13
-
14
- it ".call" do
15
- expect { email.call }.to_not raise_error
16
- end
17
- end
18
-
19
- context "with arguments" do
20
- let (:email) { mailer.find_email('invitation') }
21
-
22
- it "should require hook" do
23
- expect(email.required_arguments).to be_present
24
- expect(email.require_hook?).to be true
25
- end
26
-
27
- it 'should handle lazy arguments successfully' do
28
- expect(email.arguments).to be_present
29
- expect(email.arguments.size).to eq(email.required_arguments.size)
30
- end
31
-
32
- it 'should handle not lazy arguments successfully' do
33
- allow(email).to receive(:email).and_return('foo@foo.com')
34
-
35
- expect(email.arguments).to be_present
36
- expect(email.arguments.size).to eq(email.required_arguments.size)
37
- end
38
-
39
- it ".call" do
40
- expect { email.call }.to_not raise_error
41
- end
42
- end
43
-
44
- it "should handle template_path via hook" do
45
- email = mailer.find_email('recommendation')
46
-
47
- expect(email.template_path).to eq('notifications')
48
- end
49
-
50
- it "should handle template_name via hook" do
51
- email = mailer.find_email('custom_template_name')
52
-
53
- expect(email.template_name).to eq('invitation')
54
- end
55
-
56
- it "should handle description via hook" do
57
- email = mailer.find_email('recommendation')
58
-
59
- expect(email.description).to eq('description')
60
- end
61
-
62
- describe '#validate_arguments' do
63
- it 'emails with no arguments required' do
64
- email = mailer.find_email('welcome')
65
- expect(email.validate_arguments).to eq [true, nil]
66
-
67
- email.arguments = ["asd"]
68
- expect(email.validate_arguments[1]).to eq("welcome email requires at the most 0 arguments, passed 1")
69
- end
70
-
71
- it 'emails with arguments required' do
72
- email = mailer.find_email('invitation')
73
- expect(email.validate_arguments).to eq [true, nil]
74
-
75
- email = mailer.find_email('recommendation')
76
- expect(email.validate_arguments[1]).to eq("recommendation email requires at least 1 arguments, passed 0")
77
- end
78
- end
79
-
80
- describe '#path' do
81
- it 'with a multipart email defaults to html' do
82
- email = mailer.find_email('multipart')
83
-
84
- expect(email.path).to include('multipart.html.erb')
85
- expect(email.path('text')).to include('multipart.text.erb')
86
- expect(email.path('foo')).to eq nil
87
- end
88
-
89
- it 'with other template engines (e.g. Slim)' do
90
- email = mailer.find_email('with_slim_template')
91
-
92
- expect(email.path).to include('with_slim_template.html.slim')
93
- end
94
- end
95
- end
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Maily::Generator do
4
- it '.run generates valid fixtures and hooks for current application' do
5
- expect(Maily::Generator.run).to eq <<-HOOKS.strip_heredoc
6
- email = ''
7
-
8
- Maily.hooks_for('Notifier') do |mailer|
9
- mailer.register_hook(:invitation, email)
10
- mailer.register_hook(:recommendation, email)
11
- end
12
- HOOKS
13
- end
14
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Maily::Mailer do
4
- let(:mailer) { Maily::Mailer.find('notifier') }
5
-
6
- it "should load mailers" do
7
- expect(Maily::Mailer.all.keys).to include('application_mailer', 'notifier')
8
- end
9
-
10
- it "should build emails" do
11
- expect(mailer.emails.size).to eq(7)
12
- end
13
-
14
- it "should find mailers by name" do
15
- expect(Maily::Mailer.find('notifier').name).to eq('notifier')
16
- end
17
-
18
- it "should find emails by name" do
19
- expect(mailer.find_email('welcome').name).to eq('welcome')
20
- end
21
-
22
- it "allow to add inherited emails via a hook" do
23
- expect(mailer.find_email('generic_welcome').name).to eq('generic_welcome')
24
- end
25
-
26
- it "allows to hide email" do
27
- expect(mailer.find_email('hidden')).to be nil
28
- end
29
-
30
- it ".list returns an array with all mailers" do
31
- list = Maily::Mailer.list
32
-
33
- expect(list).to be_an_instance_of(Array)
34
- expect(list.sample).to be_an_instance_of(Maily::Mailer)
35
- end
36
-
37
- it "#emails_list returns an array with all emails" do
38
- expect(mailer.emails_list).to be_an_instance_of(Array)
39
- expect(mailer.emails_list.sample).to be_an_instance_of(Maily::Email)
40
- end
41
- end
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Maily do
4
- it "#setup should initialize with some defaults if no block is provided" do
5
- Maily.setup
6
-
7
- expect(Maily.enabled).to be true
8
- expect(Maily.allow_edition).to be true
9
- expect(Maily.allow_delivery).to be true
10
- expect(Maily.available_locales).to eq([:en, :es, :pt, :fr])
11
- expect(Maily.base_controller).to eq('ActionController::Base')
12
- expect(Maily.http_authorization).to be nil
13
- end
14
-
15
- describe '#allowed_action?' do
16
- it "should not allow edition if edition is disabled" do
17
- Maily.allow_edition = false
18
-
19
- expect(Maily.allowed_action?(:edit)).to be false
20
- expect(Maily.allowed_action?(:update)).to be false
21
- end
22
-
23
- it "should not allow delivery if delivery is disabled" do
24
- Maily.allow_delivery = false
25
-
26
- expect(Maily.allowed_action?(:deliver)).to be false
27
- end
28
- end
29
-
30
- describe '#hooks_for' do
31
- it "allows to register external hooks" do
32
- class ExternalMailer < ActionMailer::Base
33
- def external_email
34
- end
35
- end
36
-
37
- Maily.hooks_for('ExternalMailer')
38
-
39
- expect(Maily::Mailer.find('external_mailer').emails.count).to eq 1
40
- end
41
- end
42
- end
@@ -1,24 +0,0 @@
1
- ENV['RAILS_ENV'] = 'test'
2
-
3
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
- require 'rspec/rails'
5
- require 'maily'
6
-
7
- RSpec.configure do |config|
8
- config.mock_with :rspec
9
- config.order = 'random'
10
- end
11
-
12
- # Rails 4.2 call `initialize` inside `recycle!`. However Ruby 2.6 doesn't allow calling `initialize` twice.
13
- # More info: https://github.com/rails/rails/issues/34790
14
- if RUBY_VERSION >= "2.6.0" && Rails.version < "5"
15
- module ActionController
16
- class TestResponse < ActionDispatch::TestResponse
17
- def recycle!
18
- @mon_mutex_owner_object_id = nil
19
- @mon_mutex = nil
20
- initialize
21
- end
22
- end
23
- end
24
- end