mjml-rails 2.3.0 → 2.3.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +10 -0
- data/lib/mjml/railtie.rb +2 -2
- data/lib/mjml/version.rb +1 -1
- data/test/mjml_subdir_test.rb +76 -0
- metadata +4 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4f4a694f6d5d155de20776d58e52e2737479e7
|
4
|
+
data.tar.gz: ab526a394813f106708917f422813aae9938a871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4c114510e82242c8cc4cf4411142416eb0de247bb5e37b211e9472fee9811d75b786db8b95720d6bde7964bf002d9da82b867210e1d7e663bad8b0e5e12893
|
7
|
+
data.tar.gz: 35c67496d8d3aa868e71a1801ad41c13545aa5a15cd39f252261ca859d9433c3e5e4d801752a3875ef4dcad68048eada0da9cfeda9f5fdad3c7f1fc4cb71dfa4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -65,6 +65,16 @@ Install the MJML parser (optional -g to install it globally):
|
|
65
65
|
npm install -g mjml@^3.0
|
66
66
|
```
|
67
67
|
|
68
|
+
### MJML v3.x support
|
69
|
+
|
70
|
+
Version 2.3.0 of this gem brings support for MJML 3.x
|
71
|
+
|
72
|
+
If you'd rather still stick with MJML 2.x then lock the mjml-rails gem:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
gem 'mjml-rails', '2.2.0'
|
76
|
+
```
|
77
|
+
|
68
78
|
### How to guides
|
69
79
|
|
70
80
|
[Hugo Giraudel](https://twitter.com/hugogiraudel) wrote a post on [using MJML in Rails](http://dev.edenspiekermann.com/2016/06/02/using-mjml-in-rails/).
|
data/lib/mjml/railtie.rb
CHANGED
data/lib/mjml/version.rb
CHANGED
@@ -0,0 +1,76 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class SubdirNotifier < ActionMailer::Base
|
4
|
+
self.view_paths = File.expand_path("../views", __FILE__)
|
5
|
+
|
6
|
+
layout false
|
7
|
+
|
8
|
+
def simple_block(format_type)
|
9
|
+
mail(:to => 'foo@bar.com', :from => "john.doe@example.com") do |format|
|
10
|
+
format.send(format_type)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def simple_block_and_path(format_type)
|
15
|
+
mail(:template_path => 'template_subdir',:to => 'foo@bar.com', :from => "john.doe@example.com") do |format|
|
16
|
+
format.send(format_type)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def simple_with_path(format_type)
|
21
|
+
mail(:template_path => 'template_subdir',:to => 'foo@bar.com', :from => "john.doe@example.com")
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
# class TestRenderer < ActionView::PartialRenderer
|
27
|
+
# attr_accessor :show_text
|
28
|
+
# def initialize(render_options = {})
|
29
|
+
# @show_text = render_options.delete(:show_text)
|
30
|
+
# super(render_options)
|
31
|
+
# end
|
32
|
+
|
33
|
+
# def normal_text(text)
|
34
|
+
# show_text ? "TEST #{text}" : "TEST"
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
|
38
|
+
class MjmlTest < ActiveSupport::TestCase
|
39
|
+
|
40
|
+
setup do
|
41
|
+
@original_renderer = Mjml.renderer
|
42
|
+
@original_processing_options = Mjml.processing_options
|
43
|
+
end
|
44
|
+
|
45
|
+
teardown do
|
46
|
+
Mjml.renderer = @original_renderer
|
47
|
+
Mjml.processing_options = @original_processing_options
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
test 'in a subdir with a block fails' do
|
52
|
+
assert_raises(ActionView::MissingTemplate) do
|
53
|
+
email = SubdirNotifier.simple_block(:mjml)
|
54
|
+
assert_equal "text/html", email.mime_type
|
55
|
+
assert_match(/alternate sub-directory/, email.body.encoded.strip)
|
56
|
+
assert_no_match(/mj-text/, email.body.encoded.strip)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
test 'in a subdir with a block and template_path option fails' do
|
61
|
+
assert_raises(ActionView::MissingTemplate) do
|
62
|
+
email = SubdirNotifier.simple_block_and_path(:mjml)
|
63
|
+
assert_equal "text/html", email.mime_type
|
64
|
+
assert_match(/alternate sub-directory/, email.body.encoded.strip)
|
65
|
+
assert_no_match(/mj-text/, email.body.encoded.strip)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
test 'in a subdir with path' do
|
70
|
+
email = SubdirNotifier.simple_with_path(:mjml)
|
71
|
+
assert_equal "text/html", email.mime_type
|
72
|
+
assert_match(/alternate sub-directory/, email.body.encoded.strip)
|
73
|
+
assert_no_match(/mj-text/, email.body.encoded.strip)
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mjml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Loffler
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
5hPZOkUdP3egZ1xAHeFIOhTIaOJezjUEDQVattPkgwl25+Q2EXJ+5ehDU86v+lxH
|
32
32
|
E9hMwkxwQntg0fKVFbnVMOg2itaj8fJ7
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-10-
|
34
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
35
35
|
dependencies: []
|
36
36
|
description: Render MJML + ERb template views in Rails
|
37
37
|
email: sighmon@sighmon.com
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/mjml/railtie.rb
|
52
52
|
- lib/mjml/version.rb
|
53
53
|
- test/generator_test.rb
|
54
|
+
- test/mjml_subdir_test.rb
|
54
55
|
- test/mjml_test.rb
|
55
56
|
- test/template_test.rb
|
56
57
|
- test/test_helper.rb
|
@@ -80,6 +81,7 @@ specification_version: 4
|
|
80
81
|
summary: MJML + ERb templates
|
81
82
|
test_files:
|
82
83
|
- test/generator_test.rb
|
84
|
+
- test/mjml_subdir_test.rb
|
83
85
|
- test/mjml_test.rb
|
84
86
|
- test/template_test.rb
|
85
87
|
- test/test_helper.rb
|
metadata.gz.sig
CHANGED
Binary file
|